Find and delete all node_module folders
npm install node-modules-cleanup!Logo of node-modules-cleanup!
A simple CLI to bulk remove node_modules folders and free up some of that precious disk space.
---
⭐️ Usage • Examples • Arguments • Development ⭐️
---
``bash`
npx node-modules-cleanup@latest
`bashFind all node_modules in the current directory
npx node-modules-cleanup@latest ./
📝 Arguments
| Argument | Description | Required |
| --------------------- | ---------------------------------------------------------- | -------- |
|
| The path to search for node_modules folders | Yes |
| --skip-confirmation | Skip confirmation before deleting folders | No |
| --dry | Dry run of the cleanup process, no folders will be deleted | No |
| --help | Show help information | No |
| --version | Show package version | No |💻 Development
$3
This project is built with Bun, to install it run the following command:
`bash
curl -fsSL https://bun.sh/install | bash
`$3
To install the dependencies, run the following command:
`bash
bun install
`$3
For easier development a script is available that will generate multiple mocked
node_modules folders inside of the ./mock folder. The number of folders, files, and their names are randomized to simulate real-world scenarios.`bash
Generate a simple set of mocked folders (default, ~1s cleanup time)
bun run create-mocksGenerate a complex set of mocked folders (~7s cleanup time)
bun run create-mocks -- --mode=complex
`$3
The following command will then execute the script.
`bash
bun run dev ./mock # Or any other path
`$3
`bash
bun run dev # Runs the script
bun run test # Runs the test suite
bun run unused-code-check # Check for unused code
bun run lint # Run ESLint
bun run tsc # Runs TypeScript checks
bun run build # Builds the package
``