Add support for asdf format as Node.js version file

This commit is contained in:
Hideki Igarashi
2021-12-02 00:44:59 +09:00
parent 82496765f3
commit dbb64ac1d1
7 changed files with 32 additions and 20 deletions

12
dist/setup/index.js vendored
View File

@ -70963,11 +70963,15 @@ function translateArchToDistUrl(arch) {
}
}
function parseNodeVersionFile(contents) {
let nodeVersion = contents.trim();
if (/^v\d/.test(nodeVersion)) {
nodeVersion = nodeVersion.substring(1);
var _a;
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
const nodeVersion = (_a = found === null || found === void 0 ? void 0 : found.groups) === null || _a === void 0 ? void 0 : _a.version;
if (nodeVersion) {
return nodeVersion;
}
return nodeVersion;
// In the case of an unknown format,
// return as is and evaluate the version separately.
return contents.trim();
}
exports.parseNodeVersionFile = parseNodeVersionFile;
function isLatestSyntax(versionSpec) {