Skip to content

Commit

Permalink
fix(cli): fix tauri migrate failing to install NPM deps when runnin…
Browse files Browse the repository at this point in the history
…g from Deno (#11523)

* fix(cli): fix `tauri migrate` failing to install NPM deps when running from Deno

* clippy
  • Loading branch information
amrbashir authored Nov 5, 2024
1 parent 100a445 commit 7af01ff
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .changes/cli-migrate-deno.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"tauri-cli": "patch:bug"
"@tauri-apps/cli": "patch:bug"
---

Fix `tauri migrate` failing to install NPM depenencies when running from Deno.

5 changes: 1 addition & 4 deletions crates/tauri-cli/src/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ pub fn run(options: Options) -> Result<()> {
}));

let npm_spec = match (npm_version_req, options.tag, options.rev, options.branch) {
(Some(version_req), _, _, _) => match manager {
PackageManager::Deno => format!("npm:{npm_name}@{version_req}"),
_ => format!("{npm_name}@{version_req}"),
},
(Some(version_req), _, _, _) => format!("{npm_name}@{version_req}"),
(None, Some(tag), None, None) => {
format!("tauri-apps/tauri-plugin-{plugin}#{tag}")
}
Expand Down
13 changes: 9 additions & 4 deletions crates/tauri-cli/src/helpers/npm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,15 @@ impl PackageManager {
.join(", ")
);

let status = self
.cross_command()
.arg("add")
.args(dependencies)
let mut command = self.cross_command();
command.arg("add");

match self {
PackageManager::Deno => command.args(dependencies.iter().map(|d| format!("npm:{d}"))),
_ => command.args(dependencies),
};

let status = command
.current_dir(frontend_dir)
.status()
.with_context(|| format!("failed to run {self}"))?;
Expand Down

0 comments on commit 7af01ff

Please sign in to comment.