3
0
Fork 0
mirror of https://gitea.com/actions/setup-node.git synced 2024-11-25 11:39:32 +01:00

rename dist manifest to node versions

This commit is contained in:
panticmilos 2022-05-20 16:32:52 +02:00
parent b20a2561b9
commit 7569de03e7
2 changed files with 22 additions and 22 deletions

22
dist/setup/index.js vendored
View file

@ -62343,7 +62343,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
// Store manifest data to avoid multiple calls // Store manifest data to avoid multiple calls
let manifest; let manifest;
let distManifest; let nodeVersions;
let osPlat = os.platform(); let osPlat = os.platform();
let osArch = translateArchToDistUrl(arch); let osArch = translateArchToDistUrl(arch);
if (isLtsAlias(versionSpec)) { if (isLtsAlias(versionSpec)) {
@ -62353,8 +62353,8 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
versionSpec = resolveLtsAliasFromManifest(versionSpec, stable, manifest); versionSpec = resolveLtsAliasFromManifest(versionSpec, stable, manifest);
} }
if (isLatestSyntax(versionSpec)) { if (isLatestSyntax(versionSpec)) {
distManifest = yield getVersionsFromDist(); nodeVersions = yield getVersionsFromDist();
versionSpec = yield queryDistForMatch(versionSpec, arch, distManifest); versionSpec = yield queryDistForMatch(versionSpec, arch, nodeVersions);
core.info(`getting latest node version...`); core.info(`getting latest node version...`);
} }
if (checkLatest) { if (checkLatest) {
@ -62408,7 +62408,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, distManifest); info = yield getInfoFromDist(versionSpec, arch, nodeVersions);
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}.`);
} }
@ -62508,11 +62508,11 @@ function getInfoFromManifest(versionSpec, stable, auth, osArch = translateArchTo
return info; return info;
}); });
} }
function getInfoFromDist(versionSpec, arch = os.arch(), distManifest) { function getInfoFromDist(versionSpec, arch = os.arch(), nodeVersions) {
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 = yield queryDistForMatch(versionSpec, arch, distManifest); let version = yield queryDistForMatch(versionSpec, arch, nodeVersions);
if (!version) { if (!version) {
return null; return null;
} }
@ -62571,7 +62571,7 @@ function evaluateVersions(versions, versionSpec) {
} }
return version; return version;
} }
function queryDistForMatch(versionSpec, arch = os.arch(), distManifest) { function queryDistForMatch(versionSpec, arch = os.arch(), nodeVersions) {
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);
@ -62590,16 +62590,16 @@ function queryDistForMatch(versionSpec, arch = os.arch(), distManifest) {
default: default:
throw new Error(`Unexpected OS '${osPlat}'`); throw new Error(`Unexpected OS '${osPlat}'`);
} }
if (!distManifest) { if (!nodeVersions) {
core.debug('No dist manifest cached'); core.debug('No dist manifest cached');
distManifest = yield getVersionsFromDist(); nodeVersions = yield getVersionsFromDist();
} }
let versions = []; let versions = [];
if (isLatestSyntax(versionSpec)) { if (isLatestSyntax(versionSpec)) {
core.info(`getting latest node version...`); core.info(`getting latest node version...`);
return distManifest[0].version; return nodeVersions[0].version;
} }
distManifest.forEach((nodeVersion) => { nodeVersions.forEach((nodeVersion) => {
// ensure this version supports your os and platform // ensure this version supports your os and platform
if (nodeVersion.files.indexOf(dataFileName) >= 0) { if (nodeVersion.files.indexOf(dataFileName) >= 0) {
versions.push(nodeVersion.version); versions.push(nodeVersion.version);

View file

@ -38,7 +38,7 @@ export async function getNode(
) { ) {
// Store manifest data to avoid multiple calls // Store manifest data to avoid multiple calls
let manifest: INodeRelease[] | undefined; let manifest: INodeRelease[] | undefined;
let distManifest: INodeVersion[] | undefined; let nodeVersions: INodeVersion[] | undefined;
let osPlat: string = os.platform(); let osPlat: string = os.platform();
let osArch: string = translateArchToDistUrl(arch); let osArch: string = translateArchToDistUrl(arch);
@ -52,8 +52,8 @@ export async function getNode(
} }
if (isLatestSyntax(versionSpec)) { if (isLatestSyntax(versionSpec)) {
distManifest = await getVersionsFromDist(); nodeVersions = await getVersionsFromDist();
versionSpec = await queryDistForMatch(versionSpec, arch, distManifest); versionSpec = await queryDistForMatch(versionSpec, arch, nodeVersions);
core.info(`getting latest node version...`); core.info(`getting latest node version...`);
} }
@ -127,7 +127,7 @@ export async function getNode(
// Download from nodejs.org // Download from nodejs.org
// //
if (!downloadPath) { if (!downloadPath) {
info = await getInfoFromDist(versionSpec, arch, distManifest); info = await getInfoFromDist(versionSpec, arch, nodeVersions);
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}.`
@ -274,7 +274,7 @@ async function getInfoFromManifest(
async function getInfoFromDist( async function getInfoFromDist(
versionSpec: string, versionSpec: string,
arch: string = os.arch(), arch: string = os.arch(),
distManifest?: INodeVersion[] nodeVersions?: INodeVersion[]
): 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);
@ -282,7 +282,7 @@ async function getInfoFromDist(
let version: string = await queryDistForMatch( let version: string = await queryDistForMatch(
versionSpec, versionSpec,
arch, arch,
distManifest nodeVersions
); );
if (!version) { if (!version) {
@ -362,7 +362,7 @@ function evaluateVersions(versions: string[], versionSpec: string): string {
async function queryDistForMatch( async function queryDistForMatch(
versionSpec: string, versionSpec: string,
arch: string = os.arch(), arch: string = os.arch(),
distManifest?: INodeVersion[] nodeVersions?: INodeVersion[]
): Promise<string> { ): Promise<string> {
let osPlat: string = os.platform(); let osPlat: string = os.platform();
let osArch: string = translateArchToDistUrl(arch); let osArch: string = translateArchToDistUrl(arch);
@ -383,19 +383,19 @@ async function queryDistForMatch(
throw new Error(`Unexpected OS '${osPlat}'`); throw new Error(`Unexpected OS '${osPlat}'`);
} }
if (!distManifest) { if (!nodeVersions) {
core.debug('No dist manifest cached'); core.debug('No dist manifest cached');
distManifest = await getVersionsFromDist(); nodeVersions = await getVersionsFromDist();
} }
let versions: string[] = []; let versions: string[] = [];
if (isLatestSyntax(versionSpec)) { if (isLatestSyntax(versionSpec)) {
core.info(`getting latest node version...`); core.info(`getting latest node version...`);
return distManifest[0].version; return nodeVersions[0].version;
} }
distManifest.forEach((nodeVersion: INodeVersion) => { nodeVersions.forEach((nodeVersion: INodeVersion) => {
// ensure this version supports your os and platform // ensure this version supports your os and platform
if (nodeVersion.files.indexOf(dataFileName) >= 0) { if (nodeVersion.files.indexOf(dataFileName) >= 0) {
versions.push(nodeVersion.version); versions.push(nodeVersion.version);