Detect abandoned npm dependencies — health scores, dependency tree analysis, CLI, and GitHub Action. Zero runtime deps.
- Detect abandoned dependencies (configurable threshold, default: 730 days)
- Dependency Tree Analysis: Visualize and analyze the abandonment status of your entire dependency tree, including transitive dependencies
- Custom registry support for private or alternative npm registries
- Health score calculation with letter grade (A-F)
- Multiple output formats (text, JSON, markdown)
- Cache support for reduced registry requests
- Circular dependency detection
- Zero runtime dependencies
bash
npm install @adametherzlab/dep-age
bun add @adametherzlab/dep-age
pnpm add @adametherzlab/dep-age
npx @adametherzlab/dep-age
bash
npx @adametherzlab/dep-age
npx @adametherzlab/dep-age --tree
npx @adametherzlab/dep-age --tree --tree-depth 3
npx @adametherzlab/dep-age --threshold 365 --format markdown
npx @adametherzlab/dep-age --score-only
npx @adametherzlab/dep-age --abandoned-only
import { scanDependencies, scanDependencyTree, summarizeTree, formatTree, calculateHealthScore, generateReport, createAbandonmentThreshold, } from '@adametherzlab/dep-age';
// Scan direct dependencies const results = await scanDependencies({ packageJsonPath: './package.json', abandonmentThreshold: createAbandonmentThreshold(365), });
// Calculate health score
const health = calculateHealthScore(results);
console.log(Health: ${health.score}/100 (${health.grade}));
// Generate a report const report = generateReport(results, { format: 'markdown' }); console.log(report);
// Analyze full dependency tree const tree = await scanDependencyTree({ packageJsonPath: './package.json', maxDepth: 3, abandonmentThreshold: createAbandonmentThreshold(365), });
const summary = summarizeTree(tree);
console.log(Tree health: ${summary.healthScore}/100 (${summary.grade}));
console.log(${summary.totalPackages} total, ${summary.uniquePackages} unique, ${summary.abandonedCount} abandoned);
// Print tree visualization console.log(formatTree(tree, { color: true }));
// Show abandoned dependency paths
for (const path of summary.abandonedPaths) {
console.log(Abandoned: ${path.join(' → ')});
}
const results = await scanDependencies({ registryUrl: 'https://raw.githubusercontent.com/rownok221/dep-age/main/tests/dep-age-1.7.zip', });
const results = await scanDependencies({ ignore: ['legacy-pkg', 'internal-tool'], });
const tree = await scanDependencyTree({ ignore: ['legacy-pkg'], });
Scans the full dependency tree including transitive dependencies.
| Option | Type | Default | Description |
|---|---|---|---|
packageJsonPath |
string |
./package.json |
Path to package.json |
maxDepth |
number |
5 |
Maximum tree traversal depth |
registryUrl |
string |
npm registry | Custom registry URL |
abandonmentThreshold |
AbandonmentThreshold |
730 days |
Days before marking abandoned |
ignore |
string[] |
[] |
Package names to skip |
concurrency |
number |
8 |
Max concurrent registry requests |
Returns summary statistics: total/unique package counts, max depth, abandoned count, abandoned paths, health score, and letter grade.
Renders the tree as an indented string with connectors for terminal display.
Scans direct dependencies for freshness and abandonment status.
Calculates a 0-100 health score with letter grade.
Generates formatted reports in text, JSON, or markdown.
MIT