package-ghost
v1.0.0
Published
Find npm packages that are installed but never imported
Maintainers
Readme
package-ghost
Find npm packages that are installed but never imported in your code.
Install
npm install -g package-ghost
Usage
cd your-project package-ghost
Options
package-ghost [directory] Scan directory (default: current) package-ghost --clean Remove unused packages automatically package-ghost --help Show help
Examples
Scan current project: package-ghost
Scan specific project: package-ghost ./my-app
Remove unused packages: package-ghost --clean
What it does
- Scans all .js, .ts, .jsx, .tsx files in your project
- Extracts all require() and import statements
- Compares with dependencies in package.json
- Shows which packages are:
- Used ✓
- Unused ✗ (can be removed)
- Missing ? (imported but not installed)
Output Example
┌─────────────────────────────────────────────┐ │ PACKAGE GHOST REPORT │ └─────────────────────────────────────────────┘
Files scanned: 42
✅ Used packages (8): ✓ express ✓ dotenv ✓ chalk
👻 Unused packages (3): ✗ lodash ✗ axios ✗ moment
💡 Remove unused packages: npm uninstall lodash axios moment
⚠️ Missing packages (1): ? helmet
💡 Install missing packages: npm install helmet
Credits
GreenBMGO
License
MIT
