Skip to content

Commit

Permalink
fix(cli): detect deno (#5475)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
  • Loading branch information
amrbashir and lucasfernog authored Oct 27, 2022
1 parent 6ca8a05 commit 7a231cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"cli.js": patch
---

Fix crash when nodejs binary has the version in its name, for example `node18`
---
"cli.js": patch
---

Fix crash when nodejs binary has the version in its name, for example `node18` or when running through deno.
6 changes: 5 additions & 1 deletion tooling/cli/node/tauri.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ const binStem = path.parse(bin).name.toLowerCase()
// can successfully detect what command likely started the execution.
let binName

// deno run -A --unstable --node-modules-dir npm:@tauri-apps/cli
if (bin === '@tauri-apps/cli') {
binName = '@tauri-apps/cli'
}
// Even if started by a package manager, the binary will be NodeJS.
// Some distribution still use "nodejs" as the binary name.
if (binStem.match(/(nodejs|node)([1-9]*)*$/g)) {
else if (binStem.match(/(nodejs|node)([1-9]*)*$/g)) {
const managerStem = process.env.npm_execpath
? path.parse(process.env.npm_execpath).name.toLowerCase()
: null
Expand Down

0 comments on commit 7a231cd

Please sign in to comment.