Skip to content

Commit

Permalink
rename dist manifest to node versions
Browse files Browse the repository at this point in the history
  • Loading branch information
panticmilos committed May 20, 2022
1 parent b20a256 commit 7569de0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
22 changes: 11 additions & 11 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62343,7 +62343,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
return __awaiter(this, void 0, void 0, function* () {
// Store manifest data to avoid multiple calls
let manifest;
let distManifest;
let nodeVersions;
let osPlat = os.platform();
let osArch = translateArchToDistUrl(arch);
if (isLtsAlias(versionSpec)) {
Expand All @@ -62353,8 +62353,8 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
versionSpec = resolveLtsAliasFromManifest(versionSpec, stable, manifest);
}
if (isLatestSyntax(versionSpec)) {
distManifest = yield getVersionsFromDist();
versionSpec = yield queryDistForMatch(versionSpec, arch, distManifest);
nodeVersions = yield getVersionsFromDist();
versionSpec = yield queryDistForMatch(versionSpec, arch, nodeVersions);
core.info(`getting latest node version...`);
}
if (checkLatest) {
Expand Down Expand Up @@ -62408,7 +62408,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
// Download from nodejs.org
//
if (!downloadPath) {
info = yield getInfoFromDist(versionSpec, arch, distManifest);
info = yield getInfoFromDist(versionSpec, arch, nodeVersions);
if (!info) {
throw new Error(`Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`);
}
Expand Down Expand Up @@ -62508,11 +62508,11 @@ function getInfoFromManifest(versionSpec, stable, auth, osArch = translateArchTo
return info;
});
}
function getInfoFromDist(versionSpec, arch = os.arch(), distManifest) {
function getInfoFromDist(versionSpec, arch = os.arch(), nodeVersions) {
return __awaiter(this, void 0, void 0, function* () {
let osPlat = os.platform();
let osArch = translateArchToDistUrl(arch);
let version = yield queryDistForMatch(versionSpec, arch, distManifest);
let version = yield queryDistForMatch(versionSpec, arch, nodeVersions);
if (!version) {
return null;
}
Expand Down Expand Up @@ -62571,7 +62571,7 @@ function evaluateVersions(versions, versionSpec) {
}
return version;
}
function queryDistForMatch(versionSpec, arch = os.arch(), distManifest) {
function queryDistForMatch(versionSpec, arch = os.arch(), nodeVersions) {
return __awaiter(this, void 0, void 0, function* () {
let osPlat = os.platform();
let osArch = translateArchToDistUrl(arch);
Expand All @@ -62590,16 +62590,16 @@ function queryDistForMatch(versionSpec, arch = os.arch(), distManifest) {
default:
throw new Error(`Unexpected OS '${osPlat}'`);
}
if (!distManifest) {
if (!nodeVersions) {
core.debug('No dist manifest cached');
distManifest = yield getVersionsFromDist();
nodeVersions = yield getVersionsFromDist();
}
let versions = [];
if (isLatestSyntax(versionSpec)) {
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
if (nodeVersion.files.indexOf(dataFileName) >= 0) {
versions.push(nodeVersion.version);
Expand Down
22 changes: 11 additions & 11 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function getNode(
) {
// Store manifest data to avoid multiple calls
let manifest: INodeRelease[] | undefined;
let distManifest: INodeVersion[] | undefined;
let nodeVersions: INodeVersion[] | undefined;
let osPlat: string = os.platform();
let osArch: string = translateArchToDistUrl(arch);

Expand All @@ -52,8 +52,8 @@ export async function getNode(
}

if (isLatestSyntax(versionSpec)) {
distManifest = await getVersionsFromDist();
versionSpec = await queryDistForMatch(versionSpec, arch, distManifest);
nodeVersions = await getVersionsFromDist();
versionSpec = await queryDistForMatch(versionSpec, arch, nodeVersions);
core.info(`getting latest node version...`);
}

Expand Down Expand Up @@ -127,7 +127,7 @@ export async function getNode(
// Download from nodejs.org
//
if (!downloadPath) {
info = await getInfoFromDist(versionSpec, arch, distManifest);
info = await getInfoFromDist(versionSpec, arch, nodeVersions);
if (!info) {
throw new Error(
`Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`
Expand Down Expand Up @@ -274,15 +274,15 @@ async function getInfoFromManifest(
async function getInfoFromDist(
versionSpec: string,
arch: string = os.arch(),
distManifest?: INodeVersion[]
nodeVersions?: INodeVersion[]
): Promise<INodeVersionInfo | null> {
let osPlat: string = os.platform();
let osArch: string = translateArchToDistUrl(arch);

let version: string = await queryDistForMatch(
versionSpec,
arch,
distManifest
nodeVersions
);

if (!version) {
Expand Down Expand Up @@ -362,7 +362,7 @@ function evaluateVersions(versions: string[], versionSpec: string): string {
async function queryDistForMatch(
versionSpec: string,
arch: string = os.arch(),
distManifest?: INodeVersion[]
nodeVersions?: INodeVersion[]
): Promise<string> {
let osPlat: string = os.platform();
let osArch: string = translateArchToDistUrl(arch);
Expand All @@ -383,19 +383,19 @@ async function queryDistForMatch(
throw new Error(`Unexpected OS '${osPlat}'`);
}

if (!distManifest) {
if (!nodeVersions) {
core.debug('No dist manifest cached');
distManifest = await getVersionsFromDist();
nodeVersions = await getVersionsFromDist();
}

let versions: string[] = [];

if (isLatestSyntax(versionSpec)) {
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
if (nodeVersion.files.indexOf(dataFileName) >= 0) {
versions.push(nodeVersion.version);
Expand Down

0 comments on commit 7569de0

Please sign in to comment.