Skip to content

Commit 7af01ff

Browse files
authored
fix(cli): fix tauri migrate failing to install NPM deps when running from Deno (#11523)
* fix(cli): fix `tauri migrate` failing to install NPM deps when running from Deno * clippy
1 parent 100a445 commit 7af01ff

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

.changes/cli-migrate-deno.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"tauri-cli": "patch:bug"
3+
"@tauri-apps/cli": "patch:bug"
4+
---
5+
6+
Fix `tauri migrate` failing to install NPM depenencies when running from Deno.
7+

crates/tauri-cli/src/add.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,7 @@ pub fn run(options: Options) -> Result<()> {
9090
}));
9191

9292
let npm_spec = match (npm_version_req, options.tag, options.rev, options.branch) {
93-
(Some(version_req), _, _, _) => match manager {
94-
PackageManager::Deno => format!("npm:{npm_name}@{version_req}"),
95-
_ => format!("{npm_name}@{version_req}"),
96-
},
93+
(Some(version_req), _, _, _) => format!("{npm_name}@{version_req}"),
9794
(None, Some(tag), None, None) => {
9895
format!("tauri-apps/tauri-plugin-{plugin}#{tag}")
9996
}

crates/tauri-cli/src/helpers/npm.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,15 @@ impl PackageManager {
122122
.join(", ")
123123
);
124124

125-
let status = self
126-
.cross_command()
127-
.arg("add")
128-
.args(dependencies)
125+
let mut command = self.cross_command();
126+
command.arg("add");
127+
128+
match self {
129+
PackageManager::Deno => command.args(dependencies.iter().map(|d| format!("npm:{d}"))),
130+
_ => command.args(dependencies),
131+
};
132+
133+
let status = command
129134
.current_dir(frontend_dir)
130135
.status()
131136
.with_context(|| format!("failed to run {self}"))?;

0 commit comments

Comments
 (0)