mirror of
https://github.com/actions/setup-node.git
synced 2025-05-11 19:53:43 +00:00
Merge pull request #373 from ganta/add-support-for-asdf-format-as-node-version-file
Add support for asdf format as Node.js version file
This commit is contained in:
commit
5b949b50c3
7 changed files with 42 additions and 11 deletions
12
dist/setup/index.js
vendored
12
dist/setup/index.js
vendored
|
@ -71768,11 +71768,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