syncpack
Consistent dependency versions in large JavaScript Monorepos.
https://syncpack.dev
Syncpack is used by AWS, Cloudflare, DataDog, Electron, GoDaddy, Lottie, Microsoft, PostHog, Qwik, Raycast, Salesforce, TopTal, Vercel, VoltAgent, WooCommerce and others.
Some of the things it can do are:
- Find and fix dependency version mismatches.
- Enforce a single version policy, or create partitions with separate policies.
- Find and bump outdated versions from the npm registry.
- Ensure some dependencies always remain pinned at a specific version.
- Ban some dependencies from being used: anywhere, or in specific places.
- Define rules for where exact or loose semver ranges should be used, including in catalogs.
- Assign packages as the source of truth for specific dependencies' versions.
- Sort and format package.json files consistently.
- Auto-migrate all or parts of your repo to pnpm catalogs or bun catalogs.
- Bump outdated versions in catalogs.
Installation
npm install --save-dev syncpack
Guides
Commands
All command line options can be combined to target packages and dependencies in multiple ways.
Ensure that multiple packages requiring the same dependency define the same version, so that every package requires eg. react@17.0.2, instead of a combination of react@17.0.2, react@16.8.3, and react@16.14.0.
Examples
syncpack lint --dependency-types prod,dev
syncpack lint --dependencies react
syncpack lint --dependencies '**react**'
syncpack lint --dependencies '@types/**'
syncpack lint --dependency-types '!peer'
syncpack lint --specifier-types exact
syncpack lint --sort count
syncpack lint --help
syncpack lint -h
Fix every autofixable issue found by syncpack lint.
Examples
syncpack fix --dependency-types prod,dev
syncpack fix --specifier-types exact
syncpack fix --dependencies react
syncpack fix --help
syncpack fix -h
Update packages to the latest versions from the npm registry, wherever they are in your monorepo, including pnpm catalog entries in pnpm-workspace.yaml.
Semver range preferences are preserved when updating.
Examples
syncpack update --target latest
syncpack update --target minor
syncpack update --target patch
syncpack update --check --source 'packages/pingu/package.json'
syncpack update --dependency-types dev,prod
syncpack update --dependency-types pnpmCatalog
syncpack update --dependency-types 'pnpmCatalog:react18'
syncpack update --specifier-types range
syncpack update --dependencies 'react'
syncpack update --dependencies '**react**'
syncpack update --dependencies '@aws-sdk/**'
syncpack update --help
syncpack update -h
Organise package.json files according to a conventional format, where fields appear in a predictable order and nested fields are ordered alphabetically. Shorthand properties are used where available, such as the "repository" and "bugs" fields.
Examples
syncpack format
syncpack format --check
syncpack format --check --source 'packages/pingu/package.json'
syncpack format --help
syncpack format -h
Query and inspect all dependencies in your project, both valid and invalid.
Examples
syncpack list --sort count
syncpack list --show instances
syncpack list --show ignored
syncpack list --show all
syncpack list --show hints,statuses
syncpack list --dependency-types peer
syncpack list --dependencies '@types/**'
syncpack list --specifier-types exact --show instances --dependency-types peer
syncpack list --help
syncpack list -h
Output the state of every instance of every dependency as a JSON object, one per line. This command is best used with tools like jq for filtering and processing.
Examples
syncpack json
syncpack json --dependencies '@aws-sdk/**'
syncpack json | jq -r '.dependencyType' | sort | uniq -c
syncpack json --help
syncpack json -h
Badges