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 =
|
let new_contents =
|
||||||
tauri_api_import_regex.replace_all(&js_contents, |cap: ®ex::bytes::Captures<'_>| {
|
tauri_api_import_regex.replace_all(&js_contents, |cap: ®ex::bytes::Captures<'_>| {
|
||||||
let module = cap.get(1).unwrap().as_bytes();
|
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 = cap.get(0).unwrap().as_bytes();
|
||||||
let original = String::from_utf8_lossy(original).to_string();
|
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()
|
renamed_to.to_string()
|
||||||
} else if PLUGINIFIED_MODULES.contains(&module.as_str()) {
|
} else if PLUGINIFIED_MODULES.contains(&module.as_str()) {
|
||||||
let plugin = format!("@tauri-apps/plugin-{module}");
|
match module.as_str() {
|
||||||
new_npm_packages.push(plugin.clone());
|
"clipboard" => module = String::from("clipboard-manager"),
|
||||||
new_cargo_packages.push(format!(
|
"globalShortcut" => module = String::from("global-shortcut"),
|
||||||
"tauri-plugin-{}",
|
_ => {}
|
||||||
if module == "clipboard" {
|
}
|
||||||
"clipboard-manager"
|
let js_plugin = format!("@tauri-apps/plugin-{module}");
|
||||||
} else {
|
let cargo_crate = format!("tauri-plugin-{module}");
|
||||||
&module
|
new_npm_packages.push(js_plugin.clone());
|
||||||
}
|
new_cargo_packages.push(cargo_crate);
|
||||||
));
|
js_plugin
|
||||||
plugin
|
|
||||||
} else {
|
} else {
|
||||||
return original;
|
return original;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user