Skip to content

fix-mismatches

Ensure that multiple packages requiring the same dependency define the same version, so that every package requires eg. react@16.4.2, instead of a combination of react@16.4.2, react@0.15.9, and react@16.0.0.

CLI Options

source

Override your source configuration to run syncpack fix-mismatches on only some package.json files.

# only the root package
syncpack fix-mismatches --source 'package.json'
# only packages matching a glob
syncpack fix-mismatches --source 'packages/beta-*'
# multiple values can be provided
syncpack fix-mismatches --source 'package.json' --source 'packages/beta-*'

filter

Only run syncpack fix-mismatches on dependencies whose names match the given string, which will be passed to new RegExp().

# only include react, react-dom, preact etc
syncpack fix-mismatches --filter 'react'
# only include typescript or eslint packages
syncpack fix-mismatches --filter 'typescript|eslint'

config

Syncpack uses cosmiconfig to discover your config file, but a custom location can be provided instead.

syncpack fix-mismatches --config ./config/.syncpackrc

specs

Override your specifierTypes configuration to run syncpack fix-mismatches against dependency instances with version specifiers of the given types, such as exact, range, or workspace-protocol.

# only include exact versions
syncpack fix-mismatches --specs 'exact'
# only include latest and range versions
syncpack fix-mismatches --specs 'latest,range'
# exclude unsupported versions
syncpack fix-mismatches --specs '!unsupported'

types

Override your dependencyTypes configuration to run syncpack fix-mismatches on only eg. peerDependencies in every package in your monorepo.

# only include peerDependencies
syncpack fix-mismatches --types 'peer'
# only include dependencies and devDependencies
syncpack fix-mismatches --types 'prod,dev'
# exclude local package.json versions
syncpack fix-mismatches --types '!local'

indent

Override your indent configuration, which is 2 spaces by default.

# four spaces
syncpack fix-mismatches --indent "    "
# one tab
syncpack fix-mismatches --indent '	'
# \t is converted into a tab
syncpack fix-mismatches --indent '\t'

help

Display a list of CLI options and other help information.

syncpack fix-mismatches --help

Troubleshooting

Verbose logging can be enabled by prefixing syncpack with the following environment variable:

SYNCPACK_VERBOSE=true syncpack fix-mismatches