-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add a new option to remove unused commands #12890
base: dev
Are you sure you want to change the base?
feat: add a new option to remove unused commands #12890
Conversation
Package Changes Through a9dead4There are 11 changes which include tauri with minor, @tauri-apps/api with minor, tauri-runtime-wry with minor, tauri-bundler with patch, tauri-cli with minor, @tauri-apps/cli with patch, tauri-build with minor, tauri-codegen with minor, tauri-macros with minor, tauri-plugin with minor, tauri-utils with minor Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
Hi @Legend-Master (I stumbled upon this PR 😇). Can we implement this feature in Sometimes I only use ref: #4670 (comment)
|
I have tried it first before this and unfortunately since we can't run the build script before all the macros in plugins, it's not really viable I could expose the command for generating the used commands though so that you can run it first and then exposing it to the environment manually |
In some cases, we don't even have
Can we set an environment variable pointing to the This way, we wouldn't need to rely on When I want to enable this feature, I will manually set this environment variable pointing to the (I'm not very familiar with this part of Tauri, so my idea might be wrong) |
I would also like to make those features not relying on the tauri cli if possible
Actually good idea, I'll give it a try when I got time, but instead of doing it in the macro, I think in plugins's build script should be better? (I'll see when I get there) My current approach is not that great as it relies on the build scripts to generate the acl manifest first, so definitely something I would like to improve as well
To be honest, I'm not very familiar with acl and macro related things either, so any suggestion would be much appreciated |
Reference: #12820 (comment)
Introducing a new CLI option
--remove-unused-commands
onbuild
command to pass in an environment variable to let the build script oftauri-plugin
andtauri
to generate a list of allowed commands from the ACL, this will then be used by thegenerate_handler
macro to remove unused commandsNote: this won't be accounting for dynamically added ACLs so make sure to check it when using this
Note: didn't do this for
tauri-build
yet, so inlined plugins and the app'sgenerate_handler
won't be affected yetSome results:
helloworld
example in the repo gone from 3.92 MB to 1.91 MB on Windows (it doesn't use any plugin commands, so the improvement is quite big, also the basic executable contains theimage
dependency, it's around 2.67 MB if that's removed, but still a great improvement!)