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
pgear-wd edited this page Dec 14, 2021
·
2 revisions
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.
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.
-D, --modules-dir [string]
Change the default modules directory name. Default is node_modules.
-n, --patterns [list]
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
-a, --additional-patterns [list]
Specify custom glob patterns to be included in the search.
Example: modclean --additional-patterns="*history,*.html,.config"
-I, --ignore [list]
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*"
Flags
-t, --test
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.
-s, --case-sensitive
When files are searched, they are searched using case sensitive matching. (ex. README.md pattern would not match readme.md files)
-P, --no-progress
Turns off the progress bar when files are being deleted.
--no-dirs
Do not delete directories, only files.
--no-dotfiles
Exclude dot files from being deleted.
-k, --keep-empty
Exclude empty directories from being deleted.
-e, --error-halt
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.
-v, --verbose
Runs in verbose mode. This will display much more information during the process.
-f, --follow-symlink
Clean symlinked packages as well.
-m, --modules
Force deletion of modules that are matched by the patterns.
-r, --run
Run the utility immediately without displaying the warning.
-h, --help
Show help/usage screen.
-V, --version
Display the version of ModClean that is installed.