Skip to content

Commit cac22e4

Browse files
committed
Check tauri <-> @tauri-apps/api
1 parent 6397418 commit cac22e4

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ impl PackageManager {
198198
Ok(())
199199
}
200200

201+
// TODO: Use `current_package_versions` as much as possible for better speed
201202
pub fn current_package_version<P: AsRef<Path>>(
202203
&self,
203204
name: &str,

crates/tauri-cli/src/info/plugins.rs

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use std::{
66
collections::HashMap,
7-
fs,
7+
fs, iter,
88
path::{Path, PathBuf},
99
};
1010

@@ -61,13 +61,19 @@ pub fn installed_plugins(
6161
.and_then(|s| toml::from_str(&s).ok());
6262

6363
let know_plugins = helpers::plugins::known_plugins();
64-
let crate_names: Vec<String> = know_plugins
65-
.keys()
66-
.map(|plugin_name| format!("tauri-plugin-{plugin_name}"))
64+
let crate_names: Vec<String> = iter::once("tauri".to_owned())
65+
.chain(
66+
know_plugins
67+
.keys()
68+
.map(|plugin_name| format!("tauri-plugin-{plugin_name}")),
69+
)
6770
.collect();
68-
let npm_names: Vec<String> = know_plugins
69-
.keys()
70-
.map(|plugin_name| format!("@tauri-apps/plugin-{plugin_name}"))
71+
let npm_names: Vec<String> = iter::once("@tauri-apps/api".to_owned())
72+
.chain(
73+
know_plugins
74+
.keys()
75+
.map(|plugin_name| format!("@tauri-apps/plugin-{plugin_name}")),
76+
)
7177
.collect();
7278

7379
let mut rust_plugins: HashMap<String, semver::Version> = crate_names
@@ -168,12 +174,14 @@ pub fn check_incompatible_packages(frontend_dir: &Path, tauri_path: &Path) -> cr
168174
}
169175
let incompatible_text = incompatible_plugins
170176
.iter()
171-
.map(|p| {
172-
format!(
173-
"{} (v{}) : {} (v{})",
174-
p.crate_name, p.crate_version, p.npm_name, p.npm_version
175-
)
176-
})
177+
.map(
178+
|InstalledPlugin {
179+
crate_name,
180+
crate_version,
181+
npm_name,
182+
npm_version,
183+
}| format!("{crate_name} (v{crate_version}) : {npm_name} (v{npm_version})"),
184+
)
177185
.collect::<Vec<_>>()
178186
.join("\n");
179187
Err(anyhow!("Found version mismatched Tauri packages. Make sure the NPM and crate versions are on the same major/minor releases:\n{incompatible_text}"))

0 commit comments

Comments
 (0)