Supports all Melos filtering flags.
This command cleans the current workspace and all its packages of temporary pub & generated Melos IDE files.
These files include;
This can be useful to give your workspace a 'fresh start', e.g.;
melos clean melos bootstrap
Combining with filters#
Clean supports all package filtering options, therefore if you wanted to you could clean only a specific subset of your packages, for example:
# Only clean Flutter packages or apps. melos clean --flutter
Adding a postclean lifecycle script#
Melos supports various command lifecycle hooks that can be defined in your
For example, if you needed to cleanup any generated files, e.g. from a build
runner, automatically after
melos clean is ran, you can add a
# melos.yaml # ... command: clean: hooks: post: rm packages/foo/lib/src/generated_file.g.dart # ...
Another common use case is to run
flutter clean in all Flutter packages;
# melos.yaml # ... command: clean: hooks: # Runs "flutter clean" in all Flutter packages (`--flutter`) # with a concurrency of 3 at a time (`--concurrency=3`). post: melos exec --flutter --concurrency=3 -- "flutter clean" # ...