mirror of
https://github.com/actions/setup-node.git
synced 2025-04-22 09:21:00 +00:00
polish code
This commit is contained in:
parent
f3c48890ed
commit
cd6d6a6700
8 changed files with 283 additions and 125 deletions
64
dist/cache-save/index.js
vendored
64
dist/cache-save/index.js
vendored
|
@ -61019,6 +61019,25 @@ exports.fromPromise = function (fn) {
|
|||
|
||||
"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) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
|
@ -61028,17 +61047,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
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) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.run = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const cache = __importStar(__nccwpck_require__(7799));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
|
@ -61095,6 +61108,25 @@ run();
|
|||
|
||||
"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) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
|
@ -61104,14 +61136,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
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 }));
|
||||
exports.isCacheFeatureAvailable = exports.isGhes = exports.getCacheDirectoryPath = exports.getPackageManagerInfo = exports.getCommandOutput = exports.supportedPackageManagers = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const exec = __importStar(__nccwpck_require__(1514));
|
||||
const cache = __importStar(__nccwpck_require__(7799));
|
||||
|
@ -61133,7 +61159,7 @@ exports.supportedPackageManagers = {
|
|||
getCacheFolderCommand: 'yarn config get cacheFolder'
|
||||
}
|
||||
};
|
||||
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
|
||||
if (exitCode) {
|
||||
stderr = !stderr.trim()
|
||||
|
@ -61143,6 +61169,7 @@ exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, fu
|
|||
}
|
||||
return stdout.trim();
|
||||
});
|
||||
exports.getCommandOutput = getCommandOutput;
|
||||
const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`);
|
||||
if (!stdOut) {
|
||||
|
@ -61150,7 +61177,7 @@ const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0,
|
|||
}
|
||||
return stdOut;
|
||||
});
|
||||
exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
if (packageManager === 'npm') {
|
||||
return exports.supportedPackageManagers.npm;
|
||||
}
|
||||
|
@ -61171,7 +61198,8 @@ exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, vo
|
|||
return null;
|
||||
}
|
||||
});
|
||||
exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
exports.getPackageManagerInfo = getPackageManagerInfo;
|
||||
const getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
|
||||
if (!stdOut) {
|
||||
throw new Error(`Could not get cache folder path for ${packageManager}`);
|
||||
|
@ -61179,6 +61207,7 @@ exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaite
|
|||
core.debug(`${packageManager} path is ${stdOut}`);
|
||||
return stdOut.trim();
|
||||
});
|
||||
exports.getCacheDirectoryPath = getCacheDirectoryPath;
|
||||
function isGhes() {
|
||||
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
|
||||
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
|
||||
|
@ -61205,6 +61234,7 @@ exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.Outputs = exports.State = exports.LockType = void 0;
|
||||
var LockType;
|
||||
(function (LockType) {
|
||||
LockType["Npm"] = "npm";
|
||||
|
|
277
dist/setup/index.js
vendored
277
dist/setup/index.js
vendored
|
@ -72915,14 +72915,27 @@ function wrappy (fn, cb) {
|
|||
|
||||
"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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
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;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.configAuthentication = void 0;
|
||||
const fs = __importStar(__nccwpck_require__(7147));
|
||||
const os = __importStar(__nccwpck_require__(2037));
|
||||
const path = __importStar(__nccwpck_require__(1017));
|
||||
|
@ -72977,6 +72990,25 @@ function writeRegistryToFile(registryUrl, fileLocation, alwaysAuth) {
|
|||
|
||||
"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) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
|
@ -72986,17 +73018,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
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) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.restoreCache = void 0;
|
||||
const cache = __importStar(__nccwpck_require__(7799));
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const glob = __importStar(__nccwpck_require__(8090));
|
||||
|
@ -73004,7 +73030,7 @@ const path_1 = __importDefault(__nccwpck_require__(1017));
|
|||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
const constants_1 = __nccwpck_require__(9042);
|
||||
const cache_utils_1 = __nccwpck_require__(1678);
|
||||
exports.restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager);
|
||||
if (!packageManagerInfo) {
|
||||
throw new Error(`Caching for '${packageManager}' is not supported`);
|
||||
|
@ -73030,6 +73056,7 @@ exports.restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0
|
|||
core.saveState(constants_1.State.CacheMatchedKey, cacheKey);
|
||||
core.info(`Cache restored from key: ${cacheKey}`);
|
||||
});
|
||||
exports.restoreCache = restoreCache;
|
||||
const findLockFile = (packageManager) => {
|
||||
let lockFiles = packageManager.lockFilePatterns;
|
||||
const workspace = process.env.GITHUB_WORKSPACE;
|
||||
|
@ -73049,6 +73076,25 @@ const findLockFile = (packageManager) => {
|
|||
|
||||
"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) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
|
@ -73058,14 +73104,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
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 }));
|
||||
exports.isCacheFeatureAvailable = exports.isGhes = exports.getCacheDirectoryPath = exports.getPackageManagerInfo = exports.getCommandOutput = exports.supportedPackageManagers = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const exec = __importStar(__nccwpck_require__(1514));
|
||||
const cache = __importStar(__nccwpck_require__(7799));
|
||||
|
@ -73087,7 +73127,7 @@ exports.supportedPackageManagers = {
|
|||
getCacheFolderCommand: 'yarn config get cacheFolder'
|
||||
}
|
||||
};
|
||||
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
|
||||
if (exitCode) {
|
||||
stderr = !stderr.trim()
|
||||
|
@ -73097,6 +73137,7 @@ exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, fu
|
|||
}
|
||||
return stdout.trim();
|
||||
});
|
||||
exports.getCommandOutput = getCommandOutput;
|
||||
const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`);
|
||||
if (!stdOut) {
|
||||
|
@ -73104,7 +73145,7 @@ const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0,
|
|||
}
|
||||
return stdOut;
|
||||
});
|
||||
exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
if (packageManager === 'npm') {
|
||||
return exports.supportedPackageManagers.npm;
|
||||
}
|
||||
|
@ -73125,7 +73166,8 @@ exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, vo
|
|||
return null;
|
||||
}
|
||||
});
|
||||
exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
exports.getPackageManagerInfo = getPackageManagerInfo;
|
||||
const getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
|
||||
if (!stdOut) {
|
||||
throw new Error(`Could not get cache folder path for ${packageManager}`);
|
||||
|
@ -73133,6 +73175,7 @@ exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaite
|
|||
core.debug(`${packageManager} path is ${stdOut}`);
|
||||
return stdOut.trim();
|
||||
});
|
||||
exports.getCacheDirectoryPath = getCacheDirectoryPath;
|
||||
function isGhes() {
|
||||
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
|
||||
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
|
||||
|
@ -73159,6 +73202,7 @@ exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.Outputs = exports.State = exports.LockType = void 0;
|
||||
var LockType;
|
||||
(function (LockType) {
|
||||
LockType["Npm"] = "npm";
|
||||
|
@ -73183,6 +73227,25 @@ var Outputs;
|
|||
|
||||
"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) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
|
@ -73192,13 +73255,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
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) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
@ -73223,8 +73279,9 @@ class BaseDistribution {
|
|||
}
|
||||
getNodeJsInfo() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let nodeVersions;
|
||||
if (this.nodeInfo.checkLatest) {
|
||||
const nodeVersions = yield this.getNodejsVersions();
|
||||
nodeVersions = yield this.getNodejsVersions();
|
||||
const versions = this.filterVersions(nodeVersions);
|
||||
const evaluatedVersion = this.evaluateVersions(versions);
|
||||
if (evaluatedVersion) {
|
||||
|
@ -73236,7 +73293,7 @@ class BaseDistribution {
|
|||
core.info(`Found in cache @ ${toolPath}`);
|
||||
}
|
||||
else {
|
||||
const nodeVersions = yield this.getNodejsVersions();
|
||||
nodeVersions !== null && nodeVersions !== void 0 ? nodeVersions : (nodeVersions = yield this.getNodejsVersions());
|
||||
const versions = this.filterVersions(nodeVersions);
|
||||
const evaluatedVersion = this.evaluateVersions(versions);
|
||||
if (!evaluatedVersion) {
|
||||
|
@ -73419,6 +73476,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
return (mod && mod.__esModule) ? mod : { "default": 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));
|
||||
|
@ -73466,11 +73524,23 @@ exports.getNodejsDistribution = getNodejsDistribution;
|
|||
|
||||
"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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
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) {
|
||||
|
@ -73484,6 +73554,7 @@ const base_distribution_1 = __importDefault(__nccwpck_require__(8653));
|
|||
class NightlyNodejs extends base_distribution_1.default {
|
||||
constructor(nodeInfo) {
|
||||
super(nodeInfo);
|
||||
this.distribution = 'nightly';
|
||||
}
|
||||
findVersionInHoostedToolCacheDirectory() {
|
||||
let toolPath = '';
|
||||
|
@ -73494,7 +73565,7 @@ class NightlyNodejs extends base_distribution_1.default {
|
|||
if (!prerelease) {
|
||||
return false;
|
||||
}
|
||||
return prerelease[0].includes('nightly');
|
||||
return prerelease[0].includes(this.distribution);
|
||||
});
|
||||
localVersionPaths.sort(semver_1.default.rcompare);
|
||||
const localVersion = this.evaluateVersions(localVersionPaths);
|
||||
|
@ -73506,10 +73577,10 @@ class NightlyNodejs extends base_distribution_1.default {
|
|||
evaluateVersions(versions) {
|
||||
let version = '';
|
||||
core.debug(`evaluating ${versions.length} versions`);
|
||||
const { includePrerelease, range } = this.createRangePreRelease(this.nodeInfo.versionSpec, 'nightly');
|
||||
const { includePrerelease, range } = this.createRangePreRelease(this.nodeInfo.versionSpec);
|
||||
for (let i = 0; i < versions.length; i++) {
|
||||
const potential = versions[i];
|
||||
const satisfied = semver_1.default.satisfies(potential.replace('nightly', 'nightly.'), range, {
|
||||
const satisfied = semver_1.default.satisfies(potential.replace(this.distribution, `${this.distribution}.`), range, {
|
||||
includePrerelease: includePrerelease
|
||||
});
|
||||
if (satisfied) {
|
||||
|
@ -73528,16 +73599,16 @@ class NightlyNodejs extends base_distribution_1.default {
|
|||
getDistributionUrl() {
|
||||
return 'https://nodejs.org/download/nightly';
|
||||
}
|
||||
createRangePreRelease(versionSpec, distribution = '') {
|
||||
createRangePreRelease(versionSpec) {
|
||||
let range;
|
||||
const [raw, prerelease] = this.splitVersionSpec(versionSpec);
|
||||
const isValidVersion = semver_1.default.valid(raw);
|
||||
const rawVersion = (isValidVersion ? raw : semver_1.default.coerce(raw));
|
||||
if (prerelease !== distribution) {
|
||||
range = `${rawVersion}-${prerelease.replace(distribution, `${distribution}.`)}`;
|
||||
if (prerelease !== this.distribution) {
|
||||
range = `${rawVersion}-${prerelease.replace(this.distribution, `${this.distribution}.`)}`;
|
||||
}
|
||||
else {
|
||||
range = `${semver_1.default.validRange(`^${rawVersion}-${distribution}`)}-0`;
|
||||
range = `${semver_1.default.validRange(`^${rawVersion}-${this.distribution}`)}-0`;
|
||||
}
|
||||
return { range, includePrerelease: !isValidVersion };
|
||||
}
|
||||
|
@ -73555,6 +73626,25 @@ exports["default"] = NightlyNodejs;
|
|||
|
||||
"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) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
|
@ -73564,13 +73654,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
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) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
@ -73589,6 +73672,7 @@ class OfficialBuilds extends base_distribution_1.default {
|
|||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let manifest;
|
||||
let nodeVersions;
|
||||
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
|
||||
if (this.isLtsAlias(this.nodeInfo.versionSpec)) {
|
||||
core.info('Attempt to resolve LTS alias from manifest...');
|
||||
// No try-catch since it's not possible to resolve LTS alias without manifest
|
||||
|
@ -73603,7 +73687,6 @@ class OfficialBuilds extends base_distribution_1.default {
|
|||
}
|
||||
if (this.nodeInfo.checkLatest) {
|
||||
core.info('Attempt to resolve the latest version from manifest...');
|
||||
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
|
||||
const resolvedVersion = yield this.resolveVersionFromManifest(this.nodeInfo.versionSpec, osArch, manifest);
|
||||
if (resolvedVersion) {
|
||||
this.nodeInfo.versionSpec = resolvedVersion;
|
||||
|
@ -73621,7 +73704,6 @@ class OfficialBuilds extends base_distribution_1.default {
|
|||
let downloadPath = '';
|
||||
try {
|
||||
core.info(`Attempting to download ${this.nodeInfo.versionSpec}...`);
|
||||
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
|
||||
const versionInfo = yield this.getInfoFromManifest(this.nodeInfo.versionSpec, osArch, manifest);
|
||||
if (versionInfo) {
|
||||
core.info(`Acquiring ${versionInfo.resolvedVersion} - ${versionInfo.arch} from ${versionInfo.downloadUrl}`);
|
||||
|
@ -73765,11 +73847,23 @@ exports["default"] = OfficialBuilds;
|
|||
|
||||
"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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
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) {
|
||||
|
@ -73816,11 +73910,23 @@ exports["default"] = RcBuild;
|
|||
|
||||
"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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
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) {
|
||||
|
@ -73834,6 +73940,7 @@ const base_distribution_1 = __importDefault(__nccwpck_require__(8653));
|
|||
class CanaryBuild extends base_distribution_1.default {
|
||||
constructor(nodeInfo) {
|
||||
super(nodeInfo);
|
||||
this.distribution = 'v8-canary';
|
||||
}
|
||||
findVersionInHoostedToolCacheDirectory() {
|
||||
let toolPath = '';
|
||||
|
@ -73844,7 +73951,7 @@ class CanaryBuild extends base_distribution_1.default {
|
|||
if (!prerelease) {
|
||||
return false;
|
||||
}
|
||||
return prerelease[0].includes('v8-canary');
|
||||
return prerelease[0].includes(this.distribution);
|
||||
});
|
||||
localVersionPaths.sort(semver_1.default.rcompare);
|
||||
const localVersion = this.evaluateVersions(localVersionPaths);
|
||||
|
@ -73859,10 +73966,10 @@ class CanaryBuild extends base_distribution_1.default {
|
|||
evaluateVersions(versions) {
|
||||
let version = '';
|
||||
core.debug(`evaluating ${versions.length} versions`);
|
||||
const { includePrerelease, range } = this.createRangePreRelease(this.nodeInfo.versionSpec, 'v8-canary');
|
||||
const { includePrerelease, range } = this.createRangePreRelease(this.nodeInfo.versionSpec);
|
||||
for (let i = 0; i < versions.length; i++) {
|
||||
const potential = versions[i];
|
||||
const satisfied = semver_1.default.satisfies(potential.replace('v8-canary', 'v8-canary.'), range, {
|
||||
const satisfied = semver_1.default.satisfies(potential.replace(this.distribution, `${this.distribution}.`), range, {
|
||||
includePrerelease: includePrerelease
|
||||
});
|
||||
if (satisfied) {
|
||||
|
@ -73878,16 +73985,16 @@ class CanaryBuild extends base_distribution_1.default {
|
|||
}
|
||||
return version;
|
||||
}
|
||||
createRangePreRelease(versionSpec, distribution = '') {
|
||||
createRangePreRelease(versionSpec) {
|
||||
let range;
|
||||
const [raw, prerelease] = this.splitVersionSpec(versionSpec);
|
||||
const isValidVersion = semver_1.default.valid(raw);
|
||||
const rawVersion = (isValidVersion ? raw : semver_1.default.coerce(raw));
|
||||
if (prerelease !== distribution) {
|
||||
range = `${rawVersion}-${prerelease.replace(distribution, `${distribution}.`)}`;
|
||||
if (prerelease !== this.distribution) {
|
||||
range = `${rawVersion}-${prerelease.replace(this.distribution, `${this.distribution}.`)}`;
|
||||
}
|
||||
else {
|
||||
range = `${semver_1.default.validRange(`^${rawVersion}-${distribution}`)}-0`;
|
||||
range = `${semver_1.default.validRange(`^${rawVersion}-${this.distribution}`)}-0`;
|
||||
}
|
||||
return { range, includePrerelease: !isValidVersion };
|
||||
}
|
||||
|
@ -73905,6 +74012,25 @@ exports["default"] = CanaryBuild;
|
|||
|
||||
"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) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
|
@ -73914,17 +74040,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
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) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.run = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
const os_1 = __importDefault(__nccwpck_require__(2037));
|
||||
|
@ -74014,6 +74134,25 @@ function resolveVersionInput() {
|
|||
|
||||
"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) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
|
@ -74023,14 +74162,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
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 }));
|
||||
exports.printEnvDetailsAndSetOutput = exports.parseNodeVersionFile = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const exec = __importStar(__nccwpck_require__(1514));
|
||||
function parseNodeVersionFile(contents) {
|
||||
|
|
14
package-lock.json
generated
14
package-lock.json
generated
|
@ -28,7 +28,7 @@
|
|||
"jest-circus": "^27.2.5",
|
||||
"prettier": "^1.19.1",
|
||||
"ts-jest": "^27.0.5",
|
||||
"typescript": "^3.8.3"
|
||||
"typescript": "^4.2.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/cache": {
|
||||
|
@ -4813,9 +4813,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "3.8.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz",
|
||||
"integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==",
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz",
|
||||
"integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
|
@ -8861,9 +8861,9 @@
|
|||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.8.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz",
|
||||
"integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==",
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz",
|
||||
"integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==",
|
||||
"dev": true
|
||||
},
|
||||
"universal-user-agent": {
|
||||
|
|
|
@ -42,6 +42,6 @@
|
|||
"jest-circus": "^27.2.5",
|
||||
"prettier": "^1.19.1",
|
||||
"ts-jest": "^27.0.5",
|
||||
"typescript": "^3.8.3"
|
||||
"typescript": "^4.2.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,8 +27,9 @@ export default abstract class BaseDistribution {
|
|||
protected abstract evaluateVersions(nodeVersions: string[]): string;
|
||||
|
||||
public async getNodeJsInfo() {
|
||||
let nodeVersions: INodeVersion[] | undefined;
|
||||
if (this.nodeInfo.checkLatest) {
|
||||
const nodeVersions = await this.getNodejsVersions();
|
||||
nodeVersions = await this.getNodejsVersions();
|
||||
const versions = this.filterVersions(nodeVersions);
|
||||
const evaluatedVersion = this.evaluateVersions(versions);
|
||||
|
||||
|
@ -41,7 +42,7 @@ export default abstract class BaseDistribution {
|
|||
if (toolPath) {
|
||||
core.info(`Found in cache @ ${toolPath}`);
|
||||
} else {
|
||||
const nodeVersions = await this.getNodejsVersions();
|
||||
nodeVersions ??= await this.getNodejsVersions();
|
||||
const versions = this.filterVersions(nodeVersions);
|
||||
const evaluatedVersion = this.evaluateVersions(versions);
|
||||
if (!evaluatedVersion) {
|
||||
|
|
|
@ -7,6 +7,7 @@ import BaseDistribution from '../base-distribution';
|
|||
import {INodejs} from '../base-models';
|
||||
|
||||
export default class NightlyNodejs extends BaseDistribution {
|
||||
protected distribution = 'nightly';
|
||||
constructor(nodeInfo: INodejs) {
|
||||
super(nodeInfo);
|
||||
}
|
||||
|
@ -21,7 +22,7 @@ export default class NightlyNodejs extends BaseDistribution {
|
|||
return false;
|
||||
}
|
||||
|
||||
return prerelease[0].includes('nightly');
|
||||
return prerelease[0].includes(this.distribution);
|
||||
});
|
||||
localVersionPaths.sort(semver.rcompare);
|
||||
const localVersion = this.evaluateVersions(localVersionPaths);
|
||||
|
@ -38,14 +39,13 @@ export default class NightlyNodejs extends BaseDistribution {
|
|||
core.debug(`evaluating ${versions.length} versions`);
|
||||
|
||||
const {includePrerelease, range} = this.createRangePreRelease(
|
||||
this.nodeInfo.versionSpec,
|
||||
'nightly'
|
||||
this.nodeInfo.versionSpec
|
||||
);
|
||||
|
||||
for (let i = 0; i < versions.length; i++) {
|
||||
const potential: string = versions[i];
|
||||
const satisfied: boolean = semver.satisfies(
|
||||
potential.replace('nightly', 'nightly.'),
|
||||
potential.replace(this.distribution, `${this.distribution}.`),
|
||||
range,
|
||||
{
|
||||
includePrerelease: includePrerelease
|
||||
|
@ -70,22 +70,19 @@ export default class NightlyNodejs extends BaseDistribution {
|
|||
return 'https://nodejs.org/download/nightly';
|
||||
}
|
||||
|
||||
protected createRangePreRelease(
|
||||
versionSpec: string,
|
||||
distribution: string = ''
|
||||
) {
|
||||
protected createRangePreRelease(versionSpec: string) {
|
||||
let range: string;
|
||||
const [raw, prerelease] = this.splitVersionSpec(versionSpec);
|
||||
const isValidVersion = semver.valid(raw);
|
||||
const rawVersion = (isValidVersion ? raw : semver.coerce(raw))!;
|
||||
|
||||
if (prerelease !== distribution) {
|
||||
if (prerelease !== this.distribution) {
|
||||
range = `${rawVersion}-${prerelease.replace(
|
||||
distribution,
|
||||
`${distribution}.`
|
||||
this.distribution,
|
||||
`${this.distribution}.`
|
||||
)}`;
|
||||
} else {
|
||||
range = `${semver.validRange(`^${rawVersion}-${distribution}`)}-0`;
|
||||
range = `${semver.validRange(`^${rawVersion}-${this.distribution}`)}-0`;
|
||||
}
|
||||
|
||||
return {range, includePrerelease: !isValidVersion};
|
||||
|
|
|
@ -19,6 +19,7 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||
public async getNodeJsInfo() {
|
||||
let manifest: tc.IToolRelease[] | undefined;
|
||||
let nodeVersions: INodeVersion[] | undefined;
|
||||
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
|
||||
if (this.isLtsAlias(this.nodeInfo.versionSpec)) {
|
||||
core.info('Attempt to resolve LTS alias from manifest...');
|
||||
|
||||
|
@ -42,7 +43,6 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||
|
||||
if (this.nodeInfo.checkLatest) {
|
||||
core.info('Attempt to resolve the latest version from manifest...');
|
||||
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
|
||||
const resolvedVersion = await this.resolveVersionFromManifest(
|
||||
this.nodeInfo.versionSpec,
|
||||
osArch,
|
||||
|
@ -66,7 +66,7 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||
let downloadPath = '';
|
||||
try {
|
||||
core.info(`Attempting to download ${this.nodeInfo.versionSpec}...`);
|
||||
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
|
||||
|
||||
const versionInfo = await this.getInfoFromManifest(
|
||||
this.nodeInfo.versionSpec,
|
||||
osArch,
|
||||
|
|
|
@ -7,6 +7,7 @@ import BaseDistribution from '../base-distribution';
|
|||
import {INodejs} from '../base-models';
|
||||
|
||||
export default class CanaryBuild extends BaseDistribution {
|
||||
protected distribution = 'v8-canary';
|
||||
constructor(nodeInfo: INodejs) {
|
||||
super(nodeInfo);
|
||||
}
|
||||
|
@ -21,7 +22,7 @@ export default class CanaryBuild extends BaseDistribution {
|
|||
return false;
|
||||
}
|
||||
|
||||
return prerelease[0].includes('v8-canary');
|
||||
return prerelease[0].includes(this.distribution);
|
||||
});
|
||||
localVersionPaths.sort(semver.rcompare);
|
||||
const localVersion = this.evaluateVersions(localVersionPaths);
|
||||
|
@ -42,14 +43,13 @@ export default class CanaryBuild extends BaseDistribution {
|
|||
core.debug(`evaluating ${versions.length} versions`);
|
||||
|
||||
const {includePrerelease, range} = this.createRangePreRelease(
|
||||
this.nodeInfo.versionSpec,
|
||||
'v8-canary'
|
||||
this.nodeInfo.versionSpec
|
||||
);
|
||||
|
||||
for (let i = 0; i < versions.length; i++) {
|
||||
const potential: string = versions[i];
|
||||
const satisfied: boolean = semver.satisfies(
|
||||
potential.replace('v8-canary', 'v8-canary.'),
|
||||
potential.replace(this.distribution, `${this.distribution}.`),
|
||||
range,
|
||||
{
|
||||
includePrerelease: includePrerelease
|
||||
|
@ -70,22 +70,19 @@ export default class CanaryBuild extends BaseDistribution {
|
|||
return version;
|
||||
}
|
||||
|
||||
protected createRangePreRelease(
|
||||
versionSpec: string,
|
||||
distribution: string = ''
|
||||
) {
|
||||
protected createRangePreRelease(versionSpec: string) {
|
||||
let range: string;
|
||||
const [raw, prerelease] = this.splitVersionSpec(versionSpec);
|
||||
const isValidVersion = semver.valid(raw);
|
||||
const rawVersion = (isValidVersion ? raw : semver.coerce(raw))!;
|
||||
|
||||
if (prerelease !== distribution) {
|
||||
if (prerelease !== this.distribution) {
|
||||
range = `${rawVersion}-${prerelease.replace(
|
||||
distribution,
|
||||
`${distribution}.`
|
||||
this.distribution,
|
||||
`${this.distribution}.`
|
||||
)}`;
|
||||
} else {
|
||||
range = `${semver.validRange(`^${rawVersion}-${distribution}`)}-0`;
|
||||
range = `${semver.validRange(`^${rawVersion}-${this.distribution}`)}-0`;
|
||||
}
|
||||
|
||||
return {range, includePrerelease: !isValidVersion};
|
||||
|
|
Loading…
Add table
Reference in a new issue