fix(cli): mismatched versions check for pnpm (#14481)

This commit is contained in:
Tony
2025-11-18 18:16:29 +08:00
committed by GitHub
parent ee3cc4a91b
commit f855caf8a3
2 changed files with 14 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
---
"tauri-cli": patch:bug
"@tauri-apps/cli": patch:bug
---
Fixed the mismatched tauri package versions check didn't work for pnpm

View File

@@ -332,7 +332,14 @@ impl PackageManager {
version: String,
}
let json: ListOutput = serde_json::from_str(&stdout).context("failed to parse npm list")?;
let json = if matches!(self, PackageManager::Pnpm) {
serde_json::from_str::<Vec<ListOutput>>(&stdout)
.ok()
.and_then(|out| out.into_iter().next())
.context("failed to parse pnpm list")?
} else {
serde_json::from_str::<ListOutput>(&stdout).context("failed to parse npm list")?
};
for (package, dependency) in json.dependencies.into_iter().chain(json.dev_dependencies) {
let version = dependency.version;
if let Ok(version) = semver::Version::parse(&version) {