Skip to content

Commit

Permalink
feat(cli) Make tauri migrate update $schema in tauri.conf.json (#11414
Browse files Browse the repository at this point in the history
)

* Make `tauri migrate` update $schema in tauri.conf.json

* add change file

---------

Co-authored-by: Lucas Nogueira <[email protected]>
  • Loading branch information
Czxck001 and lucasfernog authored Oct 21, 2024
1 parent f0da0bd commit e0d1307
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changes/migrate-schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@tauri-apps/cli": patch:enhance
"tauri-cli": patch:enhance
---

Migrate the `$schema` Tauri configuration to the v2 format.
13 changes: 13 additions & 0 deletions crates/tauri-cli/src/migrate/migrations/v1/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,15 @@ mod test {
let mut migrated = original.clone();
super::migrate_config(&mut migrated).expect("failed to migrate config");

if original.get("$schema").is_some() {
if let Some(map) = migrated.as_object_mut() {
map.insert(
"$schema".to_string(),
serde_json::Value::String("https://schema.tauri.app/config/2".to_string()),
);
}
}

if original
.get("tauri")
.and_then(|v| v.get("bundle"))
Expand All @@ -708,6 +717,7 @@ mod test {
#[test]
fn migrate_full() {
let original = serde_json::json!({
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
"build": {
"distDir": "../dist",
"devPath": "http://localhost:1240",
Expand Down Expand Up @@ -798,6 +808,9 @@ mod test {

let migrated = migrate(&original);

// $schema
assert_eq!(migrated["$schema"], "https://schema.tauri.app/config/2");

// plugins > updater
assert_eq!(
migrated["plugins"]["updater"]["endpoints"],
Expand Down

0 comments on commit e0d1307

Please sign in to comment.