File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' tauri-vscode ' : patch
3+ ---
4+
5+ Fix extension trying to use npm instead of cargo.
Original file line number Diff line number Diff line change @@ -413,23 +413,30 @@ function __getNpmCommand() {
413413}
414414
415415function __getPackageManagerCommand ( projectPath : string ) : string | null {
416- const m = __usePnpm ( projectPath )
417- ? 'pnpm'
418- : __useYarn ( projectPath )
419- ? 'yarn'
420- : __useNpm ( projectPath )
421- ? __getNpmCommand ( )
422- : __useCargo ( )
423- ? 'cargo'
424- : null
425-
426- if ( ! m ) {
427- vscode . window . showErrorMessage (
428- "Couldn't detect package manager for current project. Try running Tauri: Init Command"
416+ const isNodeProject = __isNodeProject ( projectPath )
417+ if ( isNodeProject ) {
418+ if ( __usePnpm ( projectPath ) ) return 'pnpm'
419+ if ( __useYarn ( projectPath ) ) return 'yarn'
420+
421+ const packageJson = JSON . parse (
422+ fs . readFileSync ( ` ${ projectPath } /package.json` , 'utf8' )
423+ )
424+
425+ if (
426+ __useNpm ( projectPath ) &&
427+ packageJson . script &&
428+ packageJson . script [ 'tauri' ]
429429 )
430+ return __getNpmCommand ( )
430431 }
431432
432- return m
433+ if ( __useCargo ( ) ) return 'cargo'
434+
435+ vscode . window . showErrorMessage (
436+ "Couldn't detect package manager for current project. Try running Tauri: Init Command"
437+ )
438+
439+ return null
433440}
434441
435442interface RunOptions {
You can’t perform that action at this time.
0 commit comments