Skip to content
This documentation is for v14 alpha, the docs for v13 stable are archived.

format

Sort package.json fields into a predictable order and nested fields alphabetically.

Lint formatting instead of fixing it and exit with a status code of 1 if issues are found.

syncpack format --check

--config <file-path>

Section titled “--config ”

syncpack searches the monorepo root directory for a config file which follows its naming convention, but this can be overridden by providing a path to a specific configuration file instead.

The only requirement is that the file must have a file extension and that it is one of .cjs, .cts, .js, .json, .mjs, .mts, .ts, .yaml, or .yml.

syncpack format --config ./config/syncpack.json

Cause syncpack to behave identically as when applying fixes, but never writing to disk.

syncpack format --dry-run

--log-levels <comma-separated-log-level-names>

Section titled “--log-levels ”

Control how detailed the log output should be

LevelWhat is written to this channel
infoThe standard output which forms syncpack's UI, including lint issues
warnPossible mistakes in your setup, or highlights of known gaps in syncpack
errorFatal exceptions or errors outside the normal running of syncpack
debugExtremely verbose detail on why syncpack assigns each status code
# Turn off logging completely
syncpack format --log-levels off
# Only show verbose debugging logs
syncpack format --log-levels debug
# Show everything
syncpack format --log-levels error,warn,info,debug

Syncpack will print colours and clickable hyperlinks to the terminal using ANSI escape code unless this option is set.

syncpack format --no-ansi

--source <file-pattern>

Section titled “--source ”

Only run syncpack format on package.json files matching the provided pattern(s).

Syncpack will look in the following places for glob patterns matching package.json files, in this order of precedence, and stop looking when a match is found:

  1. If --source CLI options are provided, use those.
  2. If source is defined in configuration, use that.
  3. If using npm workspaces or Yarn workspaces, read workspaces from ./package.json.
  4. If using pnpm, read packages from ./pnpm-workspace.yaml.
  5. If using Lerna, read packages from ./lerna.json.
  6. Default to 'package.json' and 'packages/*/package.json'.
# only the root package
syncpack format --source 'package.json'
# only packages matching a glob
syncpack format --source 'packages/beta-*'
# multiple values can be provided
syncpack format --source 'package.json' --source 'packages/beta-*'

Display a list of CLI options and other help information.

# Display a short summary of commands and options
syncpack format -h
# Display full help with examples
syncpack format --help