removed test logic in ParseNodeVersionFile for lts and partial matching

This commit is contained in:
La'Kaleigh Harris 2021-10-05 16:54:02 +00:00 committed by GitHub
parent b1ed0c36e7
commit c178bbba23
4 changed files with 312 additions and 373 deletions

22
dist/setup/index.js vendored
View file

@ -65412,28 +65412,14 @@ function translateArchToDistUrl(arch) {
}
function parseNodeVersionFile(contents) {
return __awaiter(this, void 0, void 0, function* () {
contents = contents.trim();
if (/^v\d/.test(contents)) {
contents = contents.substring(1);
let nodeVersion = contents.trim();
if (/^v\d/.test(nodeVersion)) {
nodeVersion = nodeVersion.substring(1);
}
const nodeVersions = yield getVersionsFromDist();
let nodeVersion;
if (semver.valid(contents) || isPartialMatch(contents)) {
nodeVersion = contents;
}
else {
throw new Error(`Couldn't resolve node version: '${contents}'`);
}
return stripVPrefix(nodeVersion);
return nodeVersion;
});
}
exports.parseNodeVersionFile = parseNodeVersionFile;
function isPartialMatch(version) {
return /^\d+(\.\d+(\.\d+)?)?$/.test(version);
}
function stripVPrefix(version) {
return /^v\d/.test(version) ? version.substring(1) : version;
}
/***/ }),