@tofrankie/clean
v0.0.3
Published
Clean node_modules, dist and tool cache files
Downloads
294
Maintainers
Readme
@tofrankie/clean
Clean node_modules, dist and tool cache files (e.g. eslint/stylelint/prettier/turbo/tsbuildinfo). Support for pnpm monorepos.
Installation
Requires Node.js >= 18
Global install is recommended:
$ pnpm add @tofrankie/clean -gCommands
clean modules: remove dependency directoriesnode_modulesclean dist: remove build output directoriesdistclean cache: remove cache files
# Clean node_modules, dist, and caches
$ clean --all
# Preview paths that would be deleted (no deletion)
$ clean --all --dry-run
# Only clean node_modules
$ clean modules
# Only clean dist
$ clean dist
# Only clean caches
$ clean cacheShortcut binaries:
clean-modules→clean modulesclean-dist→clean distclean-cache→clean cacheclean-all→clean --all
Notes:
- Usually you run cleanup next to
package.json. You can also run it from a subdirectory; the tool walks up to the nearestpackage.jsonand cleans from there. - For pnpm monorepos, add
-ror--recursiveto recurse into workspace packages.
Options
--cwd <path>: set the project directory (not recommended—risk of deleting the wrong files)--root: walk up to the workspace root, then run (for monorepos)--all: run modules + dist + cache (when no subcommand is given)--dry-run: print matched paths and counts (deletable/skipped) only; no deletion--print-forbidden-dirs: print directories that must not be deleted (including the current user’s home) and exit--recursive/-r: recurse (per subcommand above); withclean --all, applies to modules and dist target collection--no-modules: do not removenode_modulesdirectories--no-dist: do not removedistdirectories--no-cache: do not remove caches--no-eslint: do not remove eslint caches--no-stylelint: do not remove stylelint caches--no-prettier: do not remove prettier caches--no-turbo: do not remove turbo caches--no-ts-build-info: do not remove tsbuildinfo-related caches--module-target <target>: append extranode_modulesdelete targets (repeatable; comma-separated in one value, e.g.a,b)--dist-target <target>: append extradistdelete targets (repeatable; comma-separated in one value, e.g.build,dist)--cache-target <target>: append extra cache delete targets (repeatable; comma-separated in one value)
License
MIT
