瀏覽代碼

fix(core): Mark `identifier` as a required field. (#10946)

* fix(core): Mark `identifier` as a required field.

* change tag

* inject identifier in tests
Fabian-Lars 10 月之前
父節點
當前提交
0a47bf0430

+ 5 - 0
.changes/fix-identifier-config-required.md

@@ -0,0 +1,5 @@
+---
+'tauri-utils': 'patch:bug'
+---
+
+Fixed an issue that made the `identifier` in `tauri.conf.json` optional while it was actually required.

File diff suppressed because it is too large
+ 0 - 0
crates/tauri-cli/config.schema.json


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

@@ -682,6 +682,20 @@ mod test {
     let mut migrated = original.clone();
     super::migrate_config(&mut migrated).expect("failed to migrate config");
 
+    if original
+      .get("tauri")
+      .and_then(|v| v.get("bundle"))
+      .and_then(|v| v.get("identifier"))
+      .is_none()
+    {
+      if let Some(map) = migrated.as_object_mut() {
+        map.insert(
+          "identifier".to_string(),
+          serde_json::Value::String("com.tauri.test-injected".to_string()),
+        );
+      }
+    }
+
     if let Err(e) = serde_json::from_value::<tauri_utils::config::Config>(migrated.clone()) {
       panic!("migrated config is not valid: {e}");
     }

File diff suppressed because it is too large
+ 0 - 0
crates/tauri-schema-generator/schemas/config.schema.json


+ 1 - 2
crates/tauri-utils/src/config.rs

@@ -2250,9 +2250,8 @@ pub struct Config {
   /// The application identifier in reverse domain name notation (e.g. `com.tauri.example`).
   /// This string must be unique across applications since it is used in system configurations like
   /// the bundle ID and path to the webview data directory.
-  /// This string must contain only alphanumeric characters (A–Z, a–z, and 0–9), hyphens (-),
+  /// This string must contain only alphanumeric characters (A-Z, a-z, and 0-9), hyphens (-),
   /// and periods (.).
-  #[serde(default)]
   pub identifier: String,
   /// The App configuration.
   #[serde(default)]

Some files were not shown because too many files changed in this diff