Skip to content

Commit 2b7c1f8

Browse files
fix(cli): install npm plugin packages in the frontend directory (#16003)
tauri add/remove used dirs.tauri as the npm cwd, so pnpm created package.json under src-tauri instead of the project root.
1 parent 6eda56c commit 2b7c1f8

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri-cli": patch:bug
3+
"@tauri-apps/cli": patch:bug
4+
---
5+
6+
Fix `tauri add` / `tauri remove` installing npm plugin packages into `src-tauri` instead of the frontend directory.

‎crates/tauri-cli/src/add.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub fn run(options: Options, dirs: &Dirs) -> Result<()> {
116116
(None, None, None, None) => npm_name,
117117
_ => crate::error::bail!("Only one of --tag, --rev and --branch can be specified"),
118118
};
119-
manager.install(&[npm_spec], dirs.tauri)?;
119+
manager.install(&[npm_spec], dirs.frontend)?;
120120
}
121121

122122
let _ = acl::permission::add::command(acl::permission::add::Options {

‎crates/tauri-cli/src/remove.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub fn command(options: Options) -> Result<()> {
4646
if !metadata.rust_only {
4747
if let Some(manager) = frontend_dir.map(PackageManager::from_project) {
4848
let npm_name = format!("@tauri-apps/plugin-{plugin}");
49-
manager.remove(&[npm_name], dirs.tauri)?;
49+
manager.remove(&[npm_name], dirs.frontend)?;
5050
}
5151

5252
acl::permission::rm::command(acl::permission::rm::Options {

0 commit comments

Comments
 (0)