Skip to content

Commit

Permalink
chore: Reused existing function
Browse files Browse the repository at this point in the history
Signed-off-by: Soorya U <[email protected]>
  • Loading branch information
soorya-u committed Jan 14, 2025
1 parent 02080d6 commit f4c7fbe
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,18 +413,13 @@ function __getNpmCommand() {
}

function __getPackageManagerCommand(projectPath: string): string | null {
const isNodeProject = __isNodeProject(projectPath)
if (!isNodeProject) return 'cargo'

try {
const packageJson = JSON.parse(
fs.readFileSync(`${projectPath}/package.json`, 'utf8')
)

// if there is no tauri command, use cargo
if (!packageJson.script || !packageJson.script['tauri']) return 'cargo'
} catch {
// if project uses vanilla js i.e. if no package.json exists
return 'cargo'
}
const packageJson = JSON.parse(
fs.readFileSync(`${projectPath}/package.json`, 'utf8')
)
if (!packageJson.script || !packageJson.script['tauri']) return 'cargo'

const m = __usePnpm(projectPath)
? 'pnpm'
Expand Down

0 comments on commit f4c7fbe

Please sign in to comment.