@@ -42,7 +42,9 @@ pub use self::parse::parse;
4242pub enum WindowUrl {
4343 /// An external URL.
4444 External ( Url ) ,
45- /// An app URL.
45+ /// The path portion of an app URL.
46+ /// For instance, to load `tauri://localhost/users/john`,
47+ /// you can simply provide `users/john` in this configuration.
4648 App ( PathBuf ) ,
4749}
4850
@@ -251,7 +253,8 @@ pub struct WindowsConfig {
251253 pub timestamp_url : Option < String > ,
252254 /// Whether to use Time-Stamp Protocol (TSP, a.k.a. RFC 3161) for the timestamp server. Your code signing provider may
253255 /// use a TSP timestamp server, like e.g. SSL.com does. If so, enable TSP by setting to true.
254- pub tsp : Option < bool > ,
256+ #[ serde( default ) ]
257+ pub tsp : bool ,
255258 /// Path to the webview fixed runtime to use.
256259 ///
257260 /// The fixed version can be downloaded [on the official website](https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section).
@@ -274,7 +277,7 @@ impl Default for WindowsConfig {
274277 digest_algorithm : None ,
275278 certificate_thumbprint : None ,
276279 timestamp_url : None ,
277- tsp : None ,
280+ tsp : false ,
278281 webview_fixed_runtime_path : None ,
279282 allow_downgrades : default_allow_downgrades ( ) ,
280283 wix : None ,
@@ -364,19 +367,22 @@ pub struct CliArg {
364367 /// - Using a space such as -o value or --option value
365368 /// - Using an equals and no space such as -o=value or --option=value
366369 /// - Use a short and no space such as -ovalue
367- pub takes_value : Option < bool > ,
370+ #[ serde( default ) ]
371+ pub takes_value : bool ,
368372 /// Specifies that the argument may have an unknown number of multiple values. Without any other settings, this argument may appear only once.
369373 ///
370374 /// For example, --opt val1 val2 is allowed, but --opt val1 val2 --opt val3 is not.
371375 ///
372376 /// NOTE: Setting this requires `takes_value` to be set to true.
373- pub multiple : Option < bool > ,
377+ #[ serde( default ) ]
378+ pub multiple : bool ,
374379 /// Specifies that the argument may appear more than once.
375380 /// For flags, this results in the number of occurrences of the flag being recorded. For example -ddd or -d -d -d would count as three occurrences.
376381 /// For options or arguments that take a value, this does not affect how many values they can accept. (i.e. only one at a time is allowed)
377382 ///
378383 /// For example, --opt val1 --opt val2 is allowed, but --opt val1 val2 is not.
379- pub multiple_occurrences : Option < bool > ,
384+ #[ serde( default ) ]
385+ pub multiple_occurrences : bool ,
380386 /// Specifies how many values are required to satisfy this argument. For example, if you had a
381387 /// `-f <file>` argument where you wanted exactly 3 'files' you would set
382388 /// `number_of_values = 3`, and this argument wouldn't be satisfied unless the user provided
@@ -392,18 +398,19 @@ pub struct CliArg {
392398 /// At runtime, the CLI verifies that only one of the specified values was used, or fails with an error message.
393399 pub possible_values : Option < Vec < String > > ,
394400 /// Specifies the minimum number of values for this argument.
395- /// For example, if you had a -f <file> argument where you wanted at least 2 'files',
401+ /// For example, if you had a -f ` <file>` argument where you wanted at least 2 'files',
396402 /// you would set `minValues: 2`, and this argument would be satisfied if the user provided, 2 or more values.
397403 pub min_values : Option < usize > ,
398404 /// Specifies the maximum number of values are for this argument.
399- /// For example, if you had a -f <file> argument where you wanted up to 3 'files',
405+ /// For example, if you had a -f ` <file>` argument where you wanted up to 3 'files',
400406 /// you would set .max_values(3), and this argument would be satisfied if the user provided, 1, 2, or 3 values.
401407 pub max_values : Option < usize > ,
402408 /// Sets whether or not the argument is required by default.
403409 ///
404410 /// - Required by default means it is required, when no other conflicting rules have been evaluated
405411 /// - Conflicting rules take precedence over being required.
406- pub required : Option < bool > ,
412+ #[ serde( default ) ]
413+ pub required : bool ,
407414 /// Sets an arg that override this arg's required setting
408415 /// i.e. this arg will be required unless this other argument is present.
409416 pub required_unless_present : Option < String > ,
@@ -438,6 +445,7 @@ pub struct CliArg {
438445 /// The index refers to position according to other positional argument.
439446 /// It does not define position in the argument list as a whole. When utilized with multiple=true,
440447 /// only the last positional argument may be defined as multiple (i.e. the one with the highest index).
448+ #[ cfg_attr( feature = "schema" , validate( range( min = 1 ) ) ) ]
441449 pub index : Option < usize > ,
442450}
443451
@@ -792,7 +800,7 @@ impl Default for DisabledCspModificationKind {
792800#[ serde( rename_all = "camelCase" , deny_unknown_fields) ]
793801pub struct SecurityConfig {
794802 /// The Content Security Policy that will be injected on all HTML files on the built application.
795- /// If [`dev_csp`](SecurityConfig.dev_csp ) is not specified, this value is also injected on dev.
803+ /// If [`dev_csp`](# SecurityConfig.devCsp ) is not specified, this value is also injected on dev.
796804 ///
797805 /// This is a really important part of the configuration since it helps you ensure your WebView is secured.
798806 /// See <https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP>.
@@ -1272,7 +1280,7 @@ pub struct ShellAllowlistConfig {
12721280 pub execute : bool ,
12731281 /// Enable sidecar execution, allowing the JavaScript layer to spawn a sidecar command,
12741282 /// an executable that is shipped with the application.
1275- /// For more information see <https://tauri.studio/docs /guides/bundler /sidecar/ >.
1283+ /// For more information see <https://tauri.studio/v1 /guides/building /sidecar>.
12761284 #[ serde( default ) ]
12771285 pub sidecar : bool ,
12781286 /// Open URL with the user's default application.
@@ -1975,7 +1983,6 @@ pub struct UpdaterConfig {
19751983 /// - {{arch}}: The architecture of the machine (one of `x86_64`, `i686`, `aarch64` or `armv7`).
19761984 ///
19771985 /// # Examples
1978- ///
19791986 /// - "https://my.cdn.com/latest.json": a raw JSON endpoint that returns the latest version and download links for each platform.
19801987 /// - "https://updates.app.dev/{{target}}?version={{current_version}}&arch={{arch}}": a dedicated API with positional and query string arguments.
19811988 #[ allow( rustdoc:: bare_urls) ]
@@ -2057,7 +2064,7 @@ fn default_dialog() -> bool {
20572064 true
20582065}
20592066
2060- /// The `dev_path` and `dist_dir` options .
2067+ /// Defines the URL or assets to embed in the application .
20612068#[ derive( Debug , PartialEq , Clone , Deserialize , Serialize ) ]
20622069#[ cfg_attr( feature = "schema" , derive( JsonSchema ) ) ]
20632070#[ serde( untagged, deny_unknown_fields) ]
@@ -2086,10 +2093,26 @@ impl std::fmt::Display for AppUrl {
20862093pub struct BuildConfig {
20872094 /// The binary used to build and run the application.
20882095 pub runner : Option < String > ,
2089- /// The path or URL to use on development.
2096+ /// The path to the application assets or URL to load in development.
2097+ ///
2098+ /// This is usually an URL to a dev server, which serves your application assets
2099+ /// with live reloading. Most modern JavaScript bundlers provides a way to start a dev server by default.
2100+ ///
2101+ /// See [vite](https://vitejs.dev/guide/), [Webpack DevServer](https://webpack.js.org/configuration/dev-server/) and [sirv](https://github.com/lukeed/sirv)
2102+ /// for examples on how to set up a dev server.
20902103 #[ serde( default = "default_dev_path" ) ]
20912104 pub dev_path : AppUrl ,
2092- /// The path to the app's dist dir. This path must contain your index.html file.
2105+ /// The path to the application assets or URL to load in production.
2106+ ///
2107+ /// When a path relative to the configuration file is provided,
2108+ /// it is read recursively and all files are embedded in the application binary.
2109+ /// Tauri then looks for an `index.html` file unless you provide a custom window URL.
2110+ ///
2111+ /// You can also provide a list of paths to be embedded, which allows granular control over what files are added to the binary.
2112+ /// In this case, all files are added to the root and you must reference it that way in your HTML files.
2113+ ///
2114+ /// When an URL is provided, the application won't have bundled assets
2115+ /// and the application will load that URL by default.
20932116 #[ serde( default = "default_dist_dir" ) ]
20942117 pub dist_dir : AppUrl ,
20952118 /// A shell command to run before `tauri dev` kicks in.
@@ -2210,6 +2233,51 @@ impl PackageConfig {
22102233}
22112234
22122235/// The config type mapped to `tauri.conf.json`.
2236+ /// The tauri.conf.json is a file generated by the
2237+ /// [`tauri init`](https://tauri.studio/v1/api/cli#init) command that lives in
2238+ /// your Tauri application source directory (src-tauri). Once generated, you may
2239+ /// modify it at will to customize your Tauri application.
2240+ ///
2241+ /// In addition to the JSON defined on the `tauri.conf.json` file, Tauri can
2242+ /// read a platform-specific configuration from `tauri.linux.conf.json`,
2243+ /// `tauri.windows.conf.json`, and `tauri.macos.conf.json` and merges it with
2244+ /// the main `tauri.conf.json` configuration.
2245+ ///
2246+ /// ```json title="Example tauri.config.json file"
2247+ /// {
2248+ /// "build": {
2249+ /// "beforeBuildCommand": "",
2250+ /// "beforeDevCommand": "",
2251+ /// "devPath": "../dist",
2252+ /// "distDir": "../dist"
2253+ /// },
2254+ /// "package": {
2255+ /// "productName": "tauri-app",
2256+ /// "version": "0.1.0"
2257+ /// },
2258+ /// "tauri": {
2259+ /// "allowlist": {
2260+ /// "all": true
2261+ /// },
2262+ /// // The below `bundle` object has been edited for brevity
2263+ /// "bundle": {...},
2264+ /// "security": {
2265+ /// "csp": null
2266+ /// },
2267+ /// "updater": {
2268+ /// "active": false
2269+ /// },
2270+ /// "windows": [
2271+ /// {
2272+ /// "fullscreen": false,
2273+ /// "height": 600,
2274+ /// "resizable": true,
2275+ /// "title": "Tauri App",
2276+ /// "width": 800
2277+ /// }
2278+ /// ]
2279+ /// }
2280+ /// }
22132281#[ skip_serializing_none]
22142282#[ derive( Debug , Default , PartialEq , Clone , Deserialize , Serialize ) ]
22152283#[ cfg_attr( feature = "schema" , derive( JsonSchema ) ) ]
@@ -2503,14 +2571,14 @@ mod build {
25032571 let name = str_lit ( & self . name ) ;
25042572 let description = opt_str_lit ( self . description . as_ref ( ) ) ;
25052573 let long_description = opt_str_lit ( self . long_description . as_ref ( ) ) ;
2506- let takes_value = opt_lit ( self . takes_value . as_ref ( ) ) ;
2507- let multiple = opt_lit ( self . multiple . as_ref ( ) ) ;
2508- let multiple_occurrences = opt_lit ( self . multiple_occurrences . as_ref ( ) ) ;
2574+ let takes_value = self . takes_value ;
2575+ let multiple = self . multiple ;
2576+ let multiple_occurrences = self . multiple_occurrences ;
25092577 let number_of_values = opt_lit ( self . number_of_values . as_ref ( ) ) ;
25102578 let possible_values = opt_vec_str_lit ( self . possible_values . as_ref ( ) ) ;
25112579 let min_values = opt_lit ( self . min_values . as_ref ( ) ) ;
25122580 let max_values = opt_lit ( self . max_values . as_ref ( ) ) ;
2513- let required = opt_lit ( self . required . as_ref ( ) ) ;
2581+ let required = self . required ;
25142582 let required_unless_present = opt_str_lit ( self . required_unless_present . as_ref ( ) ) ;
25152583 let required_unless_present_all = opt_vec_str_lit ( self . required_unless_present_all . as_ref ( ) ) ;
25162584 let required_unless_present_any = opt_vec_str_lit ( self . required_unless_present_any . as_ref ( ) ) ;
0 commit comments