Skip to content

Commit f855caf

Browse files
fix(cli): mismatched versions check for pnpm (#14481)
1 parent ee3cc4a commit f855caf

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri-cli": patch:bug
3+
"@tauri-apps/cli": patch:bug
4+
---
5+
6+
Fixed the mismatched tauri package versions check didn't work for pnpm

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,14 @@ impl PackageManager {
332332
version: String,
333333
}
334334

335-
let json: ListOutput = serde_json::from_str(&stdout).context("failed to parse npm list")?;
335+
let json = if matches!(self, PackageManager::Pnpm) {
336+
serde_json::from_str::<Vec<ListOutput>>(&stdout)
337+
.ok()
338+
.and_then(|out| out.into_iter().next())
339+
.context("failed to parse pnpm list")?
340+
} else {
341+
serde_json::from_str::<ListOutput>(&stdout).context("failed to parse npm list")?
342+
};
336343
for (package, dependency) in json.dependencies.into_iter().chain(json.dev_dependencies) {
337344
let version = dependency.version;
338345
if let Ok(version) = semver::Version::parse(&version) {

0 commit comments

Comments
 (0)