resolve comments

This commit is contained in:
Dmitry Shibanov 2022-12-27 19:28:20 +01:00
parent f12d842f13
commit 7f2fa59092
6 changed files with 153 additions and 384 deletions

View File

@ -61019,25 +61019,6 @@ exports.fromPromise = function (fn) {
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -61047,11 +61028,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.run = void 0;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const cache = __importStar(__nccwpck_require__(7799)); const cache = __importStar(__nccwpck_require__(7799));
const fs_1 = __importDefault(__nccwpck_require__(7147)); const fs_1 = __importDefault(__nccwpck_require__(7147));
@ -61108,25 +61095,6 @@ run();
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -61136,8 +61104,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.isCacheFeatureAvailable = exports.isGhes = exports.getCacheDirectoryPath = exports.getPackageManagerInfo = exports.getCommandOutput = exports.supportedPackageManagers = void 0;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514)); const exec = __importStar(__nccwpck_require__(1514));
const cache = __importStar(__nccwpck_require__(7799)); const cache = __importStar(__nccwpck_require__(7799));
@ -61159,7 +61133,7 @@ exports.supportedPackageManagers = {
getCacheFolderCommand: 'yarn config get cacheFolder' getCacheFolderCommand: 'yarn config get cacheFolder'
} }
}; };
const getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () { exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true }); let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
if (exitCode) { if (exitCode) {
stderr = !stderr.trim() stderr = !stderr.trim()
@ -61169,7 +61143,6 @@ const getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, func
} }
return stdout.trim(); return stdout.trim();
}); });
exports.getCommandOutput = getCommandOutput;
const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () { const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () {
const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`); const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`);
if (!stdOut) { if (!stdOut) {
@ -61177,7 +61150,7 @@ const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0,
} }
return stdOut; return stdOut;
}); });
const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () { exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
if (packageManager === 'npm') { if (packageManager === 'npm') {
return exports.supportedPackageManagers.npm; return exports.supportedPackageManagers.npm;
} }
@ -61198,8 +61171,7 @@ const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void
return null; return null;
} }
}); });
exports.getPackageManagerInfo = getPackageManagerInfo; exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
const getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand); const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
if (!stdOut) { if (!stdOut) {
throw new Error(`Could not get cache folder path for ${packageManager}`); throw new Error(`Could not get cache folder path for ${packageManager}`);
@ -61207,7 +61179,6 @@ const getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(
core.debug(`${packageManager} path is ${stdOut}`); core.debug(`${packageManager} path is ${stdOut}`);
return stdOut.trim(); return stdOut.trim();
}); });
exports.getCacheDirectoryPath = getCacheDirectoryPath;
function isGhes() { function isGhes() {
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
@ -61234,7 +61205,6 @@ exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Outputs = exports.State = exports.LockType = void 0;
var LockType; var LockType;
(function (LockType) { (function (LockType) {
LockType["Npm"] = "npm"; LockType["Npm"] = "npm";

345
dist/setup/index.js vendored
View File

@ -72915,27 +72915,14 @@ function wrappy (fn, cb) {
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
__setModuleDefault(result, mod); result["default"] = mod;
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.configAuthentication = void 0;
const fs = __importStar(__nccwpck_require__(7147)); const fs = __importStar(__nccwpck_require__(7147));
const os = __importStar(__nccwpck_require__(2037)); const os = __importStar(__nccwpck_require__(2037));
const path = __importStar(__nccwpck_require__(1017)); const path = __importStar(__nccwpck_require__(1017));
@ -72990,25 +72977,6 @@ function writeRegistryToFile(registryUrl, fileLocation, alwaysAuth) {
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -73018,11 +72986,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.restoreCache = void 0;
const cache = __importStar(__nccwpck_require__(7799)); const cache = __importStar(__nccwpck_require__(7799));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const glob = __importStar(__nccwpck_require__(8090)); const glob = __importStar(__nccwpck_require__(8090));
@ -73030,7 +73004,7 @@ const path_1 = __importDefault(__nccwpck_require__(1017));
const fs_1 = __importDefault(__nccwpck_require__(7147)); const fs_1 = __importDefault(__nccwpck_require__(7147));
const constants_1 = __nccwpck_require__(9042); const constants_1 = __nccwpck_require__(9042);
const cache_utils_1 = __nccwpck_require__(1678); const cache_utils_1 = __nccwpck_require__(1678);
const restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () { exports.restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager); const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager);
if (!packageManagerInfo) { if (!packageManagerInfo) {
throw new Error(`Caching for '${packageManager}' is not supported`); throw new Error(`Caching for '${packageManager}' is not supported`);
@ -73056,7 +73030,6 @@ const restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0,
core.saveState(constants_1.State.CacheMatchedKey, cacheKey); core.saveState(constants_1.State.CacheMatchedKey, cacheKey);
core.info(`Cache restored from key: ${cacheKey}`); core.info(`Cache restored from key: ${cacheKey}`);
}); });
exports.restoreCache = restoreCache;
const findLockFile = (packageManager) => { const findLockFile = (packageManager) => {
let lockFiles = packageManager.lockFilePatterns; let lockFiles = packageManager.lockFilePatterns;
const workspace = process.env.GITHUB_WORKSPACE; const workspace = process.env.GITHUB_WORKSPACE;
@ -73076,25 +73049,6 @@ const findLockFile = (packageManager) => {
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -73104,8 +73058,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.isCacheFeatureAvailable = exports.isGhes = exports.getCacheDirectoryPath = exports.getPackageManagerInfo = exports.getCommandOutput = exports.supportedPackageManagers = void 0;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514)); const exec = __importStar(__nccwpck_require__(1514));
const cache = __importStar(__nccwpck_require__(7799)); const cache = __importStar(__nccwpck_require__(7799));
@ -73127,7 +73087,7 @@ exports.supportedPackageManagers = {
getCacheFolderCommand: 'yarn config get cacheFolder' getCacheFolderCommand: 'yarn config get cacheFolder'
} }
}; };
const getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () { exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true }); let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
if (exitCode) { if (exitCode) {
stderr = !stderr.trim() stderr = !stderr.trim()
@ -73137,7 +73097,6 @@ const getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, func
} }
return stdout.trim(); return stdout.trim();
}); });
exports.getCommandOutput = getCommandOutput;
const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () { const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () {
const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`); const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`);
if (!stdOut) { if (!stdOut) {
@ -73145,7 +73104,7 @@ const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0,
} }
return stdOut; return stdOut;
}); });
const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () { exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
if (packageManager === 'npm') { if (packageManager === 'npm') {
return exports.supportedPackageManagers.npm; return exports.supportedPackageManagers.npm;
} }
@ -73166,8 +73125,7 @@ const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void
return null; return null;
} }
}); });
exports.getPackageManagerInfo = getPackageManagerInfo; exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
const getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand); const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
if (!stdOut) { if (!stdOut) {
throw new Error(`Could not get cache folder path for ${packageManager}`); throw new Error(`Could not get cache folder path for ${packageManager}`);
@ -73175,7 +73133,6 @@ const getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(
core.debug(`${packageManager} path is ${stdOut}`); core.debug(`${packageManager} path is ${stdOut}`);
return stdOut.trim(); return stdOut.trim();
}); });
exports.getCacheDirectoryPath = getCacheDirectoryPath;
function isGhes() { function isGhes() {
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
@ -73202,7 +73159,6 @@ exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Outputs = exports.State = exports.LockType = void 0;
var LockType; var LockType;
(function (LockType) { (function (LockType) {
LockType["Npm"] = "npm"; LockType["Npm"] = "npm";
@ -73227,25 +73183,6 @@ var Outputs;
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -73255,6 +73192,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
@ -73299,7 +73243,7 @@ class BaseDistribution {
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}.`);
} }
const toolName = this.getNodejsDistInfo(evaluatedVersion, this.osPlat); const toolName = this.getNodejsDistInfo(evaluatedVersion);
toolPath = yield this.downloadNodejs(toolName); toolPath = yield this.downloadNodejs(toolName);
} }
if (this.osPlat != 'win32') { if (this.osPlat != 'win32') {
@ -73308,6 +73252,24 @@ class BaseDistribution {
core.addPath(toolPath); core.addPath(toolPath);
}); });
} }
evaluateVersions(versions) {
let version = '';
core.debug(`evaluating ${versions.length} versions`);
for (let potential of versions) {
const satisfied = semver_1.default.satisfies(potential, this.nodeInfo.versionSpec);
if (satisfied) {
version = potential;
break;
}
}
if (version) {
core.debug(`matched: ${version}`);
}
else {
core.debug('match not found');
}
return version;
}
findVersionInHostedToolCacheDirectory() { findVersionInHostedToolCacheDirectory() {
return tc.find('node', this.nodeInfo.versionSpec, this.nodeInfo.arch); return tc.find('node', this.nodeInfo.versionSpec, this.nodeInfo.arch);
} }
@ -73319,13 +73281,13 @@ class BaseDistribution {
return response.result || []; return response.result || [];
}); });
} }
getNodejsDistInfo(version, osPlat) { getNodejsDistInfo(version) {
let osArch = this.translateArchToDistUrl(this.nodeInfo.arch); let osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
version = semver_1.default.clean(version) || ''; version = semver_1.default.clean(version) || '';
let fileName = osPlat == 'win32' let fileName = this.osPlat == 'win32'
? `node-v${version}-win-${osArch}` ? `node-v${version}-win-${osArch}`
: `node-v${version}-${osPlat}-${osArch}`; : `node-v${version}-${this.osPlat}-${osArch}`;
let urlFileName = osPlat == 'win32' ? `${fileName}.7z` : `${fileName}.tar.gz`; let urlFileName = this.osPlat == 'win32' ? `${fileName}.7z` : `${fileName}.tar.gz`;
const initialUrl = this.getDistributionUrl(); const initialUrl = this.getDistributionUrl();
const url = `${initialUrl}/v${version}/${urlFileName}`; const url = `${initialUrl}/v${version}/${urlFileName}`;
return { return {
@ -73423,8 +73385,8 @@ class BaseDistribution {
return toolPath; return toolPath;
}); });
} }
getDistFileName(arch) { getDistFileName() {
let osArch = this.translateArchToDistUrl(arch); let osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
// node offers a json list of versions // node offers a json list of versions
let dataFileName; let dataFileName;
switch (this.osPlat) { switch (this.osPlat) {
@ -73444,7 +73406,7 @@ class BaseDistribution {
} }
filterVersions(nodeJsVersions) { filterVersions(nodeJsVersions) {
const versions = []; const versions = [];
const dataFileName = this.getDistFileName(this.nodeInfo.arch); const dataFileName = this.getDistFileName();
nodeJsVersions.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) {
@ -73476,7 +73438,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getNodejsDistribution = void 0;
const nightly_builds_1 = __importDefault(__nccwpck_require__(7127)); const nightly_builds_1 = __importDefault(__nccwpck_require__(7127));
const official_builds_1 = __importDefault(__nccwpck_require__(7854)); const official_builds_1 = __importDefault(__nccwpck_require__(7854));
const rc_builds_1 = __importDefault(__nccwpck_require__(8837)); const rc_builds_1 = __importDefault(__nccwpck_require__(8837));
@ -73488,32 +73449,23 @@ var Distributions;
Distributions["NIGHTLY"] = "nightly"; Distributions["NIGHTLY"] = "nightly";
Distributions["RC"] = "rc"; Distributions["RC"] = "rc";
})(Distributions || (Distributions = {})); })(Distributions || (Distributions = {}));
function identifyDistribution(versionSpec) { function getNodejsDistribution(installerOptions) {
let distribution = Distributions.DEFAULT; const versionSpec = installerOptions.versionSpec;
let distribution;
if (versionSpec.includes(Distributions.NIGHTLY)) { if (versionSpec.includes(Distributions.NIGHTLY)) {
distribution = Distributions.NIGHTLY; distribution = new nightly_builds_1.default(installerOptions);
} }
else if (versionSpec.includes(Distributions.CANARY)) { else if (versionSpec.includes(Distributions.CANARY)) {
distribution = Distributions.CANARY; distribution = new canary_builds_1.default(installerOptions);
} }
else if (versionSpec.includes(Distributions.RC)) { else if (versionSpec.includes(Distributions.RC)) {
distribution = Distributions.RC; distribution = new rc_builds_1.default(installerOptions);
}
else {
distribution = new official_builds_1.default(installerOptions);
} }
return distribution; return distribution;
} }
function getNodejsDistribution(installerOptions) {
const distributionName = identifyDistribution(installerOptions.versionSpec);
switch (distributionName) {
case Distributions.NIGHTLY:
return new nightly_builds_1.default(installerOptions);
case Distributions.CANARY:
return new canary_builds_1.default(installerOptions);
case Distributions.RC:
return new rc_builds_1.default(installerOptions);
default:
return new official_builds_1.default(installerOptions);
}
}
exports.getNodejsDistribution = getNodejsDistribution; exports.getNodejsDistribution = getNodejsDistribution;
@ -73524,23 +73476,11 @@ exports.getNodejsDistribution = getNodejsDistribution;
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
__setModuleDefault(result, mod); result["default"] = mod;
return result; return result;
}; };
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
@ -73626,25 +73566,6 @@ exports["default"] = NightlyNodejs;
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -73654,14 +73575,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": 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 tc = __importStar(__nccwpck_require__(7784)); 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 path_1 = __importDefault(__nccwpck_require__(1017));
const base_distribution_1 = __importDefault(__nccwpck_require__(7)); const base_distribution_1 = __importDefault(__nccwpck_require__(7));
class OfficialBuilds extends base_distribution_1.default { class OfficialBuilds extends base_distribution_1.default {
@ -73735,7 +73661,7 @@ class OfficialBuilds extends base_distribution_1.default {
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}.`);
} }
const toolName = this.getNodejsDistInfo(evaluatedVersion, this.osPlat); const toolName = this.getNodejsDistInfo(evaluatedVersion);
toolPath = yield this.downloadNodejs(toolName); toolPath = yield this.downloadNodejs(toolName);
} }
} }
@ -73751,20 +73677,7 @@ class OfficialBuilds extends base_distribution_1.default {
core.info(`getting latest node version...`); core.info(`getting latest node version...`);
return versions[0]; return versions[0];
} }
core.debug(`evaluating ${versions.length} versions`); version = super.evaluateVersions(versions);
for (let potential of versions) {
const satisfied = semver.satisfies(potential, this.nodeInfo.versionSpec);
if (satisfied) {
version = potential;
break;
}
}
if (version) {
core.debug(`matched: ${version}`);
}
else {
core.debug('match not found');
}
return version; return version;
} }
getDistributionUrl() { getDistributionUrl() {
@ -73811,7 +73724,7 @@ class OfficialBuilds extends base_distribution_1.default {
} }
}); });
} }
getInfoFromManifest(versionSpec, osArch = this.translateArchToDistUrl(os_1.default.arch()), manifest) { getInfoFromManifest(versionSpec, osArch, manifest) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const stable = true; const stable = true;
let info = null; let info = null;
@ -73847,55 +73760,15 @@ exports["default"] = OfficialBuilds;
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); 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__(7)); 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);
} }
evaluateVersions(versions) {
let version = '';
core.debug(`evaluating ${versions.length} versions`);
for (let i = 0; i < versions.length; i++) {
const potential = versions[i];
const satisfied = semver.satisfies(potential, this.nodeInfo.versionSpec);
if (satisfied) {
version = potential;
break;
}
}
if (version) {
core.debug(`matched: ${version}`);
}
else {
core.debug('match not found');
}
return version;
}
getDistributionUrl() { getDistributionUrl() {
return 'https://nodejs.org/download/rc'; return 'https://nodejs.org/download/rc';
} }
@ -73910,23 +73783,11 @@ exports["default"] = RcBuild;
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
__setModuleDefault(result, mod); result["default"] = mod;
return result; return result;
}; };
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
@ -74012,25 +73873,6 @@ exports["default"] = CanaryBuild;
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -74040,11 +73882,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.run = void 0;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const fs_1 = __importDefault(__nccwpck_require__(7147)); const fs_1 = __importDefault(__nccwpck_require__(7147));
const os_1 = __importDefault(__nccwpck_require__(2037)); const os_1 = __importDefault(__nccwpck_require__(2037));
@ -74134,25 +73982,6 @@ function resolveVersionInput() {
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -74162,8 +73991,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.printEnvDetailsAndSetOutput = exports.parseNodeVersionFile = void 0;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514)); const exec = __importStar(__nccwpck_require__(1514));
function parseNodeVersionFile(contents) { function parseNodeVersionFile(contents) {

View File

@ -24,7 +24,6 @@ export default abstract class BaseDistribution {
} }
protected abstract getDistributionUrl(): string; protected abstract getDistributionUrl(): string;
protected abstract evaluateVersions(nodeVersions: string[]): string;
public async setupNodeJs() { public async setupNodeJs() {
let nodeJsVersions: INodeVersion[] | undefined; let nodeJsVersions: INodeVersion[] | undefined;
@ -50,7 +49,7 @@ export default abstract class BaseDistribution {
`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.` `Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`
); );
} }
const toolName = this.getNodejsDistInfo(evaluatedVersion, this.osPlat); const toolName = this.getNodejsDistInfo(evaluatedVersion);
toolPath = await this.downloadNodejs(toolName); toolPath = await this.downloadNodejs(toolName);
} }
@ -61,6 +60,31 @@ export default abstract class BaseDistribution {
core.addPath(toolPath); core.addPath(toolPath);
} }
protected evaluateVersions(versions: string[]) {
let version = '';
core.debug(`evaluating ${versions.length} versions`);
for (let potential of versions) {
const satisfied: boolean = semver.satisfies(
potential,
this.nodeInfo.versionSpec
);
if (satisfied) {
version = potential;
break;
}
}
if (version) {
core.debug(`matched: ${version}`);
} else {
core.debug('match not found');
}
return version;
}
protected findVersionInHostedToolCacheDirectory() { protected findVersionInHostedToolCacheDirectory() {
return tc.find('node', this.nodeInfo.versionSpec, this.nodeInfo.arch); return tc.find('node', this.nodeInfo.versionSpec, this.nodeInfo.arch);
} }
@ -73,15 +97,15 @@ export default abstract class BaseDistribution {
return response.result || []; return response.result || [];
} }
protected getNodejsDistInfo(version: string, osPlat: string) { protected getNodejsDistInfo(version: string) {
let osArch: string = this.translateArchToDistUrl(this.nodeInfo.arch); let osArch: string = this.translateArchToDistUrl(this.nodeInfo.arch);
version = semver.clean(version) || ''; version = semver.clean(version) || '';
let fileName: string = let fileName: string =
osPlat == 'win32' this.osPlat == 'win32'
? `node-v${version}-win-${osArch}` ? `node-v${version}-win-${osArch}`
: `node-v${version}-${osPlat}-${osArch}`; : `node-v${version}-${this.osPlat}-${osArch}`;
let urlFileName: string = let urlFileName: string =
osPlat == 'win32' ? `${fileName}.7z` : `${fileName}.tar.gz`; this.osPlat == 'win32' ? `${fileName}.7z` : `${fileName}.tar.gz`;
const initialUrl = this.getDistributionUrl(); const initialUrl = this.getDistributionUrl();
const url = `${initialUrl}/v${version}/${urlFileName}`; const url = `${initialUrl}/v${version}/${urlFileName}`;
@ -205,8 +229,8 @@ export default abstract class BaseDistribution {
return toolPath; return toolPath;
} }
protected getDistFileName(arch: string): string { protected getDistFileName(): string {
let osArch: string = this.translateArchToDistUrl(arch); let osArch: string = this.translateArchToDistUrl(this.nodeInfo.arch);
// node offers a json list of versions // node offers a json list of versions
let dataFileName: string; let dataFileName: string;
@ -230,7 +254,7 @@ export default abstract class BaseDistribution {
protected filterVersions(nodeJsVersions: INodeVersion[]) { protected filterVersions(nodeJsVersions: INodeVersion[]) {
const versions: string[] = []; const versions: string[] = [];
const dataFileName = this.getDistFileName(this.nodeInfo.arch); const dataFileName = this.getDistFileName();
nodeJsVersions.forEach((nodeVersion: INodeVersion) => { nodeJsVersions.forEach((nodeVersion: INodeVersion) => {
// ensure this version supports your os and platform // ensure this version supports your os and platform

View File

@ -12,31 +12,20 @@ enum Distributions {
RC = 'rc' RC = 'rc'
} }
function identifyDistribution(versionSpec: string) { export function getNodejsDistribution(
let distribution = Distributions.DEFAULT; installerOptions: INodejs
): BaseDistribution {
const versionSpec = installerOptions.versionSpec;
let distribution: BaseDistribution;
if (versionSpec.includes(Distributions.NIGHTLY)) { if (versionSpec.includes(Distributions.NIGHTLY)) {
distribution = Distributions.NIGHTLY; distribution = new NightlyNodejs(installerOptions);
} else if (versionSpec.includes(Distributions.CANARY)) { } else if (versionSpec.includes(Distributions.CANARY)) {
distribution = Distributions.CANARY; distribution = new CanaryBuild(installerOptions);
} else if (versionSpec.includes(Distributions.RC)) { } else if (versionSpec.includes(Distributions.RC)) {
distribution = Distributions.RC; distribution = new RcBuild(installerOptions);
} else {
distribution = new OfficialBuilds(installerOptions);
} }
return distribution; return distribution;
} }
export function getNodejsDistribution(
installerOptions: INodejs
): BaseDistribution {
const distributionName = identifyDistribution(installerOptions.versionSpec);
switch (distributionName) {
case Distributions.NIGHTLY:
return new NightlyNodejs(installerOptions);
case Distributions.CANARY:
return new CanaryBuild(installerOptions);
case Distributions.RC:
return new RcBuild(installerOptions);
default:
return new OfficialBuilds(installerOptions);
}
}

View File

@ -1,7 +1,5 @@
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as tc from '@actions/tool-cache'; import * as tc from '@actions/tool-cache';
import * as semver from 'semver';
import os from 'os';
import path from 'path'; import path from 'path';
import BaseDistribution from '../base-distribution'; import BaseDistribution from '../base-distribution';
@ -115,7 +113,7 @@ export default class OfficialBuilds extends BaseDistribution {
`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.` `Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`
); );
} }
const toolName = this.getNodejsDistInfo(evaluatedVersion, this.osPlat); const toolName = this.getNodejsDistInfo(evaluatedVersion);
toolPath = await this.downloadNodejs(toolName); toolPath = await this.downloadNodejs(toolName);
} }
} }
@ -135,24 +133,7 @@ export default class OfficialBuilds extends BaseDistribution {
return versions[0]; return versions[0];
} }
core.debug(`evaluating ${versions.length} versions`); version = super.evaluateVersions(versions);
for (let potential of versions) {
const satisfied: boolean = semver.satisfies(
potential,
this.nodeInfo.versionSpec
);
if (satisfied) {
version = potential;
break;
}
}
if (version) {
core.debug(`matched: ${version}`);
} else {
core.debug('match not found');
}
return version; return version;
} }
@ -235,7 +216,7 @@ export default class OfficialBuilds extends BaseDistribution {
private async getInfoFromManifest( private async getInfoFromManifest(
versionSpec: string, versionSpec: string,
osArch: string = this.translateArchToDistUrl(os.arch()), osArch: string,
manifest: tc.IToolRelease[] | undefined manifest: tc.IToolRelease[] | undefined
): Promise<INodeVersionInfo | null> { ): Promise<INodeVersionInfo | null> {
const stable = true; const stable = true;

View File

@ -1,7 +1,3 @@
import * as core from '@actions/core';
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';
@ -10,32 +6,6 @@ export default class RcBuild extends BaseDistribution {
super(nodeInfo); super(nodeInfo);
} }
protected evaluateVersions(versions: string[]): string {
let version = '';
core.debug(`evaluating ${versions.length} versions`);
for (let i = 0; i < versions.length; i++) {
const potential: string = versions[i];
const satisfied: boolean = semver.satisfies(
potential,
this.nodeInfo.versionSpec
);
if (satisfied) {
version = potential;
break;
}
}
if (version) {
core.debug(`matched: ${version}`);
} else {
core.debug('match not found');
}
return version;
}
getDistributionUrl(): string { getDistributionUrl(): string {
return 'https://nodejs.org/download/rc'; return 'https://nodejs.org/download/rc';
} }