Skip to content

Commit 346a420

Browse files
docs: improve resources docs (#14136)
* docs: improve resources docs * Clippy
1 parent 5239d39 commit 346a420

File tree

5 files changed

+158
-90
lines changed

5 files changed

+158
-90
lines changed

crates/tauri-cli/config.schema.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@
495495
]
496496
},
497497
"incognito": {
498-
"description": "Whether or not the webview should be launched in incognito mode.\n\n ## Platform-specific:\n\n - **Android**: Unsupported.",
498+
"description": "Whether or not the webview should be launched in incognito mode.\n\n ## Platform-specific:\n\n - **Android**: Unsupported.",
499499
"default": false,
500500
"type": "boolean"
501501
},
@@ -2071,7 +2071,7 @@
20712071
}
20722072
},
20732073
"resources": {
2074-
"description": "App resources to bundle.\n Each resource is a path to a file or directory.\n Glob patterns are supported.",
2074+
"description": "App resources to bundle.\n Each resource is a path to a file or directory.\n Glob patterns are supported.\n\n ## Examples\n\n To include a list of files:\n\n ```json\n {\n \"bundle\": {\n \"resources\": [\n \"./path/to/some-file.txt\",\n \"/absolute/path/to/textfile.txt\",\n \"../relative/path/to/jsonfile.json\",\n \"some-folder/\",\n \"resources/**/*.md\"\n ]\n }\n }\n ```\n\n The bundled files will be in `$RESOURCES/` with the original directory structure preserved,\n for example: `./path/to/some-file.txt` -> `$RESOURCE/path/to/some-file.txt`\n\n To fine control where the files will get copied to, use a map instead\n\n ```json\n {\n \"bundle\": {\n \"resources\": {\n \"/absolute/path/to/textfile.txt\": \"resources/textfile.txt\",\n \"relative/path/to/jsonfile.json\": \"resources/jsonfile.json\",\n \"resources/\": \"\",\n \"docs/**/*md\": \"website-docs/\"\n }\n }\n }\n ```\n\n Note that when using glob pattern in this case, the original directory structure is not preserved,\n everything gets copied to the target directory directly\n\n See more: <https://v2.tauri.app/develop/resources/>",
20752075
"anyOf": [
20762076
{
20772077
"$ref": "#/definitions/BundleResources"
@@ -2921,7 +2921,7 @@
29212921
]
29222922
},
29232923
"installerHooks": {
2924-
"description": "A path to a `.nsh` file that contains special NSIS macros to be hooked into the\n main installer.nsi script.\n\n Supported hooks are:\n - `NSIS_HOOK_PREINSTALL`: This hook runs before copying files, setting registry key values and creating shortcuts.\n - `NSIS_HOOK_POSTINSTALL`: This hook runs after the installer has finished copying all files, setting the registry keys and created shortcuts.\n - `NSIS_HOOK_PREUNINSTALL`: This hook runs before removing any files, registry keys and shortcuts.\n - `NSIS_HOOK_POSTUNINSTALL`: This hook runs after files, registry keys and shortcuts have been removed.\n\n\n ### Example\n\n ```nsh\n !macro NSIS_HOOK_PREINSTALL\n MessageBox MB_OK \"PreInstall\"\n !macroend\n\n !macro NSIS_HOOK_POSTINSTALL\n MessageBox MB_OK \"PostInstall\"\n !macroend\n\n !macro NSIS_HOOK_PREUNINSTALL\n MessageBox MB_OK \"PreUnInstall\"\n !macroend\n\n !macro NSIS_HOOK_POSTUNINSTALL\n MessageBox MB_OK \"PostUninstall\"\n !macroend\n\n ```",
2924+
"description": "A path to a `.nsh` file that contains special NSIS macros to be hooked into the\n main installer.nsi script.\n\n Supported hooks are:\n\n - `NSIS_HOOK_PREINSTALL`: This hook runs before copying files, setting registry key values and creating shortcuts.\n - `NSIS_HOOK_POSTINSTALL`: This hook runs after the installer has finished copying all files, setting the registry keys and created shortcuts.\n - `NSIS_HOOK_PREUNINSTALL`: This hook runs before removing any files, registry keys and shortcuts.\n - `NSIS_HOOK_POSTUNINSTALL`: This hook runs after files, registry keys and shortcuts have been removed.\n\n ### Example\n\n ```nsh\n !macro NSIS_HOOK_PREINSTALL\n MessageBox MB_OK \"PreInstall\"\n !macroend\n\n !macro NSIS_HOOK_POSTINSTALL\n MessageBox MB_OK \"PostInstall\"\n !macroend\n\n !macro NSIS_HOOK_PREUNINSTALL\n MessageBox MB_OK \"PreUnInstall\"\n !macroend\n\n !macro NSIS_HOOK_POSTUNINSTALL\n MessageBox MB_OK \"PostUninstall\"\n !macroend\n ```",
29252925
"type": [
29262926
"string",
29272927
"null"

crates/tauri-schema-generator/schemas/config.schema.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@
495495
]
496496
},
497497
"incognito": {
498-
"description": "Whether or not the webview should be launched in incognito mode.\n\n ## Platform-specific:\n\n - **Android**: Unsupported.",
498+
"description": "Whether or not the webview should be launched in incognito mode.\n\n ## Platform-specific:\n\n - **Android**: Unsupported.",
499499
"default": false,
500500
"type": "boolean"
501501
},
@@ -2071,7 +2071,7 @@
20712071
}
20722072
},
20732073
"resources": {
2074-
"description": "App resources to bundle.\n Each resource is a path to a file or directory.\n Glob patterns are supported.",
2074+
"description": "App resources to bundle.\n Each resource is a path to a file or directory.\n Glob patterns are supported.\n\n ## Examples\n\n To include a list of files:\n\n ```json\n {\n \"bundle\": {\n \"resources\": [\n \"./path/to/some-file.txt\",\n \"/absolute/path/to/textfile.txt\",\n \"../relative/path/to/jsonfile.json\",\n \"some-folder/\",\n \"resources/**/*.md\"\n ]\n }\n }\n ```\n\n The bundled files will be in `$RESOURCES/` with the original directory structure preserved,\n for example: `./path/to/some-file.txt` -> `$RESOURCE/path/to/some-file.txt`\n\n To fine control where the files will get copied to, use a map instead\n\n ```json\n {\n \"bundle\": {\n \"resources\": {\n \"/absolute/path/to/textfile.txt\": \"resources/textfile.txt\",\n \"relative/path/to/jsonfile.json\": \"resources/jsonfile.json\",\n \"resources/\": \"\",\n \"docs/**/*md\": \"website-docs/\"\n }\n }\n }\n ```\n\n Note that when using glob pattern in this case, the original directory structure is not preserved,\n everything gets copied to the target directory directly\n\n See more: <https://v2.tauri.app/develop/resources/>",
20752075
"anyOf": [
20762076
{
20772077
"$ref": "#/definitions/BundleResources"
@@ -2921,7 +2921,7 @@
29212921
]
29222922
},
29232923
"installerHooks": {
2924-
"description": "A path to a `.nsh` file that contains special NSIS macros to be hooked into the\n main installer.nsi script.\n\n Supported hooks are:\n - `NSIS_HOOK_PREINSTALL`: This hook runs before copying files, setting registry key values and creating shortcuts.\n - `NSIS_HOOK_POSTINSTALL`: This hook runs after the installer has finished copying all files, setting the registry keys and created shortcuts.\n - `NSIS_HOOK_PREUNINSTALL`: This hook runs before removing any files, registry keys and shortcuts.\n - `NSIS_HOOK_POSTUNINSTALL`: This hook runs after files, registry keys and shortcuts have been removed.\n\n\n ### Example\n\n ```nsh\n !macro NSIS_HOOK_PREINSTALL\n MessageBox MB_OK \"PreInstall\"\n !macroend\n\n !macro NSIS_HOOK_POSTINSTALL\n MessageBox MB_OK \"PostInstall\"\n !macroend\n\n !macro NSIS_HOOK_PREUNINSTALL\n MessageBox MB_OK \"PreUnInstall\"\n !macroend\n\n !macro NSIS_HOOK_POSTUNINSTALL\n MessageBox MB_OK \"PostUninstall\"\n !macroend\n\n ```",
2924+
"description": "A path to a `.nsh` file that contains special NSIS macros to be hooked into the\n main installer.nsi script.\n\n Supported hooks are:\n\n - `NSIS_HOOK_PREINSTALL`: This hook runs before copying files, setting registry key values and creating shortcuts.\n - `NSIS_HOOK_POSTINSTALL`: This hook runs after the installer has finished copying all files, setting the registry keys and created shortcuts.\n - `NSIS_HOOK_PREUNINSTALL`: This hook runs before removing any files, registry keys and shortcuts.\n - `NSIS_HOOK_POSTUNINSTALL`: This hook runs after files, registry keys and shortcuts have been removed.\n\n ### Example\n\n ```nsh\n !macro NSIS_HOOK_PREINSTALL\n MessageBox MB_OK \"PreInstall\"\n !macroend\n\n !macro NSIS_HOOK_POSTINSTALL\n MessageBox MB_OK \"PostInstall\"\n !macroend\n\n !macro NSIS_HOOK_PREUNINSTALL\n MessageBox MB_OK \"PreUnInstall\"\n !macroend\n\n !macro NSIS_HOOK_POSTUNINSTALL\n MessageBox MB_OK \"PostUninstall\"\n !macroend\n ```",
29252925
"type": [
29262926
"string",
29272927
"null"

crates/tauri-utils/src/config.rs

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -908,12 +908,12 @@ pub struct NsisConfig {
908908
/// main installer.nsi script.
909909
///
910910
/// Supported hooks are:
911+
///
911912
/// - `NSIS_HOOK_PREINSTALL`: This hook runs before copying files, setting registry key values and creating shortcuts.
912913
/// - `NSIS_HOOK_POSTINSTALL`: This hook runs after the installer has finished copying all files, setting the registry keys and created shortcuts.
913914
/// - `NSIS_HOOK_PREUNINSTALL`: This hook runs before removing any files, registry keys and shortcuts.
914915
/// - `NSIS_HOOK_POSTUNINSTALL`: This hook runs after files, registry keys and shortcuts have been removed.
915916
///
916-
///
917917
/// ### Example
918918
///
919919
/// ```nsh
@@ -932,7 +932,6 @@ pub struct NsisConfig {
932932
/// !macro NSIS_HOOK_POSTUNINSTALL
933933
/// MessageBox MB_OK "PostUninstall"
934934
/// !macroend
935-
///
936935
/// ```
937936
#[serde(alias = "installer-hooks")]
938937
pub installer_hooks: Option<PathBuf>,
@@ -1286,6 +1285,47 @@ pub struct BundleConfig {
12861285
/// App resources to bundle.
12871286
/// Each resource is a path to a file or directory.
12881287
/// Glob patterns are supported.
1288+
///
1289+
/// ## Examples
1290+
///
1291+
/// To include a list of files:
1292+
///
1293+
/// ```json
1294+
/// {
1295+
/// "bundle": {
1296+
/// "resources": [
1297+
/// "./path/to/some-file.txt",
1298+
/// "/absolute/path/to/textfile.txt",
1299+
/// "../relative/path/to/jsonfile.json",
1300+
/// "some-folder/",
1301+
/// "resources/**/*.md"
1302+
/// ]
1303+
/// }
1304+
/// }
1305+
/// ```
1306+
///
1307+
/// The bundled files will be in `$RESOURCES/` with the original directory structure preserved,
1308+
/// for example: `./path/to/some-file.txt` -> `$RESOURCE/path/to/some-file.txt`
1309+
///
1310+
/// To fine control where the files will get copied to, use a map instead
1311+
///
1312+
/// ```json
1313+
/// {
1314+
/// "bundle": {
1315+
/// "resources": {
1316+
/// "/absolute/path/to/textfile.txt": "resources/textfile.txt",
1317+
/// "relative/path/to/jsonfile.json": "resources/jsonfile.json",
1318+
/// "resources/": "",
1319+
/// "docs/**/*md": "website-docs/"
1320+
/// }
1321+
/// }
1322+
/// }
1323+
/// ```
1324+
///
1325+
/// Note that when using glob pattern in this case, the original directory structure is not preserved,
1326+
/// everything gets copied to the target directory directly
1327+
///
1328+
/// See more: <https://v2.tauri.app/develop/resources/>
12891329
pub resources: Option<BundleResources>,
12901330
/// A copyright string associated with your application.
12911331
pub copyright: Option<String>,
@@ -1743,9 +1783,9 @@ pub struct WindowConfig {
17431783
pub window_effects: Option<WindowEffectsConfig>,
17441784
/// Whether or not the webview should be launched in incognito mode.
17451785
///
1746-
/// ## Platform-specific:
1786+
/// ## Platform-specific:
17471787
///
1748-
/// - **Android**: Unsupported.
1788+
/// - **Android**: Unsupported.
17491789
#[serde(default)]
17501790
pub incognito: bool,
17511791
/// Sets the window associated with this label to be the parent of the window to be created.

0 commit comments

Comments
 (0)