mirror of
https://github.com/actions/setup-node.git
synced 2025-04-22 09:21:00 +00:00
Build index.js
This commit is contained in:
parent
389036835e
commit
0db4699b29
1 changed files with 5 additions and 5 deletions
10
dist/setup/index.js
vendored
10
dist/setup/index.js
vendored
|
@ -71770,13 +71770,13 @@ function translateArchToDistUrl(arch) {
|
||||||
function parseNodeVersionFile(contents) {
|
function parseNodeVersionFile(contents) {
|
||||||
var _a, _b;
|
var _a, _b;
|
||||||
let nodeVersion;
|
let nodeVersion;
|
||||||
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
|
// Try parsing the file as an NPM `package.json`
|
||||||
nodeVersion = (_a = found === null || found === void 0 ? void 0 : found.groups) === null || _a === void 0 ? void 0 : _a.version;
|
// file.
|
||||||
|
nodeVersion = (_a = JSON.parse(contents).engines) === null || _a === void 0 ? void 0 : _a.node;
|
||||||
if (!nodeVersion) {
|
if (!nodeVersion) {
|
||||||
try {
|
try {
|
||||||
// Try parsing the file as an NPM `package.json`
|
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
|
||||||
// file.
|
nodeVersion = (_b = found === null || found === void 0 ? void 0 : found.groups) === null || _b === void 0 ? void 0 : _b.version;
|
||||||
nodeVersion = (_b = JSON.parse(contents).engines) === null || _b === void 0 ? void 0 : _b.node;
|
|
||||||
if (!nodeVersion)
|
if (!nodeVersion)
|
||||||
throw new Error();
|
throw new Error();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue