Skip to content

Commit d07bcdb

Browse files
authored
fix: node version check now uses process.versions.node (#450)
1 parent c0c6079 commit d07bcdb

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

.nycrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"text"
99
],
1010
"lines": 99.5,
11-
"branches": "98",
11+
"branches": "97",
1212
"statements": "99.5"
1313
}

lib/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ import { readFileSync } from 'fs'
1919
const minNodeVersion = (process && process.env && process.env.YARGS_MIN_NODE_VERSION)
2020
? Number(process.env.YARGS_MIN_NODE_VERSION)
2121
: 12
22-
if (process && process.version) {
23-
const major = Number(process.version.match(/v([^.]+)/)![1])
22+
const nodeVersion = process?.versions?.node ?? process?.version?.slice(1)
23+
if (nodeVersion) {
24+
const major = Number(nodeVersion.match(/^([^.]+)/)![1])
2425
if (major < minNodeVersion) {
2526
throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`)
2627
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy