mirror of
https://github.com/actions/setup-node.git
synced 2025-05-10 19:23:43 +00:00
Add support for asdf format as Node.js version file
This commit is contained in:
parent
82496765f3
commit
dbb64ac1d1
7 changed files with 32 additions and 20 deletions
12
dist/setup/index.js
vendored
12
dist/setup/index.js
vendored
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue