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.
CLI Options
source
Override your source configuration to run syncpack format
on only some package.json files.
# 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-*'
config
Syncpack uses cosmiconfig to discover your config file, but a custom location can be provided instead.
syncpack format --config ./config/.syncpackrc
indent
Override your indent configuration, which is 2 spaces by default.
# four spaces
syncpack format --indent " "
# one tab
syncpack format --indent ' '
# \t is converted into a tab
syncpack format --indent '\t'
help
Display a list of CLI options and other help information.
syncpack format --help
Troubleshooting
Verbose logging can be enabled by prefixing syncpack with the following environment variable:
SYNCPACK_VERBOSE=true syncpack format