Package Exports
- npm-uninstall-unused
- npm-uninstall-unused/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (npm-uninstall-unused) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
npm-uninstall-unused
A CLI tool to detect and uninstall unused npm dependencies from your Node.js project. Perfect for both single projects and monorepos!
Status
Why use this?
Have you ever:
- Wondered which npm packages are just sitting in your
package.json
unused? - Wanted to clean up your project but were afraid of breaking things?
- Struggled with managing dependencies in a monorepo?
This tool helps you identify and safely remove unused dependencies, making your project cleaner and more maintainable.
Features
- Scans for unused dependencies and devDependencies
- Works with both single projects and monorepos
- Supports nested package.json files
- Fast uninstallation with --no-audit flag
- Beautiful colored output
- Interactive confirmation before uninstalling
Installation
# Install globally
npm install -g npm-uninstall-unused
# Or use npx (no installation needed)
npx npm-uninstall-unused
Usage
Simply run the command in your project directory:
npm-uninstall-unused
The tool will:
- Scan all package.json files in the current directory and subdirectories
- Show you unused dependencies and devDependencies
- Ask for confirmation before uninstalling
- Remove the unused packages
Options
--ci
: Run in CI mode (skips confirmation prompts)--no-audit
: Skip npm audit (faster uninstallation)
Examples
# Basic usage
npm-uninstall-unused
# Run in CI mode
CI=true npm-uninstall-unused
# Skip audit
npm-uninstall-unused --no-audit
How it works
- The tool uses
depcheck
to scan your project for unused dependencies - It recursively finds all package.json files in your project
- For each package.json, it:
- Checks for unused dependencies
- Checks for unused devDependencies
- Shows the results
- Asks for confirmation
- Uninstalls if confirmed
Contributing
Found a bug? Have a feature request? Feel free to open an issue or submit a pull request!
License
MIT - Feel free to use this tool however you want!
Made with ❤️ by Shivanshu Pathak