depguardian
v1.0.0
Published
A powerful CLI tool for resolving complex dependency and version conflicts in JavaScript projects
Maintainers
Readme
🛡️ DepGuardian
A powerful CLI tool for analyzing and resolving dependency conflicts in JavaScript and TypeScript projects.
Features
- Detect version conflicts - Find packages with multiple installed versions
- Trace root causes - Identify which dependencies need updating
- Smart suggestions - Get exact version recommendations (e.g., "Update: [email protected] → 3.0.0")
- Peer dependency checks - Detect missing or incompatible peer dependencies
- Multi-format support - Works with npm, yarn, and pnpm
- Fast analysis - Instant for peer-only conflicts, 2-3s for version conflicts
- Multiple outputs - Terminal, JSON, or HTML reports
- Language-agnostic - Works with JavaScript, TypeScript, and any framework
Installation
# Global installation
npm install -g depguardian
# As dev dependency (recommended)
npm install --save-dev depguardianUsage
Basic Commands
# Scan for conflicts
depguardian scan
# Resolve conflicts interactively
depguardian resolve --interactive
# Auto-update packages
depguardian update
# Visualize dependency graph
depguardian graph
# CI mode (fails on conflicts)
depguardian ciScan Options
depguardian scan [path] # Scan project
depguardian scan --verbose # Show full dependency tree
depguardian scan --format json # JSON output
depguardian scan --format html -o report.html # HTML reportResolve Options
depguardian resolve --interactive # Choose resolutions manually
depguardian resolve --auto # Apply safe resolutions automatically
depguardian resolve --simulate # Preview changes without applyingOther Commands
depguardian update [--dry-run] # Update packages to resolve conflicts
depguardian graph [--package name] # Visualize dependency tree
depguardian graph --conflicts-only # Show only conflicting packages
depguardian clean # Clean and regenerate lockfile
depguardian ci [--severity high] # CI mode with severity threshold
depguardian monorepo [--pattern "apps/*"] # Scan monorepo packagesHow It Works
- Parses lockfile - Reads package-lock.json, yarn.lock, or pnpm-lock.yaml
- Builds dependency tree - Maps all direct and transitive dependencies
- Detects conflicts - Finds packages with multiple installed versions
- Traces parents - Identifies which direct dependencies cause conflicts
- Queries npm registry - Finds exact compatible versions (only for version conflicts)
- Generates suggestions - Provides actionable recommendations
Conflict Types
Version Conflicts
Multiple versions of the same package installed.
Peer Dependency Conflicts
Missing or incompatible peer dependencies.
Output Formats
- Terminal
- JSON
- HTML
Configuration (Optional)
DepGuardian works out of the box with no configuration. Optionally create .depguardianrc.json to customize behavior:
{
"severity": "medium",
"ignore": ["optional-package"],
"rules": {
"react": "^18.0.0"
}
}Programmatic API
const depguardian = require("depguardian");
// Analyze a project
const analysis = await depguardian.analyze("/path/to/project");
console.log("Conflicts:", analysis.conflicts.length);
// Resolve conflicts
await depConflictResolver.resolve("/path/to/project", { auto: true });Contributing
See CONTRIBUTING.md for development guidelines.
License
MIT © DepGuardian Contributors
Note: DepGuardian detects version conflicts, not security vulnerabilities. Use npm audit for security scanning.
