1
0
Fork 0
mirror of https://github.com/actions/setup-node synced 2024-11-14 01:22:40 +00:00

remove unnecessary dist call

This commit is contained in:
panticmilos 2022-05-19 18:21:03 +02:00
parent 808c8f917f
commit 141334fcd1
2 changed files with 15 additions and 8 deletions

11
dist/setup/index.js vendored
View file

@ -62346,6 +62346,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
let manifest; let manifest;
let osPlat = os.platform(); let osPlat = os.platform();
let osArch = translateArchToDistUrl(arch); let osArch = translateArchToDistUrl(arch);
let latestVersionResolved = false;
if (isLtsAlias(versionSpec)) { if (isLtsAlias(versionSpec)) {
core.info('Attempt to resolve LTS alias from manifest...'); core.info('Attempt to resolve LTS alias from manifest...');
// No try-catch since it's not possible to resolve LTS alias without manifest // No try-catch since it's not possible to resolve LTS alias without manifest
@ -62365,6 +62366,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
} }
if (isLatestSyntax(versionSpec)) { if (isLatestSyntax(versionSpec)) {
versionSpec = yield queryDistForMatch(versionSpec, arch); versionSpec = yield queryDistForMatch(versionSpec, arch);
latestVersionResolved = true;
core.info(`getting latest node version...`); core.info(`getting latest node version...`);
} }
// check cache // check cache
@ -62407,7 +62409,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
// Download from nodejs.org // Download from nodejs.org
// //
if (!downloadPath) { if (!downloadPath) {
info = yield getInfoFromDist(versionSpec, arch); info = yield getInfoFromDist(versionSpec, arch, latestVersionResolved);
if (!info) { if (!info) {
throw new Error(`Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`); throw new Error(`Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`);
} }
@ -62507,12 +62509,13 @@ function getInfoFromManifest(versionSpec, stable, auth, osArch = translateArchTo
return info; return info;
}); });
} }
function getInfoFromDist(versionSpec, arch = os.arch()) { function getInfoFromDist(versionSpec, arch = os.arch(), latestVersionResolved) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let osPlat = os.platform(); let osPlat = os.platform();
let osArch = translateArchToDistUrl(arch); let osArch = translateArchToDistUrl(arch);
let version; let version = latestVersionResolved
version = yield queryDistForMatch(versionSpec, arch); ? versionSpec
: yield queryDistForMatch(versionSpec, arch);
if (!version) { if (!version) {
return null; return null;
} }

View file

@ -40,6 +40,7 @@ export async function getNode(
let manifest: INodeRelease[] | undefined; let manifest: INodeRelease[] | undefined;
let osPlat: string = os.platform(); let osPlat: string = os.platform();
let osArch: string = translateArchToDistUrl(arch); let osArch: string = translateArchToDistUrl(arch);
let latestVersionResolved: boolean = false;
if (isLtsAlias(versionSpec)) { if (isLtsAlias(versionSpec)) {
core.info('Attempt to resolve LTS alias from manifest...'); core.info('Attempt to resolve LTS alias from manifest...');
@ -69,6 +70,7 @@ export async function getNode(
if (isLatestSyntax(versionSpec)) { if (isLatestSyntax(versionSpec)) {
versionSpec = await queryDistForMatch(versionSpec, arch); versionSpec = await queryDistForMatch(versionSpec, arch);
latestVersionResolved = true;
core.info(`getting latest node version...`); core.info(`getting latest node version...`);
} }
@ -125,7 +127,7 @@ export async function getNode(
// Download from nodejs.org // Download from nodejs.org
// //
if (!downloadPath) { if (!downloadPath) {
info = await getInfoFromDist(versionSpec, arch); info = await getInfoFromDist(versionSpec, arch, latestVersionResolved);
if (!info) { if (!info) {
throw new Error( throw new Error(
`Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.` `Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`
@ -271,14 +273,16 @@ async function getInfoFromManifest(
async function getInfoFromDist( async function getInfoFromDist(
versionSpec: string, versionSpec: string,
arch: string = os.arch() arch: string = os.arch(),
latestVersionResolved?: boolean
): Promise<INodeVersionInfo | null> { ): Promise<INodeVersionInfo | null> {
let osPlat: string = os.platform(); let osPlat: string = os.platform();
let osArch: string = translateArchToDistUrl(arch); let osArch: string = translateArchToDistUrl(arch);
let version: string; let version: string = latestVersionResolved
? versionSpec
: await queryDistForMatch(versionSpec, arch);
version = await queryDistForMatch(versionSpec, arch);
if (!version) { if (!version) {
return null; return null;
} }