resolve comments

This commit is contained in:
Dmitry Shibanov 2022-12-27 17:44:25 +01:00
parent df00183c09
commit e81c4f8a21
14 changed files with 78 additions and 78 deletions

View File

@ -10,7 +10,7 @@ import osm from 'os';
import path from 'path'; import path from 'path';
import * as main from '../src/main'; import * as main from '../src/main';
import * as auth from '../src/authutil'; import * as auth from '../src/authutil';
import {INodeVersion} from '../src/distibutions/base-models'; import {INodeVersion} from '../src/distributions/base-models';
const nodeTestManifest = require('./data/versions-manifest.json'); const nodeTestManifest = require('./data/versions-manifest.json');
const nodeTestDist = require('./data/node-dist-index.json'); const nodeTestDist = require('./data/node-dist-index.json');

View File

@ -11,7 +11,7 @@ import each from 'jest-each';
import * as main from '../src/main'; import * as main from '../src/main';
import * as util from '../src/util'; import * as util from '../src/util';
import OfficialBuilds from '../src/distibutions/official_builds/official_builds'; import OfficialBuilds from '../src/distributions/official_builds/official_builds';
describe('main tests', () => { describe('main tests', () => {
let inputs = {} as any; let inputs = {} as any;
@ -33,7 +33,7 @@ describe('main tests', () => {
let findSpy: jest.SpyInstance; let findSpy: jest.SpyInstance;
let isCacheActionAvailable: jest.SpyInstance; let isCacheActionAvailable: jest.SpyInstance;
let getNodeJsInfoSpy: jest.SpyInstance; let setupNodeJsSpy: jest.SpyInstance;
beforeEach(() => { beforeEach(() => {
inputs = {}; inputs = {};
@ -70,8 +70,8 @@ describe('main tests', () => {
// process.stderr.write('write:' + line + '\n'); // process.stderr.write('write:' + line + '\n');
}); });
getNodeJsInfoSpy = jest.spyOn(OfficialBuilds.prototype, 'getNodeJsInfo'); setupNodeJsSpy = jest.spyOn(OfficialBuilds.prototype, 'setupNodeJs');
getNodeJsInfoSpy.mockImplementation(() => {}); setupNodeJsSpy.mockImplementation(() => {});
}); });
afterEach(() => { afterEach(() => {

View File

@ -10,7 +10,7 @@ import osm from 'os';
import path from 'path'; import path from 'path';
import * as main from '../src/main'; import * as main from '../src/main';
import * as auth from '../src/authutil'; import * as auth from '../src/authutil';
import {INodeVersion} from '../src/distibutions/base-models'; import {INodeVersion} from '../src/distributions/base-models';
const nodeTestManifest = require('./data/versions-manifest.json'); const nodeTestManifest = require('./data/versions-manifest.json');
const nodeTestDist = require('./data/node-dist-index.json'); const nodeTestDist = require('./data/node-dist-index.json');

View File

@ -10,8 +10,8 @@ import osm from 'os';
import path from 'path'; import path from 'path';
import * as main from '../src/main'; import * as main from '../src/main';
import * as auth from '../src/authutil'; import * as auth from '../src/authutil';
import OfficialBuilds from '../src/distibutions/official_builds/official_builds'; import OfficialBuilds from '../src/distributions/official_builds/official_builds';
import {INodeVersion} from '../src/distibutions/base-models'; import {INodeVersion} from '../src/distributions/base-models';
const nodeTestManifest = require('./data/versions-manifest.json'); const nodeTestManifest = require('./data/versions-manifest.json');
const nodeTestDist = require('./data/node-dist-index.json'); const nodeTestDist = require('./data/node-dist-index.json');

View File

@ -10,7 +10,7 @@ import osm from 'os';
import path from 'path'; import path from 'path';
import * as main from '../src/main'; import * as main from '../src/main';
import * as auth from '../src/authutil'; import * as auth from '../src/authutil';
import {INodeVersion} from '../src/distibutions/base-models'; import {INodeVersion} from '../src/distributions/base-models';
const nodeTestDist = require('./data/node-dist-index.json'); const nodeTestDist = require('./data/node-dist-index.json');
const nodeTestDistNightly = require('./data/node-nightly-index.json'); const nodeTestDistNightly = require('./data/node-nightly-index.json');

72
dist/setup/index.js vendored
View File

@ -73222,7 +73222,7 @@ var Outputs;
/***/ }), /***/ }),
/***/ 8653: /***/ 7:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict"; "use strict";
@ -73277,24 +73277,24 @@ class BaseDistribution {
maxRetries: 3 maxRetries: 3
}); });
} }
getNodeJsInfo() { setupNodeJs() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let nodeVersions; let nodeJsVersions;
if (this.nodeInfo.checkLatest) { if (this.nodeInfo.checkLatest) {
nodeVersions = yield this.getNodejsVersions(); nodeJsVersions = yield this.getNodeJsVersions();
const versions = this.filterVersions(nodeVersions); const versions = this.filterVersions(nodeJsVersions);
const evaluatedVersion = this.evaluateVersions(versions); const evaluatedVersion = this.evaluateVersions(versions);
if (evaluatedVersion) { if (evaluatedVersion) {
this.nodeInfo.versionSpec = evaluatedVersion; this.nodeInfo.versionSpec = evaluatedVersion;
} }
} }
let toolPath = this.findVersionInHoostedToolCacheDirectory(); let toolPath = this.findVersionInHostedToolCacheDirectory();
if (toolPath) { if (toolPath) {
core.info(`Found in cache @ ${toolPath}`); core.info(`Found in cache @ ${toolPath}`);
} }
else { else {
nodeVersions = nodeVersions !== null && nodeVersions !== void 0 ? nodeVersions : (yield this.getNodejsVersions()); nodeJsVersions = nodeJsVersions !== null && nodeJsVersions !== void 0 ? nodeJsVersions : (yield this.getNodeJsVersions());
const versions = this.filterVersions(nodeVersions); const versions = this.filterVersions(nodeJsVersions);
const evaluatedVersion = this.evaluateVersions(versions); const evaluatedVersion = this.evaluateVersions(versions);
if (!evaluatedVersion) { if (!evaluatedVersion) {
throw new Error(`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`); throw new Error(`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`);
@ -73308,10 +73308,10 @@ class BaseDistribution {
core.addPath(toolPath); core.addPath(toolPath);
}); });
} }
findVersionInHoostedToolCacheDirectory() { findVersionInHostedToolCacheDirectory() {
return tc.find('node', this.nodeInfo.versionSpec, this.nodeInfo.arch); return tc.find('node', this.nodeInfo.versionSpec, this.nodeInfo.arch);
} }
getNodejsVersions() { getNodeJsVersions() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const initialUrl = this.getDistributionUrl(); const initialUrl = this.getDistributionUrl();
const dataUrl = `${initialUrl}/index.json`; const dataUrl = `${initialUrl}/index.json`;
@ -73442,10 +73442,10 @@ class BaseDistribution {
} }
return dataFileName; return dataFileName;
} }
filterVersions(nodeVersions) { filterVersions(nodeJsVersions) {
const versions = []; const versions = [];
const dataFileName = this.getDistFileName(this.nodeInfo.arch); const dataFileName = this.getDistFileName(this.nodeInfo.arch);
nodeVersions.forEach((nodeVersion) => { nodeJsVersions.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);
@ -73467,7 +73467,7 @@ exports["default"] = BaseDistribution;
/***/ }), /***/ }),
/***/ 1260: /***/ 5617:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict"; "use strict";
@ -73477,10 +73477,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getNodejsDistribution = void 0; exports.getNodejsDistribution = void 0;
const nightly_builds_1 = __importDefault(__nccwpck_require__(1002)); const nightly_builds_1 = __importDefault(__nccwpck_require__(7127));
const official_builds_1 = __importDefault(__nccwpck_require__(9856)); const official_builds_1 = __importDefault(__nccwpck_require__(7854));
const rc_builds_1 = __importDefault(__nccwpck_require__(6235)); const rc_builds_1 = __importDefault(__nccwpck_require__(8837));
const canary_builds_1 = __importDefault(__nccwpck_require__(4833)); const canary_builds_1 = __importDefault(__nccwpck_require__(969));
var Distributions; var Distributions;
(function (Distributions) { (function (Distributions) {
Distributions["DEFAULT"] = ""; Distributions["DEFAULT"] = "";
@ -73519,7 +73519,7 @@ exports.getNodejsDistribution = getNodejsDistribution;
/***/ }), /***/ }),
/***/ 1002: /***/ 7127:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict"; "use strict";
@ -73550,13 +73550,13 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const tc = __importStar(__nccwpck_require__(7784)); const tc = __importStar(__nccwpck_require__(7784));
const semver_1 = __importDefault(__nccwpck_require__(5911)); const semver_1 = __importDefault(__nccwpck_require__(5911));
const base_distribution_1 = __importDefault(__nccwpck_require__(8653)); const base_distribution_1 = __importDefault(__nccwpck_require__(7));
class NightlyNodejs extends base_distribution_1.default { class NightlyNodejs extends base_distribution_1.default {
constructor(nodeInfo) { constructor(nodeInfo) {
super(nodeInfo); super(nodeInfo);
this.distribution = 'nightly'; this.distribution = 'nightly';
} }
findVersionInHoostedToolCacheDirectory() { findVersionInHostedToolCacheDirectory() {
let toolPath = ''; let toolPath = '';
const localVersionPaths = tc const localVersionPaths = tc
.findAllVersions('node', this.nodeInfo.arch) .findAllVersions('node', this.nodeInfo.arch)
@ -73621,7 +73621,7 @@ exports["default"] = NightlyNodejs;
/***/ }), /***/ }),
/***/ 9856: /***/ 7854:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict"; "use strict";
@ -73663,15 +73663,15 @@ const tc = __importStar(__nccwpck_require__(7784));
const semver = __importStar(__nccwpck_require__(5911)); const semver = __importStar(__nccwpck_require__(5911));
const os_1 = __importDefault(__nccwpck_require__(2037)); const os_1 = __importDefault(__nccwpck_require__(2037));
const path_1 = __importDefault(__nccwpck_require__(1017)); const path_1 = __importDefault(__nccwpck_require__(1017));
const base_distribution_1 = __importDefault(__nccwpck_require__(8653)); const base_distribution_1 = __importDefault(__nccwpck_require__(7));
class OfficialBuilds extends base_distribution_1.default { class OfficialBuilds extends base_distribution_1.default {
constructor(nodeInfo) { constructor(nodeInfo) {
super(nodeInfo); super(nodeInfo);
} }
getNodeJsInfo() { setupNodeJs() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let manifest; let manifest;
let nodeVersions; let nodeJsVersions;
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch); const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
if (this.isLtsAlias(this.nodeInfo.versionSpec)) { if (this.isLtsAlias(this.nodeInfo.versionSpec)) {
core.info('Attempt to resolve LTS alias from manifest...'); core.info('Attempt to resolve LTS alias from manifest...');
@ -73680,8 +73680,8 @@ class OfficialBuilds extends base_distribution_1.default {
this.nodeInfo.versionSpec = this.resolveLtsAliasFromManifest(this.nodeInfo.versionSpec, true, manifest); this.nodeInfo.versionSpec = this.resolveLtsAliasFromManifest(this.nodeInfo.versionSpec, true, manifest);
} }
if (this.isLatestSyntax(this.nodeInfo.versionSpec)) { if (this.isLatestSyntax(this.nodeInfo.versionSpec)) {
nodeVersions = yield this.getNodejsVersions(); nodeJsVersions = yield this.getNodeJsVersions();
const versions = this.filterVersions(nodeVersions); const versions = this.filterVersions(nodeJsVersions);
this.nodeInfo.versionSpec = this.evaluateVersions(versions); this.nodeInfo.versionSpec = this.evaluateVersions(versions);
core.info('getting latest node version...'); core.info('getting latest node version...');
} }
@ -73696,7 +73696,7 @@ class OfficialBuilds extends base_distribution_1.default {
core.info(`Failed to resolve version ${this.nodeInfo.versionSpec} from manifest`); core.info(`Failed to resolve version ${this.nodeInfo.versionSpec} from manifest`);
} }
} }
let toolPath = this.findVersionInHoostedToolCacheDirectory(); let toolPath = this.findVersionInHostedToolCacheDirectory();
if (toolPath) { if (toolPath) {
core.info(`Found in cache @ ${toolPath}`); core.info(`Found in cache @ ${toolPath}`);
} }
@ -73729,8 +73729,8 @@ class OfficialBuilds extends base_distribution_1.default {
core.info('Falling back to download directly from Node'); core.info('Falling back to download directly from Node');
} }
if (!toolPath) { if (!toolPath) {
const nodeVersions = yield this.getNodejsVersions(); const nodeJsVersions = yield this.getNodeJsVersions();
const versions = this.filterVersions(nodeVersions); const versions = this.filterVersions(nodeJsVersions);
const evaluatedVersion = this.evaluateVersions(versions); const evaluatedVersion = this.evaluateVersions(versions);
if (!evaluatedVersion) { if (!evaluatedVersion) {
throw new Error(`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`); throw new Error(`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`);
@ -73842,7 +73842,7 @@ exports["default"] = OfficialBuilds;
/***/ }), /***/ }),
/***/ 6235: /***/ 8837:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict"; "use strict";
@ -73872,7 +73872,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const semver = __importStar(__nccwpck_require__(5911)); const semver = __importStar(__nccwpck_require__(5911));
const base_distribution_1 = __importDefault(__nccwpck_require__(8653)); const base_distribution_1 = __importDefault(__nccwpck_require__(7));
class RcBuild extends base_distribution_1.default { class RcBuild extends base_distribution_1.default {
constructor(nodeInfo) { constructor(nodeInfo) {
super(nodeInfo); super(nodeInfo);
@ -73905,7 +73905,7 @@ exports["default"] = RcBuild;
/***/ }), /***/ }),
/***/ 4833: /***/ 969:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict"; "use strict";
@ -73936,13 +73936,13 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const tc = __importStar(__nccwpck_require__(7784)); const tc = __importStar(__nccwpck_require__(7784));
const semver_1 = __importDefault(__nccwpck_require__(5911)); const semver_1 = __importDefault(__nccwpck_require__(5911));
const base_distribution_1 = __importDefault(__nccwpck_require__(8653)); const base_distribution_1 = __importDefault(__nccwpck_require__(7));
class CanaryBuild extends base_distribution_1.default { class CanaryBuild extends base_distribution_1.default {
constructor(nodeInfo) { constructor(nodeInfo) {
super(nodeInfo); super(nodeInfo);
this.distribution = 'v8-canary'; this.distribution = 'v8-canary';
} }
findVersionInHoostedToolCacheDirectory() { findVersionInHostedToolCacheDirectory() {
let toolPath = ''; let toolPath = '';
const localVersionPaths = tc const localVersionPaths = tc
.findAllVersions('node', this.nodeInfo.arch) .findAllVersions('node', this.nodeInfo.arch)
@ -74052,7 +74052,7 @@ const auth = __importStar(__nccwpck_require__(7573));
const path = __importStar(__nccwpck_require__(1017)); const path = __importStar(__nccwpck_require__(1017));
const cache_restore_1 = __nccwpck_require__(9517); const cache_restore_1 = __nccwpck_require__(9517);
const cache_utils_1 = __nccwpck_require__(1678); const cache_utils_1 = __nccwpck_require__(1678);
const installer_factory_1 = __nccwpck_require__(1260); const installer_factory_1 = __nccwpck_require__(5617);
const util_1 = __nccwpck_require__(2629); const util_1 = __nccwpck_require__(2629);
function run() { function run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
@ -74083,7 +74083,7 @@ function run() {
arch arch
}; };
const nodeDistribution = installer_factory_1.getNodejsDistribution(nodejsInfo); const nodeDistribution = installer_factory_1.getNodejsDistribution(nodejsInfo);
yield nodeDistribution.getNodeJsInfo(); yield nodeDistribution.setupNodeJs();
} }
yield util_1.printEnvDetailsAndSetOutput(); yield util_1.printEnvDetailsAndSetOutput();
const registryUrl = core.getInput('registry-url'); const registryUrl = core.getInput('registry-url');

View File

@ -26,11 +26,11 @@ export default abstract class BaseDistribution {
protected abstract getDistributionUrl(): string; protected abstract getDistributionUrl(): string;
protected abstract evaluateVersions(nodeVersions: string[]): string; protected abstract evaluateVersions(nodeVersions: string[]): string;
public async getNodeJsInfo() { public async setupNodeJs() {
let nodeVersions: INodeVersion[] | undefined; let nodeJsVersions: INodeVersion[] | undefined;
if (this.nodeInfo.checkLatest) { if (this.nodeInfo.checkLatest) {
nodeVersions = await this.getNodejsVersions(); nodeJsVersions = await this.getNodeJsVersions();
const versions = this.filterVersions(nodeVersions); const versions = this.filterVersions(nodeJsVersions);
const evaluatedVersion = this.evaluateVersions(versions); const evaluatedVersion = this.evaluateVersions(versions);
if (evaluatedVersion) { if (evaluatedVersion) {
@ -38,12 +38,12 @@ export default abstract class BaseDistribution {
} }
} }
let toolPath = this.findVersionInHoostedToolCacheDirectory(); let toolPath = this.findVersionInHostedToolCacheDirectory();
if (toolPath) { if (toolPath) {
core.info(`Found in cache @ ${toolPath}`); core.info(`Found in cache @ ${toolPath}`);
} else { } else {
nodeVersions = nodeVersions ?? (await this.getNodejsVersions()); nodeJsVersions = nodeJsVersions ?? (await this.getNodeJsVersions());
const versions = this.filterVersions(nodeVersions); const versions = this.filterVersions(nodeJsVersions);
const evaluatedVersion = this.evaluateVersions(versions); const evaluatedVersion = this.evaluateVersions(versions);
if (!evaluatedVersion) { if (!evaluatedVersion) {
throw new Error( throw new Error(
@ -61,11 +61,11 @@ export default abstract class BaseDistribution {
core.addPath(toolPath); core.addPath(toolPath);
} }
protected findVersionInHoostedToolCacheDirectory() { protected findVersionInHostedToolCacheDirectory() {
return tc.find('node', this.nodeInfo.versionSpec, this.nodeInfo.arch); return tc.find('node', this.nodeInfo.versionSpec, this.nodeInfo.arch);
} }
protected async getNodejsVersions(): Promise<INodeVersion[]> { protected async getNodeJsVersions(): Promise<INodeVersion[]> {
const initialUrl = this.getDistributionUrl(); const initialUrl = this.getDistributionUrl();
const dataUrl = `${initialUrl}/index.json`; const dataUrl = `${initialUrl}/index.json`;
@ -88,7 +88,7 @@ export default abstract class BaseDistribution {
return <INodeVersionInfo>{ return <INodeVersionInfo>{
downloadUrl: url, downloadUrl: url,
resolvedVersion: version, resolvedVersion: version,
arch: osArch, // have to be arch but not osArch, arch: osArch,
fileName: fileName fileName: fileName
}; };
} }
@ -227,12 +227,12 @@ export default abstract class BaseDistribution {
return dataFileName; return dataFileName;
} }
protected filterVersions(nodeVersions: INodeVersion[]) { protected filterVersions(nodeJsVersions: INodeVersion[]) {
const versions: string[] = []; const versions: string[] = [];
const dataFileName = this.getDistFileName(this.nodeInfo.arch); const dataFileName = this.getDistFileName(this.nodeInfo.arch);
nodeVersions.forEach((nodeVersion: INodeVersion) => { nodeJsVersions.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);

View File

@ -2,7 +2,7 @@ import BaseDistribution from './base-distribution';
import {INodejs} from './base-models'; import {INodejs} from './base-models';
import NightlyNodejs from './nightly/nightly_builds'; import NightlyNodejs from './nightly/nightly_builds';
import OfficialBuilds from './official_builds/official_builds'; import OfficialBuilds from './official_builds/official_builds';
import RcBuild from './official_builds/rc/rc_builds'; import RcBuild from './rc/rc_builds';
import CanaryBuild from './v8-canary/canary_builds'; import CanaryBuild from './v8-canary/canary_builds';
enum Distributions { enum Distributions {

View File

@ -12,7 +12,7 @@ export default class NightlyNodejs extends BaseDistribution {
super(nodeInfo); super(nodeInfo);
} }
protected findVersionInHoostedToolCacheDirectory(): string { protected findVersionInHostedToolCacheDirectory(): string {
let toolPath = ''; let toolPath = '';
const localVersionPaths = tc const localVersionPaths = tc
.findAllVersions('node', this.nodeInfo.arch) .findAllVersions('node', this.nodeInfo.arch)

View File

@ -16,9 +16,9 @@ export default class OfficialBuilds extends BaseDistribution {
super(nodeInfo); super(nodeInfo);
} }
public async getNodeJsInfo() { public async setupNodeJs() {
let manifest: tc.IToolRelease[] | undefined; let manifest: tc.IToolRelease[] | undefined;
let nodeVersions: INodeVersion[] | undefined; let nodeJsVersions: INodeVersion[] | undefined;
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch); const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
if (this.isLtsAlias(this.nodeInfo.versionSpec)) { if (this.isLtsAlias(this.nodeInfo.versionSpec)) {
core.info('Attempt to resolve LTS alias from manifest...'); core.info('Attempt to resolve LTS alias from manifest...');
@ -34,8 +34,8 @@ export default class OfficialBuilds extends BaseDistribution {
} }
if (this.isLatestSyntax(this.nodeInfo.versionSpec)) { if (this.isLatestSyntax(this.nodeInfo.versionSpec)) {
nodeVersions = await this.getNodejsVersions(); nodeJsVersions = await this.getNodeJsVersions();
const versions = this.filterVersions(nodeVersions); const versions = this.filterVersions(nodeJsVersions);
this.nodeInfo.versionSpec = this.evaluateVersions(versions); this.nodeInfo.versionSpec = this.evaluateVersions(versions);
core.info('getting latest node version...'); core.info('getting latest node version...');
@ -58,7 +58,7 @@ export default class OfficialBuilds extends BaseDistribution {
} }
} }
let toolPath = this.findVersionInHoostedToolCacheDirectory(); let toolPath = this.findVersionInHostedToolCacheDirectory();
if (toolPath) { if (toolPath) {
core.info(`Found in cache @ ${toolPath}`); core.info(`Found in cache @ ${toolPath}`);
@ -107,8 +107,8 @@ export default class OfficialBuilds extends BaseDistribution {
} }
if (!toolPath) { if (!toolPath) {
const nodeVersions = await this.getNodejsVersions(); const nodeJsVersions = await this.getNodeJsVersions();
const versions = this.filterVersions(nodeVersions); const versions = this.filterVersions(nodeJsVersions);
const evaluatedVersion = this.evaluateVersions(versions); const evaluatedVersion = this.evaluateVersions(versions);
if (!evaluatedVersion) { if (!evaluatedVersion) {
throw new Error( throw new Error(

View File

@ -2,8 +2,8 @@ import * as core from '@actions/core';
import * as semver from 'semver'; import * as semver from 'semver';
import BaseDistribution from '../../base-distribution'; import BaseDistribution from '../base-distribution';
import {INodejs} from '../../base-models'; import {INodejs} from '../base-models';
export default class RcBuild extends BaseDistribution { export default class RcBuild extends BaseDistribution {
constructor(nodeInfo: INodejs) { constructor(nodeInfo: INodejs) {

View File

@ -12,7 +12,7 @@ export default class CanaryBuild extends BaseDistribution {
super(nodeInfo); super(nodeInfo);
} }
protected findVersionInHoostedToolCacheDirectory(): string { protected findVersionInHostedToolCacheDirectory(): string {
let toolPath = ''; let toolPath = '';
const localVersionPaths = tc const localVersionPaths = tc
.findAllVersions('node', this.nodeInfo.arch) .findAllVersions('node', this.nodeInfo.arch)

View File

@ -7,7 +7,7 @@ import * as auth from './authutil';
import * as path from 'path'; import * as path from 'path';
import {restoreCache} from './cache-restore'; import {restoreCache} from './cache-restore';
import {isCacheFeatureAvailable} from './cache-utils'; import {isCacheFeatureAvailable} from './cache-utils';
import {getNodejsDistribution} from './distibutions/installer-factory'; import {getNodejsDistribution} from './distributions/installer-factory';
import {parseNodeVersionFile, printEnvDetailsAndSetOutput} from './util'; import {parseNodeVersionFile, printEnvDetailsAndSetOutput} from './util';
export async function run() { export async function run() {
@ -45,7 +45,7 @@ export async function run() {
arch arch
}; };
const nodeDistribution = getNodejsDistribution(nodejsInfo); const nodeDistribution = getNodejsDistribution(nodejsInfo);
await nodeDistribution.getNodeJsInfo(); await nodeDistribution.setupNodeJs();
} }
await printEnvDetailsAndSetOutput(); await printEnvDetailsAndSetOutput();