Skip to content

Commit 58d4709

Browse files
authored
fix: update nodejs detection in mobile commands (#6451)
* fix: update nodejs detection in mobile commands * changefile
1 parent 2b22f64 commit 58d4709

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changes/cli-nodejs-detection.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'cli.rs': 'patch'
3+
---
4+
5+
In mobile commands, correctly detect when nodejs binary has the version in its name, for example `node-18`

tooling/cli/src/mobile/init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub fn exec(
120120

121121
let binary_path = PathBuf::from(&binary);
122122
let bin_stem = binary_path.file_stem().unwrap().to_string_lossy();
123-
let r = regex::Regex::new("(nodejs|node)([1-9]*)*$").unwrap();
123+
let r = regex::Regex::new("(nodejs|node)\\-?([1-9]*)*$").unwrap();
124124
if r.is_match(&bin_stem) {
125125
if let Some(npm_execpath) = var_os("npm_execpath").map(PathBuf::from) {
126126
let manager_stem = npm_execpath.file_stem().unwrap().to_os_string();

0 commit comments

Comments
 (0)