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
This commit is contained in:
Amr Bashir
2024-11-05 19:16:32 +02:00
committed by GitHub
parent 100a4455aa
commit 7af01ff2ce
3 changed files with 17 additions and 8 deletions

View File

@@ -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.

View File

@@ -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}")
}

View File

@@ -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}"))?;