Skip to content

Commit

Permalink
fix(cli): v1 migration should add the updater plugin if it is enabled (
Browse files Browse the repository at this point in the history
…#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>
  • Loading branch information
lucasfernog and FabianLars authored Aug 5, 2024
1 parent a3cd977 commit 2e8ab7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changes/v1-migrate-updater.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 4 additions & 2 deletions tooling/cli/src/migrate/migrations/v1/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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() {
Expand All @@ -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());
}
}
}
Expand Down

0 comments on commit 2e8ab7b

Please sign in to comment.