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": "pnpm.overrides" }, "prod": { "strategy": "versionsByName", "path": "dependencies" }, "resolutions": { "strategy": "versionsByName", "path": "resolutions" } }}[name] Required
Section titled “[name] ”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:
--dependency-typesversionGroup.dependencyTypessemverGroup.dependencyTypesdependencyGroup.dependencyTypes
[name].path Required
Section titled “[name].path ”Where the version can be found in each package.json file, such as engines, packageManager or some.nested.property.
[name].strategy Required
Section titled “[name].strategy ”A strategy defines how syncpack should read and write dependency names and versions.
There are 3 to choose from:
name@version
Section titled “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
Section titled “name~version”The name and version are in different locations.
{ "name": "some-local-package", "version": "12.4.2"}versionsByName
Section titled “versionsByName”Typical dependency objects where keys are package names and values are version strings.
{ "pnpm": "10.10.0", "prettier": "3.5.3"}