🚀 Add Syncpack Scripts for Dependency Management
What is Syncpack?
Syncpack is a utility designed to keep dependencies in sync across a monorepo (or multi-package) setup. It helps you:
- 🔍 Lint your dependency versions
- 🛠 Format
package.json entries consistently
- ⚙️ Fix mismatches automatically
- 📋 Audit and list inconsistencies
By integrating Syncpack into our npm scripts, we ensure a more reliable, maintainable, and consistent dependency tree across all packages.
✨ New npm Scripts
| Script | Command | What It Does |
|---|
| sp:check | npm run sp:format && npm run sp:lint | Runs both the formatter and linter to validate dependency ordering & version consistency |
| sp:format | syncpack format | Formats all dependencies in package.json to a standardized order |
| sp:lint | syncpack lint | Checks for mismatched or unsorted dependencies without making changes |
| sp:fix:mm | syncpack fix-mismatches | Automatically upgrades or aligns mismatched dependency versions across packages |
| sp:ls:mm | syncpack list-mismatches | Outputs a report of all version mismatches detected |
🛠 How to Use
- Check everything at once
npm run sp:check
- List mismatches
npm run sp:ls:mm
- Fix all version mismatches
npm run sp:fix:mm
Example package.json Snippet
{
"scripts": {
"sp:check": "npm run sp:format && npm run sp:lint",
"sp:format": "syncpack format",
"sp:lint": "syncpack lint",
"sp:fix:mm": "syncpack fix-mismatches",
"sp:ls:mm": "syncpack list-mismatches"
}
}
🎯 Benefits
- Ensures consistent ordering of dependencies
- Catches version mismatches before they break your build
- Automates repetitive tasks—saving you time and context switching
Please review and let me know if you’d like any tweaks! 😄