Skip to content

Commit

Permalink
fix: fix reading package.json files, closes #273
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Sep 16, 2024
1 parent 7ae817b commit 53b84b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-vscode': 'patch'
---

Fix extensions commands not working with `EISDIR` error.
8 changes: 4 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,11 @@ interface PackageJson {
}
}

function __getPackageJson(packageJsonPath: string): PackageJson | null {
const packagePath = path.join(packageJsonPath, 'package.json')
function __getPackageJson(appDir: string): PackageJson | null {
const packageJsonPath = path.join(appDir, 'package.json')
if (fs.existsSync(packageJsonPath)) {
const packageStr = fs.readFileSync(packageJsonPath).toString()
return JSON.parse(packageStr) as PackageJson
const packageJsonStr = fs.readFileSync(packageJsonPath).toString()
return JSON.parse(packageJsonStr) as PackageJson
} else {
return null
}
Expand Down

0 comments on commit 53b84b4

Please sign in to comment.