syncpack
[!NOTE] This is the README for v14-alpha, a Rust rewrite which is due to replace
v13.x.x
Installation
Commands
All command line options can be combined to target packages and dependencies in multiple ways.
lint
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
# Find all issues in "dependencies" or "devDependencies"
# Only lint issues in "react" specifically
# Look for issues in dependencies containing "react" in the name
# Find issues in scoped packages only
# Find issues everywhere except "peerDependencies"
# Only look for issues where an exact version is used (eg "1.2.3")
# Sort dependencies by how many times they are used
# See more examples
# See a short summary of options
fix
Fix every autofixable issue found by syncpack lint
.
Examples
# Only fix issues in dependencies and devDependencies
# Only fix inconsistencies with exact versions (eg "1.2.3")
# Only fix issues in "react" specifically
# See more examples
# See a short summary of options
update
Update packages to the latest versions from the npm registry, wherever they are in your monorepo.Semver range preferences are preserved when updating.
Examples
# Accept any update in latest (x.x.x)
# Only update minor versions (1.x.x)
# Only update patch versions (1.2.x)
# Check for outdated dependencies in one package
# Update dependencies and devDependencies in the whole monorepo
# Only update dependencies with a semver range specifier (^, ~, etc.)
# Update dependencies where name exactly matches 'react'
# Update dependencies where name contains 'react'
# Update dependencies with the '@aws-sdk' scope
# See more examples
# See a short summary of options
format
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
# Fix every formatting issue in the monorepo
# List all formatting issues in the monorepo
# Check the formatting of one package
# See more examples
# See a short summary of options
list
Query and inspect all dependencies in your project, both valid and invalid.
Examples
# Sort dependencies by how many times they are used
# Show every instance of each dependency, not just their names
# Show dependencies ignored in your syncpack config
# Show highest level of detail
# Choose only some values
# List all "peerDependencies"
# List all types packages
# List instances of an exact version being used as a peer dependency
# See more examples
# See a short summary of options
json
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
# Output all dependencies as JSON
# Output only AWS SDK dependencies
# Count dependencies by type
| | |
# See more examples
# See a short summary of options