Kaynağa Gözat

chore(config): adjust documentation

Lucas Nogueira 3 yıl önce
ebeveyn
işleme
6c92fb0aef
2 değiştirilmiş dosya ile 21 ekleme ve 9 silme
  1. 18 6
      core/tauri-utils/src/config.rs
  2. 3 3
      tooling/cli/schema.json

+ 18 - 6
core/tauri-utils/src/config.rs

@@ -351,7 +351,7 @@ pub struct BundleConfig {
 pub struct CliArg {
   /// The short version of the argument, without the preceding -.
   ///
-  /// NOTE: Any leading - characters will be stripped, and only the first non - character will be used as the short version.
+  /// NOTE: Any leading `-` characters will be stripped, and only the first non-character will be used as the short version.
   pub short: Option<char>,
   /// The unique argument name
   pub name: String,
@@ -1379,7 +1379,6 @@ impl Allowlist for DialogAllowlistConfig {
 /// The scoped URL is matched against the request URL using a glob pattern.
 ///
 /// # Examples
-///
 /// - "https://**": allows all HTTPS urls
 /// - "https://*.github.com/tauri-apps/tauri": allows any subdomain of "github.com" with the "tauri-apps/api" path
 /// - "https://myapi.service.com/users/*": allows access to any URLs that begins with "https://myapi.service.com/users/"
@@ -2232,17 +2231,28 @@ impl PackageConfig {
   }
 }
 
-/// The config type mapped to `tauri.conf.json`.
 /// The tauri.conf.json is a file generated by the
 /// [`tauri init`](https://tauri.studio/v1/api/cli#init) command that lives in
-/// your Tauri application source directory (src-tauri). Once generated, you may
-/// modify it at will to customize your Tauri application.
+/// your Tauri application source directory (src-tauri).
+///
+/// Once generated, you may modify it at will to customize your Tauri application.
+///
+/// ## Platform-Specific Configuration
 ///
 /// In addition to the JSON defined on the `tauri.conf.json` file, Tauri can
 /// read a platform-specific configuration from `tauri.linux.conf.json`,
 /// `tauri.windows.conf.json`, and `tauri.macos.conf.json` and merges it with
 /// the main `tauri.conf.json` configuration.
 ///
+/// ## Configuration Structure
+///
+/// `tauri.conf.json` is composed of the following objects:
+///
+/// - [`build`](BuildConfig): The build configuration
+/// - [`package`](PackageConfig): Package settings
+/// - [`plugins`](PluginConfig): The plugins config
+/// - [`tauri`](TauriConfig): The Tauri config
+///
 /// ```json title="Example tauri.config.json file"
 /// {
 ///   "build": {
@@ -2260,7 +2270,8 @@ impl PackageConfig {
 ///       "all": true
 ///     },
 ///     // The below `bundle` object has been edited for brevity
-///     "bundle": {...},
+///
+///     "bundle": {},
 ///     "security": {
 ///       "csp": null
 ///     },
@@ -2278,6 +2289,7 @@ impl PackageConfig {
 ///     ]
 ///   }
 /// }
+/// ```
 #[skip_serializing_none]
 #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
 #[cfg_attr(feature = "schema", derive(JsonSchema))]

+ 3 - 3
tooling/cli/schema.json

@@ -1,7 +1,7 @@
 {
   "$schema": "http://json-schema.org/draft-07/schema#",
   "title": "Config",
-  "description": "The config type mapped to `tauri.conf.json`. The tauri.conf.json is a file generated by the [`tauri init`](https://tauri.studio/v1/api/cli#init) command that lives in your Tauri application source directory (src-tauri). Once generated, you may modify it at will to customize your Tauri application.\n\nIn addition to the JSON defined on the `tauri.conf.json` file, Tauri can read a platform-specific configuration from `tauri.linux.conf.json`, `tauri.windows.conf.json`, and `tauri.macos.conf.json` and merges it with the main `tauri.conf.json` configuration.\n\n```json title=\"Example tauri.config.json file\" { \"build\": { \"beforeBuildCommand\": \"\", \"beforeDevCommand\": \"\", \"devPath\": \"../dist\", \"distDir\": \"../dist\" }, \"package\": { \"productName\": \"tauri-app\", \"version\": \"0.1.0\" }, \"tauri\": { \"allowlist\": { \"all\": true }, // The below `bundle` object has been edited for brevity \"bundle\": {...}, \"security\": { \"csp\": null }, \"updater\": { \"active\": false }, \"windows\": [ { \"fullscreen\": false, \"height\": 600, \"resizable\": true, \"title\": \"Tauri App\", \"width\": 800 } ] } }",
+  "description": "The tauri.conf.json is a file generated by the [`tauri init`](https://tauri.studio/v1/api/cli#init) command that lives in your Tauri application source directory (src-tauri).\n\nOnce generated, you may modify it at will to customize your Tauri application.\n\n## Platform-Specific Configuration\n\nIn addition to the JSON defined on the `tauri.conf.json` file, Tauri can read a platform-specific configuration from `tauri.linux.conf.json`, `tauri.windows.conf.json`, and `tauri.macos.conf.json` and merges it with the main `tauri.conf.json` configuration.\n\n## Configuration Structure\n\n`tauri.conf.json` is composed of the following objects:\n\n- [`build`](BuildConfig): The build configuration - [`package`](PackageConfig): Package settings - [`plugins`](PluginConfig): The plugins config - [`tauri`](TauriConfig): The Tauri config\n\n```json title=\"Example tauri.config.json file\" { \"build\": { \"beforeBuildCommand\": \"\", \"beforeDevCommand\": \"\", \"devPath\": \"../dist\", \"distDir\": \"../dist\" }, \"package\": { \"productName\": \"tauri-app\", \"version\": \"0.1.0\" }, \"tauri\": { \"allowlist\": { \"all\": true }, // The below `bundle` object has been edited for brevity\n\n\"bundle\": {}, \"security\": { \"csp\": null }, \"updater\": { \"active\": false }, \"windows\": [ { \"fullscreen\": false, \"height\": 600, \"resizable\": true, \"title\": \"Tauri App\", \"width\": 800 } ] } } ```",
   "type": "object",
   "properties": {
     "$schema": {
@@ -777,7 +777,7 @@
           }
         },
         "short": {
-          "description": "The short version of the argument, without the preceding -.\n\nNOTE: Any leading - characters will be stripped, and only the first non - character will be used as the short version.",
+          "description": "The short version of the argument, without the preceding -.\n\nNOTE: Any leading `-` characters will be stripped, and only the first non-character will be used as the short version.",
           "type": [
             "string",
             "null"
@@ -1114,7 +1114,7 @@
       "additionalProperties": false
     },
     "HttpAllowlistScope": {
-      "description": "HTTP API scope definition. It is a list of URLs that can be accessed by the webview when using the HTTP APIs. The scoped URL is matched against the request URL using a glob pattern.\n\n# Examples\n\n- \"https://**\": allows all HTTPS urls - \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path - \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
+      "description": "HTTP API scope definition. It is a list of URLs that can be accessed by the webview when using the HTTP APIs. The scoped URL is matched against the request URL using a glob pattern.\n\n# Examples - \"https://**\": allows all HTTPS urls - \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path - \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
       "type": "array",
       "items": {
         "type": "string",