Migrate to 14
npm install --save-dev syncpack@alphaCommand Changes
Section titled “Command Changes”list-mismatches → lint
Section titled “list-mismatches → lint”list-mismatches and lint-semver-ranges have been merged into a single lint command which checks whether every specifier matches the semver group and version group they belong to. The lint command no longer checks formatting, which is now handled by syncpack format ––check.
# v13syncpack list-mismatches --types prod,dev# v14syncpack lint --dependency-types prod,devlint-semver-ranges → lint
Section titled “lint-semver-ranges → lint”list-mismatches and lint-semver-ranges have been merged into a single lint command which checks whether every specifier matches the semver group and version group they belong to. The lint command no longer checks formatting, which is now handled by syncpack format ––check. It's no longer possible to manage semver ranges without also checking version mismatches, because the two things are so closely linked. Changes to semver ranges affect which versions are considered valid and can indirectly cause version mismatches, so they are now always checked and changed together via the lint and fix commands.
# v13syncpack lint-semver-ranges# v14syncpack lintfix-mismatches → fix
Section titled “fix-mismatches → fix”fix-mismatches and set-semver-ranges have been merged into a single fix command which autofixes issue found by syncpack lint. The fix command no longer fixes formatting, which is now handled by syncpack format.
# v13syncpack fix-mismatches# v14syncpack fixset-semver-ranges → fix
Section titled “set-semver-ranges → fix”fix-mismatches and set-semver-ranges have been merged into a single fix command which autofixes issue found by syncpack lint. The fix command no longer fixes formatting, which is now handled by syncpack format. It's no longer possible to manage semver ranges without also checking version mismatches, because the two things are so closely linked. Changes to semver ranges affect which versions are considered valid and can indirectly cause version mismatches, so they are now always checked and changed together via the lint and fix commands.
# v13syncpack set-semver-ranges# v14syncpack fixprompt → Removed
Section titled “prompt → Removed”The prompt command is an interactive prompt which lists all current issues which syncpack can't fix automatically. It is not yet available in v14 and will be added at a later date. Syncpack can't automatically fix mismatches between specifiers it does not support, which are usually specifiers which are not semver, such as pnpm overrides, or complex semver specifiers like ^1.2.3 || ^2.0.0.
# v13syncpack prompt# v14# Not yet implementedCLI Option Changes
Section titled “CLI Option Changes”--types → --dependency-types
Section titled “--types → --dependency-types”Renamed for consistency and also to differentiate it from other types such as specifier types.
# v13syncpack list-mismatches --types prod,dev# v14syncpack lint --dependency-types prod,dev--specs → --specifier-types
Section titled “--specs → --specifier-types”Renamed for consistency.
# v13syncpack format --specs exact,range# v14syncpack format --specifier-types exact,range--filter → --dependencies
Section titled “--filter → --dependencies”This has been renamed to dependencies to match the equivalent property of version groups and semver groups. Regular expressions are no longer supported and instead a glob pattern should be provided in the same way as they are for version groups and semver groups.
# v13syncpack list-mismatches --filter "^@types\/.+"# v14syncpack lint --dependencies "@types/**"Config Changes
Section titled “Config Changes”dependencyTypes removed
Section titled “dependencyTypes removed”The dependencyTypes config has been removed in favour of using versionGroups config, which achieves the same result:
{ // Removed in v14 "dependencyTypes": ["prod", "dev", "peer"], // Use instead "versionGroups": [ { "label": "Ignore everything except dependencies, devDependencies, and peerDependencies", "dependencies": ["!prod", "!dev", "!peer"], "isIgnored": true, }, ],}Or use the --dependency-types CLI option to filter on an ad hoc basis:
syncpack lint --dependency-types prod,dev,peerspecifierTypes removed
Section titled “specifierTypes removed”The specifierTypes config has been removed in favour of using versionGroups config, which achieves the same result:
{ // Removed in v14 "specifierTypes": ["exact", "range"] // Use instead "versionGroups": [ { "label": "Ignore everything except exact (1.2.3) or range (>=1.2.3, ~1.2.3 etc) specifier types", "specifierTypes": ["!exact", "!range"] "isIgnored": true, }, ],}Or use the --specifier-types CLI option to filter on an ad hoc basis:
syncpack format --specifier-types exact,rangelintFormatting removed
Section titled “lintFormatting removed”The lint command no longer checks formatting, only version mismatches, so the lintFormatting option is no longer needed. If you don't want to lint or fix formatting, you can just not use syncpack format or syncpack format --check.
format handles formatting, lint and fix handle version issues.
{ // Removed in v14 "lintFormatting": false,}# Check if formatting needed (exit 1 if needed)syncpack format --check# Safely see what formatting fixes would look likesyncpack format --dry-run# Write formatting fixes to disksyncpack formatlintSemverRanges removed
Section titled “lintSemverRanges removed”It's no longer possible to manage semver ranges without also checking version mismatches, because the two things are so closely linked. Changes to semver ranges affect which versions are considered valid and can indirectly cause version mismatches, so they are now always checked and changed together via the lint and fix commands.
V14 will always lint semver ranges when checking for version mismatches, but this will only apply to you if you have semverGroups defined. Let's say your project has react installed in three places: two of them use exact versions (19.1.0 and 19.1.1) and one of them belongs to a Semver Group which requires a ^ range so has a version of ^19.1.0. Syncpack will synchronise these versions so that the highest version of 19.1.1 is used everywhere, while respecting the Semver Group requirement of ^19.1.1 being used for the member of that group.
{ // Removed in v14 "lintSemverRanges": false,}lintVersions → Always enabled
Section titled “lintVersions → Always enabled”It's no longer possible to manage semver ranges without also checking version mismatches, because the two things are so closely linked. Changes to semver ranges affect which versions are considered valid and can indirectly cause version mismatches, so they are now always checked and changed together via the lint and fix commands.
This option is redundant in V14.
{ // Removed in v14 "lintVersions": false,}Migrating from older versions
Section titled “Migrating from older versions”Version 11.2.1
Section titled “Version 11.2.1”workspace dependency type renamed to local
Section titled “workspace dependency type renamed to local”The workspace dependency type has been renamed to local for clarity.
# v11.2.0 and earliersyncpack list --types prod,workspace# v14syncpack lint --dependency-types prod,localVersion 9.0.0
Section titled “Version 9.0.0”CLI Options Replaced
Section titled “CLI Options Replaced”Individual boolean flags replaced with --dependency-types option:
# v8syncpack list --prod --dev --peer# v14syncpack lint --dependency-types prod,dev,peerThe following flags were removed:
-p, --prod-d, --dev-P, --peer-R, --resolutions-o, --overrides-O, --pnpmOverrides-w, --workspace
Config Changes
Section titled “Config Changes”Individual boolean properties replaced with versionGroups configuration:
// v8{ "dev": true, "overrides": false, "peer": true, "pnpmOverrides": false, "prod": true, "resolutions": false, "workspace": true}// v14 (use versionGroups instead){ "versionGroups": [ { "label": "Ignore overrides", "dependencyTypes": ["overrides", "pnpmOverrides", "resolutions"], "isIgnored": true } ]}Version 8.0.0
Section titled “Version 8.0.0”pnpm overrides renamed
Section titled “pnpm overrides renamed”The --overrides option now refers to npm overrides. pnpm users must use --pnpmOverrides instead.
# v7 (pnpm users)syncpack list --overrides# v14 (pnpm users)syncpack list --dependency-types pnpmOverrides# v14 (npm users)syncpack list --dependency-types overridesContext: v6.0.0 originally added --overrides for pnpm but read from the wrong property. npm later added their own .overrides property, so v8 split these into separate options.
Version 7.0.0
Section titled “Version 7.0.0”Workspace dependency syncing enabled by default
Section titled “Workspace dependency syncing enabled by default”Syncpack now syncs versions of locally developed packages by default. If package A depends on package B (both in your monorepo), syncpack will fix A's dependency to match B's actual version.
In v14, disable this behavior using versionGroups:
{ "versionGroups": [ { "label": "Ignore .version properties of local packages", "dependencyTypes": ["local"], "isIgnored": true, }, ],}Or exclude local when using CLI flags:
# v14syncpack lint --dependency-types '!local'Version 6.0.0
Section titled “Version 6.0.0”resolutions and overrides enabled by default
Section titled “resolutions and overrides enabled by default”Yarn's resolutions and pnpm's overrides fields are now processed by default.
In v14, exclude them using versionGroups:
{ "versionGroups": [ { "label": "Ignore overrides", "dependencyTypes": ["resolutions", "overrides", "pnpmOverrides"], "isIgnored": true, }, ],}Or via CLI:
# v14syncpack lint --dependency-types dev,peer,prodVersion 3.0.0
Section titled “Version 3.0.0”--source option changed
Section titled “--source option changed”Package locations now specified with repeatable --source option instead of positional arguments:
# v2syncpack list './package.json' './packages/*/package.json'# v14syncpack list --source './package.json' --source './packages/*/package.json'