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:
--dependency-typesCLI optiondependencyTypesproperty of Version Groups, Semver Groups, and Dependency Groups.
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": "overrides", "source": "PnpmWorkspace" }, "prod": { "strategy": "versionsByName", "path": "dependencies" }, "resolutions": { "strategy": "versionsByName", "path": "resolutions" } }}Pick a strategy below based on the shape of your data.
name@version
A single string combining name and version, separated by @.
{ "packageManager": "pnpm@7.27.0"}{ "customTypes": { "packageManager": { "strategy": "name@version", "path": "packageManager" } }}[name] Required
The name of the new dependency type you are adding to syncpack. Syncpack ships with built-in types like prod, dev, and peer; defining a custom type adds your chosen name to that list, ready to be referenced from:
--dependency-typesversionGroup.dependencyTypessemverGroup.dependencyTypesdependencyGroup.dependencyTypes
[name].path Required
The location in each package.json of the "name@version" string. Use dot notation for nested properties (eg. packageManager, some.nested.property).
[name].strategy Required
Must be "name@version".
name~version
The name and version live at two separate paths. Both must point directly to string values, not to a containing object.
{ "devEngines": { "runtime": { "name": "node", "version": "22.11.0" } }}{ "customTypes": { "devEnginesRuntime": { "strategy": "name~version", "namePath": "devEngines.runtime.name", "path": "devEngines.runtime.version" } }}A common mistake is pointing path at the containing object (devEngines.runtime) and namePath at name relative to it. Both paths are absolute from the package.json root and must resolve to strings.
[name] Required
The name of the new dependency type you are adding to syncpack. Syncpack ships with built-in types like prod, dev, and peer; defining a custom type adds your chosen name to that list, ready to be referenced from:
--dependency-typesversionGroup.dependencyTypessemverGroup.dependencyTypesdependencyGroup.dependencyTypes
[name].path Required
The location in each package.json of the version string. Absolute from the package.json root; must point to a string.
[name].namePath Required
The location in each package.json of the dependency name. Absolute from the package.json root; must point to a string.
[name].strategy Required
Must be "name~version".
version
A bare version string with no name in the data. The custom type's key is used as the dependency name.
{ "engines": { "node": "22.11.0" }}{ "customTypes": { "node": { "strategy": "version", "path": "engines.node" } }}Here the dependency is reported as node because that is the custom type's key.
[name] Required
The name of the new dependency type you are adding to syncpack. Syncpack ships with built-in types like prod, dev, and peer; defining a custom type adds your chosen name to that list, ready to be referenced from:
--dependency-typesversionGroup.dependencyTypessemverGroup.dependencyTypesdependencyGroup.dependencyTypes
For the version strategy specifically, this name is also used as the dependency name in reports and grouping (since the data has no name field of its own).
[name].path Required
The location in each package.json of the version string. Use dot notation for nested properties (eg. engines.node).
[name].strategy Required
Must be "version".
versionsByName
A typical dependency object where keys are package names and values are version strings.
{ "dependencies": { "pnpm": "10.10.0", "prettier": "3.5.3" }}{ "customTypes": { "prod": { "strategy": "versionsByName", "path": "dependencies" } }}[name] Required
The name of the new dependency type you are adding to syncpack. Syncpack ships with built-in types like prod, dev, and peer; defining a custom type adds your chosen name to that list, ready to be referenced from:
--dependency-typesversionGroup.dependencyTypessemverGroup.dependencyTypesdependencyGroup.dependencyTypes
[name].path Required
The location in each package.json of the { "name": "version" } object. Use dot notation for nested properties (eg. dependencies, pnpm.overrides).
[name].strategy Required
Must be "versionsByName".