fix(cli): v1 migration should add the updater plugin if it is enabled (#10481)

* fix(cli): v1 migration should add the updater plugin if it is enabled

* fix change tag

* move to process_updater

* Update tooling/cli/src/migrate/migrations/v1/config.rs

Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>

---------

Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
This commit is contained in:
Lucas Fernandes Nogueira 2024-08-05 10:00:33 -03:00 committed by GitHub
parent a3cd9779a4
commit 2e8ab7bac1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -0,0 +1,6 @@
---
"tauri-cli": patch:bug
"@tauri-apps/cli": patch:bug
---
Migration from v1 to v2 now adds the updater plugin when it is active.

View File

@ -110,8 +110,8 @@ fn migrate_config(config: &mut Value) -> Result<MigratedConfig> {
process_cli(&mut plugins, cli)?;
}
// cli
process_updater(tauri_config, &mut plugins)?;
// updater
process_updater(tauri_config, &mut plugins, &mut migrated)?;
}
config.insert("plugins".into(), plugins.into());
@ -512,6 +512,7 @@ fn process_cli(plugins: &mut Map<String, Value>, cli: Value) -> Result<()> {
fn process_updater(
tauri_config: &mut Map<String, Value>,
plugins: &mut Map<String, Value>,
migrated: &mut MigratedConfig,
) -> Result<()> {
if let Some(mut updater) = tauri_config.remove("updater") {
if let Some(updater) = updater.as_object_mut() {
@ -528,6 +529,7 @@ fn process_updater(
|| updater.get("pubkey").is_some()
{
plugins.insert("updater".into(), serde_json::to_value(updater)?);
migrated.plugins.insert("updater".to_string());
}
}
}