mirror of
https://github.com/actions/setup-node
synced 2025-04-17 13:43:12 +00:00
resolve comments
This commit is contained in:
parent
df00183c09
commit
e81c4f8a21
@ -10,7 +10,7 @@ import osm from 'os';
|
||||
import path from 'path';
|
||||
import * as main from '../src/main';
|
||||
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 nodeTestDist = require('./data/node-dist-index.json');
|
||||
@ -245,7 +245,7 @@ describe('setup-node', () => {
|
||||
expect(dlSpy).toHaveBeenCalled();
|
||||
expect(exSpy).toHaveBeenCalled();
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
'Not found in manifest. Falling back to download directly from Node'
|
||||
'Not found in manifest. Falling back to download directly from Node'
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
`Attempting to download ${versionSpec}...`
|
||||
|
@ -11,7 +11,7 @@ import each from 'jest-each';
|
||||
|
||||
import * as main from '../src/main';
|
||||
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', () => {
|
||||
let inputs = {} as any;
|
||||
@ -33,7 +33,7 @@ describe('main tests', () => {
|
||||
let findSpy: jest.SpyInstance;
|
||||
let isCacheActionAvailable: jest.SpyInstance;
|
||||
|
||||
let getNodeJsInfoSpy: jest.SpyInstance;
|
||||
let setupNodeJsSpy: jest.SpyInstance;
|
||||
|
||||
beforeEach(() => {
|
||||
inputs = {};
|
||||
@ -70,8 +70,8 @@ describe('main tests', () => {
|
||||
// process.stderr.write('write:' + line + '\n');
|
||||
});
|
||||
|
||||
getNodeJsInfoSpy = jest.spyOn(OfficialBuilds.prototype, 'getNodeJsInfo');
|
||||
getNodeJsInfoSpy.mockImplementation(() => {});
|
||||
setupNodeJsSpy = jest.spyOn(OfficialBuilds.prototype, 'setupNodeJs');
|
||||
setupNodeJsSpy.mockImplementation(() => {});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@ -10,7 +10,7 @@ import osm from 'os';
|
||||
import path from 'path';
|
||||
import * as main from '../src/main';
|
||||
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 nodeTestDist = require('./data/node-dist-index.json');
|
||||
|
@ -10,8 +10,8 @@ import osm from 'os';
|
||||
import path from 'path';
|
||||
import * as main from '../src/main';
|
||||
import * as auth from '../src/authutil';
|
||||
import OfficialBuilds from '../src/distibutions/official_builds/official_builds';
|
||||
import {INodeVersion} from '../src/distibutions/base-models';
|
||||
import OfficialBuilds from '../src/distributions/official_builds/official_builds';
|
||||
import {INodeVersion} from '../src/distributions/base-models';
|
||||
|
||||
const nodeTestManifest = require('./data/versions-manifest.json');
|
||||
const nodeTestDist = require('./data/node-dist-index.json');
|
||||
@ -307,7 +307,7 @@ describe('setup-node', () => {
|
||||
`Attempting to download ${versionSpec}...`
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
'Not found in manifest. Falling back to download directly from Node'
|
||||
'Not found in manifest. Falling back to download directly from Node'
|
||||
);
|
||||
expect(dlSpy).toHaveBeenCalled();
|
||||
expect(exSpy).toHaveBeenCalled();
|
||||
@ -325,7 +325,7 @@ describe('setup-node', () => {
|
||||
await main.run();
|
||||
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
'Not found in manifest. Falling back to download directly from Node'
|
||||
'Not found in manifest. Falling back to download directly from Node'
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
`Attempting to download ${versionSpec}...`
|
||||
|
@ -10,7 +10,7 @@ import osm from 'os';
|
||||
import path from 'path';
|
||||
import * as main from '../src/main';
|
||||
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 nodeTestDistNightly = require('./data/node-nightly-index.json');
|
||||
|
76
dist/setup/index.js
vendored
76
dist/setup/index.js
vendored
@ -73222,7 +73222,7 @@ var Outputs;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8653:
|
||||
/***/ 7:
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
@ -73277,24 +73277,24 @@ class BaseDistribution {
|
||||
maxRetries: 3
|
||||
});
|
||||
}
|
||||
getNodeJsInfo() {
|
||||
setupNodeJs() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let nodeVersions;
|
||||
let nodeJsVersions;
|
||||
if (this.nodeInfo.checkLatest) {
|
||||
nodeVersions = yield this.getNodejsVersions();
|
||||
const versions = this.filterVersions(nodeVersions);
|
||||
nodeJsVersions = yield this.getNodeJsVersions();
|
||||
const versions = this.filterVersions(nodeJsVersions);
|
||||
const evaluatedVersion = this.evaluateVersions(versions);
|
||||
if (evaluatedVersion) {
|
||||
this.nodeInfo.versionSpec = evaluatedVersion;
|
||||
}
|
||||
}
|
||||
let toolPath = this.findVersionInHoostedToolCacheDirectory();
|
||||
let toolPath = this.findVersionInHostedToolCacheDirectory();
|
||||
if (toolPath) {
|
||||
core.info(`Found in cache @ ${toolPath}`);
|
||||
}
|
||||
else {
|
||||
nodeVersions = nodeVersions !== null && nodeVersions !== void 0 ? nodeVersions : (yield this.getNodejsVersions());
|
||||
const versions = this.filterVersions(nodeVersions);
|
||||
nodeJsVersions = nodeJsVersions !== null && nodeJsVersions !== void 0 ? nodeJsVersions : (yield this.getNodeJsVersions());
|
||||
const versions = this.filterVersions(nodeJsVersions);
|
||||
const evaluatedVersion = this.evaluateVersions(versions);
|
||||
if (!evaluatedVersion) {
|
||||
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);
|
||||
});
|
||||
}
|
||||
findVersionInHoostedToolCacheDirectory() {
|
||||
findVersionInHostedToolCacheDirectory() {
|
||||
return tc.find('node', this.nodeInfo.versionSpec, this.nodeInfo.arch);
|
||||
}
|
||||
getNodejsVersions() {
|
||||
getNodeJsVersions() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const initialUrl = this.getDistributionUrl();
|
||||
const dataUrl = `${initialUrl}/index.json`;
|
||||
@ -73442,10 +73442,10 @@ class BaseDistribution {
|
||||
}
|
||||
return dataFileName;
|
||||
}
|
||||
filterVersions(nodeVersions) {
|
||||
filterVersions(nodeJsVersions) {
|
||||
const versions = [];
|
||||
const dataFileName = this.getDistFileName(this.nodeInfo.arch);
|
||||
nodeVersions.forEach((nodeVersion) => {
|
||||
nodeJsVersions.forEach((nodeVersion) => {
|
||||
// ensure this version supports your os and platform
|
||||
if (nodeVersion.files.indexOf(dataFileName) >= 0) {
|
||||
versions.push(nodeVersion.version);
|
||||
@ -73467,7 +73467,7 @@ exports["default"] = BaseDistribution;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1260:
|
||||
/***/ 5617:
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
@ -73477,10 +73477,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getNodejsDistribution = void 0;
|
||||
const nightly_builds_1 = __importDefault(__nccwpck_require__(1002));
|
||||
const official_builds_1 = __importDefault(__nccwpck_require__(9856));
|
||||
const rc_builds_1 = __importDefault(__nccwpck_require__(6235));
|
||||
const canary_builds_1 = __importDefault(__nccwpck_require__(4833));
|
||||
const nightly_builds_1 = __importDefault(__nccwpck_require__(7127));
|
||||
const official_builds_1 = __importDefault(__nccwpck_require__(7854));
|
||||
const rc_builds_1 = __importDefault(__nccwpck_require__(8837));
|
||||
const canary_builds_1 = __importDefault(__nccwpck_require__(969));
|
||||
var Distributions;
|
||||
(function (Distributions) {
|
||||
Distributions["DEFAULT"] = "";
|
||||
@ -73519,7 +73519,7 @@ exports.getNodejsDistribution = getNodejsDistribution;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1002:
|
||||
/***/ 7127:
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
@ -73550,13 +73550,13 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const tc = __importStar(__nccwpck_require__(7784));
|
||||
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 {
|
||||
constructor(nodeInfo) {
|
||||
super(nodeInfo);
|
||||
this.distribution = 'nightly';
|
||||
}
|
||||
findVersionInHoostedToolCacheDirectory() {
|
||||
findVersionInHostedToolCacheDirectory() {
|
||||
let toolPath = '';
|
||||
const localVersionPaths = tc
|
||||
.findAllVersions('node', this.nodeInfo.arch)
|
||||
@ -73621,7 +73621,7 @@ exports["default"] = NightlyNodejs;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9856:
|
||||
/***/ 7854:
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
@ -73663,15 +73663,15 @@ const tc = __importStar(__nccwpck_require__(7784));
|
||||
const semver = __importStar(__nccwpck_require__(5911));
|
||||
const os_1 = __importDefault(__nccwpck_require__(2037));
|
||||
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 {
|
||||
constructor(nodeInfo) {
|
||||
super(nodeInfo);
|
||||
}
|
||||
getNodeJsInfo() {
|
||||
setupNodeJs() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let manifest;
|
||||
let nodeVersions;
|
||||
let nodeJsVersions;
|
||||
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
|
||||
if (this.isLtsAlias(this.nodeInfo.versionSpec)) {
|
||||
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);
|
||||
}
|
||||
if (this.isLatestSyntax(this.nodeInfo.versionSpec)) {
|
||||
nodeVersions = yield this.getNodejsVersions();
|
||||
const versions = this.filterVersions(nodeVersions);
|
||||
nodeJsVersions = yield this.getNodeJsVersions();
|
||||
const versions = this.filterVersions(nodeJsVersions);
|
||||
this.nodeInfo.versionSpec = this.evaluateVersions(versions);
|
||||
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`);
|
||||
}
|
||||
}
|
||||
let toolPath = this.findVersionInHoostedToolCacheDirectory();
|
||||
let toolPath = this.findVersionInHostedToolCacheDirectory();
|
||||
if (toolPath) {
|
||||
core.info(`Found in cache @ ${toolPath}`);
|
||||
}
|
||||
@ -73713,14 +73713,14 @@ class OfficialBuilds extends base_distribution_1.default {
|
||||
}
|
||||
}
|
||||
else {
|
||||
core.info('Not found in manifest. Falling back to download directly from Node');
|
||||
core.info('Not found in manifest. Falling back to download directly from Node');
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
// Rate limit?
|
||||
if (err instanceof tc.HTTPError &&
|
||||
(err.httpStatusCode === 403 || err.httpStatusCode === 429)) {
|
||||
core.info(`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`);
|
||||
core.info(`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`);
|
||||
}
|
||||
else {
|
||||
core.info(err.message);
|
||||
@ -73729,8 +73729,8 @@ class OfficialBuilds extends base_distribution_1.default {
|
||||
core.info('Falling back to download directly from Node');
|
||||
}
|
||||
if (!toolPath) {
|
||||
const nodeVersions = yield this.getNodejsVersions();
|
||||
const versions = this.filterVersions(nodeVersions);
|
||||
const nodeJsVersions = yield this.getNodeJsVersions();
|
||||
const versions = this.filterVersions(nodeJsVersions);
|
||||
const evaluatedVersion = this.evaluateVersions(versions);
|
||||
if (!evaluatedVersion) {
|
||||
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__) {
|
||||
|
||||
"use strict";
|
||||
@ -73872,7 +73872,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
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 {
|
||||
constructor(nodeInfo) {
|
||||
super(nodeInfo);
|
||||
@ -73905,7 +73905,7 @@ exports["default"] = RcBuild;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4833:
|
||||
/***/ 969:
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
@ -73936,13 +73936,13 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const tc = __importStar(__nccwpck_require__(7784));
|
||||
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 {
|
||||
constructor(nodeInfo) {
|
||||
super(nodeInfo);
|
||||
this.distribution = 'v8-canary';
|
||||
}
|
||||
findVersionInHoostedToolCacheDirectory() {
|
||||
findVersionInHostedToolCacheDirectory() {
|
||||
let toolPath = '';
|
||||
const localVersionPaths = tc
|
||||
.findAllVersions('node', this.nodeInfo.arch)
|
||||
@ -74052,7 +74052,7 @@ const auth = __importStar(__nccwpck_require__(7573));
|
||||
const path = __importStar(__nccwpck_require__(1017));
|
||||
const cache_restore_1 = __nccwpck_require__(9517);
|
||||
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);
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
@ -74083,7 +74083,7 @@ function run() {
|
||||
arch
|
||||
};
|
||||
const nodeDistribution = installer_factory_1.getNodejsDistribution(nodejsInfo);
|
||||
yield nodeDistribution.getNodeJsInfo();
|
||||
yield nodeDistribution.setupNodeJs();
|
||||
}
|
||||
yield util_1.printEnvDetailsAndSetOutput();
|
||||
const registryUrl = core.getInput('registry-url');
|
||||
|
@ -26,11 +26,11 @@ export default abstract class BaseDistribution {
|
||||
protected abstract getDistributionUrl(): string;
|
||||
protected abstract evaluateVersions(nodeVersions: string[]): string;
|
||||
|
||||
public async getNodeJsInfo() {
|
||||
let nodeVersions: INodeVersion[] | undefined;
|
||||
public async setupNodeJs() {
|
||||
let nodeJsVersions: INodeVersion[] | undefined;
|
||||
if (this.nodeInfo.checkLatest) {
|
||||
nodeVersions = await this.getNodejsVersions();
|
||||
const versions = this.filterVersions(nodeVersions);
|
||||
nodeJsVersions = await this.getNodeJsVersions();
|
||||
const versions = this.filterVersions(nodeJsVersions);
|
||||
const evaluatedVersion = this.evaluateVersions(versions);
|
||||
|
||||
if (evaluatedVersion) {
|
||||
@ -38,12 +38,12 @@ export default abstract class BaseDistribution {
|
||||
}
|
||||
}
|
||||
|
||||
let toolPath = this.findVersionInHoostedToolCacheDirectory();
|
||||
let toolPath = this.findVersionInHostedToolCacheDirectory();
|
||||
if (toolPath) {
|
||||
core.info(`Found in cache @ ${toolPath}`);
|
||||
} else {
|
||||
nodeVersions = nodeVersions ?? (await this.getNodejsVersions());
|
||||
const versions = this.filterVersions(nodeVersions);
|
||||
nodeJsVersions = nodeJsVersions ?? (await this.getNodeJsVersions());
|
||||
const versions = this.filterVersions(nodeJsVersions);
|
||||
const evaluatedVersion = this.evaluateVersions(versions);
|
||||
if (!evaluatedVersion) {
|
||||
throw new Error(
|
||||
@ -61,11 +61,11 @@ export default abstract class BaseDistribution {
|
||||
core.addPath(toolPath);
|
||||
}
|
||||
|
||||
protected findVersionInHoostedToolCacheDirectory() {
|
||||
protected findVersionInHostedToolCacheDirectory() {
|
||||
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 dataUrl = `${initialUrl}/index.json`;
|
||||
|
||||
@ -88,7 +88,7 @@ export default abstract class BaseDistribution {
|
||||
return <INodeVersionInfo>{
|
||||
downloadUrl: url,
|
||||
resolvedVersion: version,
|
||||
arch: osArch, // have to be arch but not osArch,
|
||||
arch: osArch,
|
||||
fileName: fileName
|
||||
};
|
||||
}
|
||||
@ -227,12 +227,12 @@ export default abstract class BaseDistribution {
|
||||
return dataFileName;
|
||||
}
|
||||
|
||||
protected filterVersions(nodeVersions: INodeVersion[]) {
|
||||
protected filterVersions(nodeJsVersions: INodeVersion[]) {
|
||||
const versions: string[] = [];
|
||||
|
||||
const dataFileName = this.getDistFileName(this.nodeInfo.arch);
|
||||
|
||||
nodeVersions.forEach((nodeVersion: INodeVersion) => {
|
||||
nodeJsVersions.forEach((nodeVersion: INodeVersion) => {
|
||||
// ensure this version supports your os and platform
|
||||
if (nodeVersion.files.indexOf(dataFileName) >= 0) {
|
||||
versions.push(nodeVersion.version);
|
@ -2,7 +2,7 @@ import BaseDistribution from './base-distribution';
|
||||
import {INodejs} from './base-models';
|
||||
import NightlyNodejs from './nightly/nightly_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';
|
||||
|
||||
enum Distributions {
|
@ -12,7 +12,7 @@ export default class NightlyNodejs extends BaseDistribution {
|
||||
super(nodeInfo);
|
||||
}
|
||||
|
||||
protected findVersionInHoostedToolCacheDirectory(): string {
|
||||
protected findVersionInHostedToolCacheDirectory(): string {
|
||||
let toolPath = '';
|
||||
const localVersionPaths = tc
|
||||
.findAllVersions('node', this.nodeInfo.arch)
|
@ -16,9 +16,9 @@ export default class OfficialBuilds extends BaseDistribution {
|
||||
super(nodeInfo);
|
||||
}
|
||||
|
||||
public async getNodeJsInfo() {
|
||||
public async setupNodeJs() {
|
||||
let manifest: tc.IToolRelease[] | undefined;
|
||||
let nodeVersions: INodeVersion[] | undefined;
|
||||
let nodeJsVersions: INodeVersion[] | undefined;
|
||||
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
|
||||
if (this.isLtsAlias(this.nodeInfo.versionSpec)) {
|
||||
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)) {
|
||||
nodeVersions = await this.getNodejsVersions();
|
||||
const versions = this.filterVersions(nodeVersions);
|
||||
nodeJsVersions = await this.getNodeJsVersions();
|
||||
const versions = this.filterVersions(nodeJsVersions);
|
||||
this.nodeInfo.versionSpec = this.evaluateVersions(versions);
|
||||
|
||||
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) {
|
||||
core.info(`Found in cache @ ${toolPath}`);
|
||||
@ -87,7 +87,7 @@ export default class OfficialBuilds extends BaseDistribution {
|
||||
}
|
||||
} else {
|
||||
core.info(
|
||||
'Not found in manifest. Falling back to download directly from Node'
|
||||
'Not found in manifest. Falling back to download directly from Node'
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
@ -97,7 +97,7 @@ export default class OfficialBuilds extends BaseDistribution {
|
||||
(err.httpStatusCode === 403 || err.httpStatusCode === 429)
|
||||
) {
|
||||
core.info(
|
||||
`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`
|
||||
`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`
|
||||
);
|
||||
} else {
|
||||
core.info(err.message);
|
||||
@ -107,8 +107,8 @@ export default class OfficialBuilds extends BaseDistribution {
|
||||
}
|
||||
|
||||
if (!toolPath) {
|
||||
const nodeVersions = await this.getNodejsVersions();
|
||||
const versions = this.filterVersions(nodeVersions);
|
||||
const nodeJsVersions = await this.getNodeJsVersions();
|
||||
const versions = this.filterVersions(nodeJsVersions);
|
||||
const evaluatedVersion = this.evaluateVersions(versions);
|
||||
if (!evaluatedVersion) {
|
||||
throw new Error(
|
@ -2,8 +2,8 @@ import * as core from '@actions/core';
|
||||
|
||||
import * as semver from 'semver';
|
||||
|
||||
import BaseDistribution from '../../base-distribution';
|
||||
import {INodejs} from '../../base-models';
|
||||
import BaseDistribution from '../base-distribution';
|
||||
import {INodejs} from '../base-models';
|
||||
|
||||
export default class RcBuild extends BaseDistribution {
|
||||
constructor(nodeInfo: INodejs) {
|
@ -12,7 +12,7 @@ export default class CanaryBuild extends BaseDistribution {
|
||||
super(nodeInfo);
|
||||
}
|
||||
|
||||
protected findVersionInHoostedToolCacheDirectory(): string {
|
||||
protected findVersionInHostedToolCacheDirectory(): string {
|
||||
let toolPath = '';
|
||||
const localVersionPaths = tc
|
||||
.findAllVersions('node', this.nodeInfo.arch)
|
@ -7,7 +7,7 @@ import * as auth from './authutil';
|
||||
import * as path from 'path';
|
||||
import {restoreCache} from './cache-restore';
|
||||
import {isCacheFeatureAvailable} from './cache-utils';
|
||||
import {getNodejsDistribution} from './distibutions/installer-factory';
|
||||
import {getNodejsDistribution} from './distributions/installer-factory';
|
||||
import {parseNodeVersionFile, printEnvDetailsAndSetOutput} from './util';
|
||||
|
||||
export async function run() {
|
||||
@ -45,7 +45,7 @@ export async function run() {
|
||||
arch
|
||||
};
|
||||
const nodeDistribution = getNodejsDistribution(nodejsInfo);
|
||||
await nodeDistribution.getNodeJsInfo();
|
||||
await nodeDistribution.setupNodeJs();
|
||||
}
|
||||
|
||||
await printEnvDetailsAndSetOutput();
|
||||
|
Loading…
Reference in New Issue
Block a user