You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add a new option to remove unused commands (#12890)
* Add a new option to remove unused commands
* Fix compile
* Add markers to all core plugins
* Clippy
* Add allow unused when running with this
* Use build script to generate allowed-commands.json
* Clean up and add proper reruns
* Wrong path
* Revert to #[cfg_attr(not(debug_assertions), allow(unused))]
* Add change files
* Some more docs
* Add version requirement note
* Avoid rerun if no capabilities folder
* Remove unused box
* small cleanup
* fix channel
* implement for app handler too
* rely on core:default for channel perms
* Move this feature to config
* Docs change
* Forget one last remove_unused_commands
* Remove removeUnusedCommands from helloworld
* tell handler that the app ACL manifest exists
* update change file
* update doc
* update change file
* Use a struct to pass the data instead of env var
* Clippy
* Fix can't exclude inlined plugins on Windows
due to UNC paths...
* Apply suggestion from code review
* Remove remove on empty to tauri-build
* Revert "Remove remove on empty to tauri-build"
This reverts commit b727dd6.
* Centralize remove_file(allowed_commands_file_path)
* Escape glob pattern
* update change file
* remove unused commands for dev too
* Update crates/tauri-utils/src/config.rs
Co-authored-by: Fabian-Lars <github@fabianlars.de>
* regen schema
---------
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Co-authored-by: Fabian-Lars <github@fabianlars.de>
Reads `build > removeUnusedCommands` from the config file and pass in the environment variables on the build command to trigger the build scripts and macros to remove unused commands based on the capabilities you defined. For this to work on inlined plugins you must add a `#![plugin(<insert_plugin_name>)]` inside the `tauri::generate_handler![]` usage and the app manifest must be set.
Added `build > removeUnusedCommands` to trigger the build scripts and macros to remove unused commands based on the capabilities you defined. Note this won't be accounting for dynamically added ACLs so make sure to check it when using this.
Copy file name to clipboardExpand all lines: crates/tauri-cli/config.schema.json
+8-1Lines changed: 8 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -69,7 +69,9 @@
69
69
},
70
70
"build": {
71
71
"description": "The build configuration.",
72
-
"default": {},
72
+
"default": {
73
+
"removeUnusedCommands": false
74
+
},
73
75
"allOf": [
74
76
{
75
77
"$ref": "#/definitions/BuildConfig"
@@ -1797,6 +1799,11 @@
1797
1799
"items": {
1798
1800
"type": "string"
1799
1801
}
1802
+
},
1803
+
"removeUnusedCommands": {
1804
+
"description": "Try to remove unused commands registered from plugins base on the ACL list during `tauri build`,\n the way it works is that tauri-cli will read this and set the environment variables for the build script and macros,\n and they'll try to get all the allowed commands and remove the rest\n\n Note:\n - This won't be accounting for dynamically added ACLs so make sure to check it when using this\n - This feature requires tauri-plugin 2.1 and tauri 2.4",
Copy file name to clipboardExpand all lines: crates/tauri-cli/src/build.rs
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -182,7 +182,7 @@ pub fn setup(
182
182
returnErr(anyhow::anyhow!(
183
183
"The configured frontendDist includes the `{:?}` {}. Please isolate your web assets on a separate folder and update `tauri.conf.json > build > frontendDist`.",
184
184
out_folders,
185
-
if out_folders.len() == 1{"folder"}else {"folders"}
185
+
if out_folders.len() == 1{"folder"}else {"folders"}
0 commit comments