pdc-hyperdrift
Version:
Smart dependency compatibility checker that prevents peer dependency conflicts before you upgrade
270 lines (192 loc) โข 7.77 kB
Markdown
# ๐ peer-dependency-checker
**by hyperdrift**
*The smart way to check dependency compatibility before you upgrade*
*Stop breaking your builds. Check compatibility first.*
## ๐ **Quick Integration** (1 Command Setup)
Add peer dependency checking to **any existing project** in seconds:
```bash
# One command setup - works with npm, yarn, pnpm, or bun
npx @hyperdrift-io/peer-dependency-checker setup
# Or install globally first
npm install -g @hyperdrift-io/peer-dependency-checker
pdc setup
```
**What this does:**
โ
Detects your package manager (npm/yarn/pnpm/bun)
โ
Adds pre/post-install hooks to your `package.json`
โ
Sets up automatic checking on `npm install`, `yarn add`, etc.
โ
Uses smart defaults (`.pdcrc.json` optional - [customize if needed](./docs/CONFIG.md))
โ
**Works immediately** - zero configuration required
**Result:** Every time you or your team installs dependencies, peer dependency conflicts are checked automatically!
## ๐ก **See It In Action**
```bash
# Before: Risky blind install
npm install react@19 react-dom@19
# ERROR: peer dependency conflicts everywhere ๐ข
# After: Safe install with pdc
npm install react@19 react-dom@19
# ๐ Pre-checking compatibility...
# โ
Compatible! Safe to upgrade
# โ ๏ธ Conflict detected with @types/react - details below
# Continue? (y/N)
```
## ๐ Why peer-dependency-checker?
Ever had a major upgrade break your entire build because of peer dependency conflicts? **We've all been there.**
```bash
# The old way: ๐ฅ YOLO and pray
npm install react@19 react-dom@19
# ERROR: peer dependency conflicts everywhere
# The hyperdrift way: โ
Check first
npx @hyperdrift-io/peer-dependency-checker check react@19 react-dom@19
# โ
Compatible! Safe to upgrade
# โ ๏ธ Conflict detected with @types/react - check details below
```
**peer-dependency-checker** analyzes your dependencies and tells you exactly what will break **before** you upgrade.
## โก Installation
```bash
# Global install (recommended)
npm install -g @hyperdrift-io/peer-dependency-checker
# Or use directly with npx
npx @hyperdrift-io/peer-dependency-checker --help
```
## ๐ฏ Quick Start
```bash
# Check what's outdated and if upgrades are safe
pdc scan
# Check specific packages before upgrading
pdc check react@19 react-dom@19
# Analyze peer dependency conflicts for all outdated packages
pdc analyze
# Get upgrade recommendations with safety ratings
pdc recommend
```
## โจ Features
### ๐ **Smart Compatibility Analysis**
- Detects peer dependency conflicts before installation
- Analyzes version ranges and compatibility matrices
- Shows exactly which packages will conflict
### ๐ฏ **Upgrade Planning**
- Phase-based upgrade recommendations
- Risk assessment for each package
- Safe upgrade paths with dependency order
### ๐จ **Conflict Prevention**
- Pre-install compatibility checks
- Real-time peer dependency validation
- Breaking change detection
### ๐ **Beautiful Output**
- Color-coded compatibility reports
- Clear upgrade recommendations
- Detailed conflict explanations
## ๐ Examples
### Check Current Project Health
```bash
$ pdc scan
๐ Scanning your project...
โ
COMPATIBLE (12 packages)
โข @types/node: 22.15.21 โ 24.0.3
โข tailwindcss: 4.1.7 โ 4.1.10
โข next: 15.3.2 โ 15.3.4
โ ๏ธ CONFLICTS DETECTED (2 packages)
โข react: 18.3.1 โ 19.1.0
โโโ Conflict: @types/react needs updating to ^19.0.0
๐ด BREAKING CHANGES (1 package)
โข some-package: 2.1.0 โ 3.0.0
โโโ Breaking: API changes detected
```
### Test Specific Upgrades
```bash
$ pdc check react@19 react-dom@19 @types/react@19
๐งช Testing compatibility for 3 packages...
โ
react@19.1.0
โโโ No conflicts detected
โ
react-dom@19.1.0
โโโ Requires: react ^19.1.0 โ
โ ๏ธ @types/react@19.1.8
โโโ May conflict with: @types/react-dom@18.x
โโโ Recommendation: Also upgrade @types/react-dom@19.1.6
๐ฏ UPGRADE PLAN:
1. npm install react@19 react-dom@19
2. npm install -D @types/react@19 @types/react-dom@19
```
### Get Smart Recommendations
```bash
$ pdc recommend
๐ฏ UPGRADE RECOMMENDATIONS
๐ข SAFE TO UPGRADE NOW:
โข tailwindcss, postcss, eslint (patch/minor updates)
โข Command: npm update
๐ก REQUIRES TESTING:
โข react ecosystem (major update)
โข Plan: Create test branch, upgrade together
๐ด POSTPONE:
โข node types (may break TypeScript compilation)
โข Action: Check Node.js compatibility first
```
## ๐ ๏ธ Commands
| Command | Description |
|---------|-------------|
| `pdc scan` | Analyze current project for upgrade opportunities |
| `pdc check <packages>` | Test specific package upgrades for conflicts |
| `pdc analyze` | Deep analysis of all peer dependencies |
| `pdc recommend` | Get smart upgrade recommendations |
| `pdc outdated` | Enhanced version of `npm outdated` with compatibility |
| `pdc why <package>` | Explain why a package can't be upgraded |
## ๐ง Configuration
peer-dependency-checker works out-of-the-box with **smart defaults**:
```json
{
"packageManager": "auto-detect", // npm, yarn, pnpm, bun
"riskTolerance": "medium", // low, medium, high
"autoCheck": true, // Auto-check on installs
"checkOnInstall": true, // Pre-install checks
"excludePackages": [], // Skip specific packages
"includeDevDependencies": true, // Include dev dependencies
"outputFormat": "colored" // colored, json, minimal
}
```
**๐๏ธ Need custom settings?** Create `.pdcrc.json` in your project root:
```json
{
"riskTolerance": "low",
"excludePackages": ["legacy-package"],
"outputFormat": "json"
}
```
๐ **[Full Configuration Guide โ](./docs/CONFIG.md)**
## ๐ค Comparison with Other Tools
| Feature | peer-dependency-checker | npm-check-updates | npm outdated |
|---------|------------------------|-------------------|--------------|
| Peer dependency analysis | โ
**Advanced** | โ | โ |
| Compatibility checking | โ
**Pre-install** | โ | โ |
| Upgrade recommendations | โ
**Smart phases** | โ ๏ธ Basic | โ |
| Risk assessment | โ
**Detailed** | โ | โ |
| Breaking change detection | โ
| โ | โ |
## ๐จ The Hyperdrift Approach
At **hyperdrift**, we believe in tools that make developers' lives easier, not harder. **peer-dependency-checker** was born from our frustration with tools that show you what *can* be upgraded, but not what *should* be upgraded safely.
*"It's like having a senior developer review your upgrades before you break production."*
## ๐ Journey
Read about how we built this tool and the problems it solves in our [Journey article](./public/docs/journey.mdx).
## ๐ง Roadmap
- [ ] **v1.1**: GitHub Actions integration
- [ ] **v1.2**: Dependency vulnerability scanning
- [ ] **v1.3**: Automated PR creation for safe upgrades
- [ ] **v1.4**: Team collaboration features
- [ ] **v2.0**: AI-powered upgrade recommendations
## ๐ค Contributing
We love contributions! Check out our [Contributing Guide](CONTRIBUTING.md) to get started.
```bash
# Quick start for contributors
git clone https://github.com/hyperdrift-io/peer-dependency-checker
cd peer-dependency-checker
npm install
npm run dev
```
## ๐ License
MIT ยฉ [Hyperdrift](https://hyperdrift.io)
**Built with โค๏ธ by the hyperdrift team**
*Making developer tools that actually work*
[Report Bug](https://github.com/hyperdrift-io/peer-dependency-checker/issues) โข [Request Feature](https://github.com/hyperdrift-io/peer-dependency-checker/issues) โข [Join Discussion](https://github.com/hyperdrift-io/peer-dependency-checker/discussions)