UNPKG

pdc-hyperdrift

Version:

Smart dependency compatibility checker that prevents peer dependency conflicts before you upgrade

270 lines (192 loc) โ€ข 7.77 kB
# ๐Ÿ” 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)