mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-25 11:43:06 +03:00
fix(cli): correct module name resolution for clipboard
and globalShortcut
plugins (#9931)
This commit is contained in:
parent
ddaabda365
commit
019a74e970
6
.changes/cli-migrate-clipboard-globalShortcut.md
Normal file
6
.changes/cli-migrate-clipboard-globalShortcut.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
'tauri-cli': 'patch:bug'
|
||||
'@tauri-apps/cli': 'patch:bug'
|
||||
---
|
||||
|
||||
Fix wrong migration of `clipboard` and `globalShortcut` modules
|
@ -49,7 +49,7 @@ pub fn migrate(app_dir: &Path, tauri_dir: &Path) -> Result<()> {
|
||||
let new_contents =
|
||||
tauri_api_import_regex.replace_all(&js_contents, |cap: ®ex::bytes::Captures<'_>| {
|
||||
let module = cap.get(1).unwrap().as_bytes();
|
||||
let module = String::from_utf8_lossy(module).to_string();
|
||||
let mut module = String::from_utf8_lossy(module).to_string();
|
||||
let original = cap.get(0).unwrap().as_bytes();
|
||||
let original = String::from_utf8_lossy(original).to_string();
|
||||
|
||||
@ -58,17 +58,16 @@ pub fn migrate(app_dir: &Path, tauri_dir: &Path) -> Result<()> {
|
||||
{
|
||||
renamed_to.to_string()
|
||||
} else if PLUGINIFIED_MODULES.contains(&module.as_str()) {
|
||||
let plugin = format!("@tauri-apps/plugin-{module}");
|
||||
new_npm_packages.push(plugin.clone());
|
||||
new_cargo_packages.push(format!(
|
||||
"tauri-plugin-{}",
|
||||
if module == "clipboard" {
|
||||
"clipboard-manager"
|
||||
} else {
|
||||
&module
|
||||
}
|
||||
));
|
||||
plugin
|
||||
match module.as_str() {
|
||||
"clipboard" => module = String::from("clipboard-manager"),
|
||||
"globalShortcut" => module = String::from("global-shortcut"),
|
||||
_ => {}
|
||||
}
|
||||
let js_plugin = format!("@tauri-apps/plugin-{module}");
|
||||
let cargo_crate = format!("tauri-plugin-{module}");
|
||||
new_npm_packages.push(js_plugin.clone());
|
||||
new_cargo_packages.push(cargo_crate);
|
||||
js_plugin
|
||||
} else {
|
||||
return original;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user