mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-06-07 20:51:11 +00:00
removed test logic in ParseNodeVersionFile for lts and partial matching
This commit is contained in:
parent
b1ed0c36e7
commit
c178bbba23
4 changed files with 312 additions and 373 deletions
22
dist/setup/index.js
vendored
22
dist/setup/index.js
vendored
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue