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

This commit is contained in:
amrbashir 2024-10-28 20:10:27 +03:00
parent c43d5df158
commit f9a74d45ae
No known key found for this signature in database
GPG Key ID: BBD7A47A2003FF33
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

@ -93,10 +93,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

@ -89,10 +89,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.into_iter().map(|d| format!("npm:{d}"))),
_ => command.args(dependencies),
};
let status = command
.current_dir(frontend_dir)
.status()
.with_context(|| format!("failed to run {self}"))?;