Skip to content

Commit e0d1307

Browse files
feat(cli) Make tauri migrate update $schema in tauri.conf.json (#11414)
* Make `tauri migrate` update $schema in tauri.conf.json * add change file --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
1 parent f0da0bd commit e0d1307

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

.changes/migrate-schema.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@tauri-apps/cli": patch:enhance
3+
"tauri-cli": patch:enhance
4+
---
5+
6+
Migrate the `$schema` Tauri configuration to the v2 format.

crates/tauri-cli/src/migrate/migrations/v1/config.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,15 @@ mod test {
684684
let mut migrated = original.clone();
685685
super::migrate_config(&mut migrated).expect("failed to migrate config");
686686

687+
if original.get("$schema").is_some() {
688+
if let Some(map) = migrated.as_object_mut() {
689+
map.insert(
690+
"$schema".to_string(),
691+
serde_json::Value::String("https://schema.tauri.app/config/2".to_string()),
692+
);
693+
}
694+
}
695+
687696
if original
688697
.get("tauri")
689698
.and_then(|v| v.get("bundle"))
@@ -708,6 +717,7 @@ mod test {
708717
#[test]
709718
fn migrate_full() {
710719
let original = serde_json::json!({
720+
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
711721
"build": {
712722
"distDir": "../dist",
713723
"devPath": "http://localhost:1240",
@@ -798,6 +808,9 @@ mod test {
798808

799809
let migrated = migrate(&original);
800810

811+
// $schema
812+
assert_eq!(migrated["$schema"], "https://schema.tauri.app/config/2");
813+
801814
// plugins > updater
802815
assert_eq!(
803816
migrated["plugins"]["updater"]["endpoints"],

0 commit comments

Comments
 (0)