depclear-cli
v0.1.0
Published
Find unused and missing dependencies in your Node.js project. Zero-dependency, CI-friendly, low false positives.
Maintainers
Readme
depclear
Find unused and missing dependencies in your Node.js project. Zero-dependency, CI-friendly, low false positives.
depclear is the maintained successor to the abandoned depcheck (archived June 2025, 1.4M+ weekly downloads) for simple projects — without the complexity of knip. It statically analyzes your source, config files, and npm scripts to find:
- Unused — dependencies declared in
package.jsonbut never referenced - Missing — packages referenced in code but not declared
Why another tool?
depcheck was archived in June 2025. It still gets 1.4M+ weekly downloads because nothing simple replaced it. knip is excellent but TypeScript-heavy, monorepo-focused, and needs configuration. If you have a plain Node.js project and just want to know what's unused and what's missing — with zero setup and zero dependencies — this is that tool.
Why low false positives
The #1 complaint about dependency scanners is false positives from legitimate usage the analyzer doesn't understand. depclear handles the cases that break naive scanners:
| Usage | Handled |
|-------|---------|
| require('x'), import x from 'x', import('x'), export ... from 'x' | ✅ |
| Subpath imports (pkg/sub/path) | ✅ |
| Scoped packages (@scope/pkg) | ✅ |
| Node built-ins (fs, path, node:http) | ✅ (never flagged) |
| CLI tools invoked in npm scripts ("build": "webpack") | ✅ |
| Plugins/loaders in config files (webpack, jest, eslint, babel, tailwind, vite, rollup, next) | ✅ |
| @types/* packages | ✅ (only flagged when TS files present) |
| Dynamic requires (require(var)) | ⚠ known limitation |
Install
# Use immediately
npx depclear-cli
# Install globally
npm install -g depclear-cli
# Add as dev dependency
npm install --save-dev depclear-cliZero runtime dependencies. Node.js 18+.
Usage
# Check the current directory
depclear
# Check a specific directory
depclear ./my-app
# Machine-readable output
depclear --json
# One-line summary for CI
depclear --summary
# Skip devDependencies
depclear --no-devExit codes (CI-friendly)
| Code | Meaning | |------|---------| | 0 | No issues found | | 1 | Issues found (unused or missing dependencies) | | 2 | Error (package.json not found, invalid arguments) |
Example output
depclear — ./my-app
──────────────────────────────────────────────────
Scanned 47 files · 12 packages used
✗ 2 unused dependencies:
dependencies:
• moment
• request
⚠ 1 missing dependency:
(used in source but not listed in package.json)
• axios
──────────────────────────────────────────────────
Found: 2 unused, 1 missingCI integration
# GitHub Actions
- name: Check dependencies
run: npx depclear --summary{
"scripts": {
"check-deps": "depclear",
"check-deps:ci": "depclear --summary"
}
}API
const { scan } = require('depclear');
const result = await scan('/path/to/project');
// { unused: [{ name, category }], missing: [...], summary: {...} }Development
npm test # 11 tests, zero test depsLicense
MIT © Faizan
