Skip to content

Commit

Permalink
fix: update nodejs detection in mobile commands (#6451)
Browse files Browse the repository at this point in the history
* fix: update nodejs detection in mobile commands

* changefile
  • Loading branch information
amrbashir committed Mar 16, 2023
1 parent 2b22f64 commit 58d4709
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/cli-nodejs-detection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'cli.rs': 'patch'
---

In mobile commands, correctly detect when nodejs binary has the version in its name, for example `node-18`
2 changes: 1 addition & 1 deletion tooling/cli/src/mobile/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub fn exec(

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

0 comments on commit 58d4709

Please sign in to comment.