devclean
is a tool and library for cleaning up development directories.
- Node.js
node_modules
- Rust
target
I currently only support Node.js and Rust projects as these are the languages that contribute the most to my disk usage.
If you would like to see support for other languages, please open an issue or a PR.
It's very easy to add support for another language.
Look at examples in devclean/src/predicates/languages/node.rs and devclean/src/predicates/languages/rust.rs
Implement the 4 traits for a language predicate struct
LanguagePredicate
- Check whether the current path is in a project of this language.
- e.g. Check if parent dir has a
package.json
Removable
- Check if the current path is removable
- e.g. Check if the current path is a
node_modules
directory
Stop
- Check if path traversal should stop
- e.g. Stop scanning if the current path is a
node_modules
directory
Reportable
- Sometimes we don't want to remove a directory. This trait is designed as a wrapper layer over
Removable
. If the currently feature is trying to find removable directories to clean, reportable simply callsis_removable
fromRemovable
. In the scanner,Reportable
is used to determine whether to report the directory as one of the results. - For other features like
find-dirty-git
, reportable means the directory should be reported as a dirty git repo.
- Sometimes we don't want to remove a directory. This trait is designed as a wrapper layer over
The GUI App can be found in the releases.
cargo install devclean
Before removing a directory, it is important to check if there are any uncommitted changes in the directory. This feature finds all git repositories with uncommitted changes.
devclean find-dirty-git <path>
❯ devclean find-dirty-git ..
⠁ Scanning: /Users/xxx/Dev/projects/devclean
Path | Depth | Size
-------------------------------------+-------+---------
/Users/xxx/Dev/projects/devclean | 0 | 1.3 GiB
Code projects can have large cache and dependency directories that can be cleaned up to save disk space.
- Node.js
node_modules
- Rust
target
devclean <path>
devclean <path> --dry-run # Won't remove anything
devclean <path> --all # Select all found directories by default
devclean <path> -y # Skip confirmation
devclean <path> -t # Time Scanning and Cleaning