sweep-unused
v1.0.4
Published
remove unused dependencies by analyzing your source code
Maintainers
Readme
sweep-unused
A CLI tool that analyzes your codebase for unused dependencies and automatically removes them. Ideal for keeping package.json and node_modules clutter-free.
Features
- Code Analysis: Uses depcheck to find unused imports
- Two Modes:
- Interactive: Prompts for confirmation before removing
- Auto: Removes dependencies without asking
- Local or CI usage: Can be run in a pre-install hook or as part of a CI pipeline
Installation
Install globally using npm:
npm install -g sweep-unusedUsage
Run sweep-unused from any project directory:
Interactive Mode
sweep-unusedThis scans your project for unused dependencies, lists them, and asks if you want to remove them.
Auto Mode
sweep-unused --autoNo prompt; it immediately removes all detected unused dependencies.
Package Scripts
Add a script in your package.json:
{
"scripts": {
"sweep": "sweep-unused --auto"
}
}Then run:
npm run sweepContributing
Contributions are welcome! Feel free to open issues or submit pull requests on our GitHub repository:
https://github.com/sohei1l/sweep-unused
License
MIT
