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

customTypes

Extend syncpack to manage other parts of package.json files than those provided by default.

Custom types behave indentically to the default dependency types (such as prod or peer). When you define a custom type, you are adding to the list of valid names that can be passed to the:

This is how the default dependency types are defined:

{
"$schema": "./node_modules/syncpack/schema.json",
"customTypes": {
"dev": {
"strategy": "versionsByName",
"path": "devDependencies"
},
"local": {
"strategy": "name~version",
"namePath": "name",
"path": "version"
},
"overrides": {
"strategy": "versionsByName",
"path": "overrides"
},
"peer": {
"strategy": "versionsByName",
"path": "peerDependencies"
},
"pnpmOverrides": {
"strategy": "versionsByName",
"path": "pnpm.overrides"
},
"prod": {
"strategy": "versionsByName",
"path": "dependencies"
},
"resolutions": {
"strategy": "versionsByName",
"path": "resolutions"
}
}
}

[name] Required

The key of each custom type is its name, this is equivalent to the default names such as prod and dev and can be used in all of the same places those can:

  1. --dependency-types
  2. versionGroup.dependencyTypes
  3. semverGroup.dependencyTypes
  4. dependencyGroup.dependencyTypes

[name].path Required

Where the version can be found in each package.json file, such as engines, packageManager or some.nested.property.

[name].strategy Required

A strategy defines how syncpack should read and write dependency names and versions.

There are 3 to choose from:

name@version

The name and version are combined in a single string. Commonly seen in package manager specifications.

{
"packageManager": "pnpm@7.27.0"
}

name~version

The name and version are in different locations.

{
"name": "some-local-package",
"version": "12.4.2"
}

versionsByName

Typical dependency objects where keys are package names and values are version strings.

{
"pnpm": "10.10.0",
"prettier": "3.5.3"
}