fix(cli.js): detect node-20 binary (#6667)

* fix nodejs binary regex

* Update clijs-node-version-20.md
This commit is contained in:
Nathanael Rea 2023-05-22 18:09:49 -04:00 committed by GitHub
parent 1161b6788e
commit fb7ef8dacd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
'@tauri-apps/cli': patch
---
Fix nodejs binary regex when `0` is in the version name, for example `node-20`

View File

@ -20,7 +20,7 @@ if (bin === '@tauri-apps/cli') {
}
// Even if started by a package manager, the binary will be NodeJS.
// Some distribution still use "nodejs" as the binary name.
else if (binStem.match(/(nodejs|node)\-?([1-9]*)*$/g)) {
else if (binStem.match(/(nodejs|node)\-?([0-9]*)*$/g)) {
const managerStem = process.env.npm_execpath
? path.parse(process.env.npm_execpath).name.toLowerCase()
: null