-
Notifications
You must be signed in to change notification settings - Fork 15
ModClean can be installed globally, which will provide access to the CLI Utility. The provided CLI allows you to run ModClean without needing to write any code. Most of the configuration options from the programmatic API are available as options/flags.
npm install -g modclean
modclean [-tsPevfrkml] [-p, --path=string] [-D, --modules-dir=string] [-n, --patterns=list] [-a, --additional-patterns=list] [-I, --ignore=list]
Provide a different path to run ModClean in. By default, it uses process.cwd()
. The path must be in a directory that contains a node_modules
directory.
Change the default modules directory name. Default is node_modules
.
Specify which pattern plugins/rules to use. Separate multiple groups by a single comma (no spaces). Default is default:safe
.
Example: modclean -n default:safe,default:caution
Specify custom glob patterns to be included in the search.
Example: modclean --additional-patterns="*history,*.html,.config"
Comma-separated list of glob patterns to ignore during cleaning. Useful when a pattern matches a module name you do not want removed.
Example: modclean --ignore="validate-npm-package-license,*history*"
Run in test mode which will do everything ModClean does except delete the files. It's good practice to run this first to analyze the files that will be deleted.
When files are searched, they are searched using case sensitive matching. (ex. README.md
pattern would not match readme.md
files)
Turns off the progress bar when files are being deleted.
Do not delete directories, only files.
Exclude dot files from being deleted.
Exclude empty directories from being deleted.
Whether to halt the process when an error is encountered. The process is only halted when there is an issue deleting a file due to permissions or some other catastrophic issue.
Runs in verbose mode. This will display much more information during the process.
Clean symlinked packages as well.
Force deletion of modules that are matched by the patterns.
Run the utility immediately without displaying the warning.
Show help/usage screen.
Display the version of ModClean that is installed.
Run with default options:
$ modclean
Run with custom patterns and ignore lists:
$ modclean --patterns="default:safe,default:caution" --additional-patterns="*.xls?(x),*.ppt?(x),*.rtf" --ignore="validate-npm-license,readme*"
Run in a different cwd:
$ modclean -p /path/to/app
Run with different modules folder name (ex. Bower):
$ modclean -D components
Run all patterns in test mode:
$ modclean -t --patterns="default:*"
Run with various options:
$ modclean -kem --no-dotfiles
Information:
Wiki Home
Migrating to 3.x
Migrating to 2.x
Benchmarks
Custom Pattern Plugins
Documentation (v3):
CLI Documentation
API Documentation
Documentation (v2):
CLI Documentation
API Documentation