Snapped To
Pin the version of all dependencies in this group to follow the versions used by the other packages named within the snapTo
array.
Configuration
Section titled “Configuration”snapTo Required
Section titled “snapTo ”- The values refer to the
name
property of the package.json files developed in your monorepo. - Multiple values can be added to provide fallback packages to try in the event that the dependency is not present in the earlier packages in the array.
{ "versionGroups": [ { "dependencies": ["react", "react-native"], "snapTo": ["mobile-app"] } ]}
dependencies Optional
Section titled “dependencies ”- An array of names of dependencies you've installed or otherwise reference in your package.json files.
- If omitted, the default behaviour is to match every dependency.
- The strings can be any combination of exact matches or glob patterns:
// match any dependencydependencies: ["**"]
// match all dependencies with a certain scopedependencies: ["@aws-sdk/**"]
// match specific dependencies by namedependencies: ["react", "react-dom"]
{ "name": "HERE", "dependencies": { "HERE": "0.0.0" }, "devDependencies": { "HERE": "0.0.0" }, "overrides": { "HERE": "0.0.0" }, "peerDependencies": { "HERE": "0.0.0" }, "pnpm": { "overrides": { "HERE": "0.0.0" } }, "resolutions": { "HERE": "0.0.0" }}
dependencyTypes Optional
Section titled “dependencyTypes ”A "dependency type" refers to the path/location/nested property of package.json files where dependencies can be found.
- When set, only dependencies present in the named locations will be assigned to this group.
- If omitted, the default behaviour is to match dependencies everywhere they are found.
- Negated types are also supported, so a value of
["!dev", "!prod"]
would assign everything exceptdependencies
anddevDependencies
to this group.
See the Dependency Types guide for the list of possible values.
specifierTypes Optional
Section titled “specifierTypes ”- When set, only dependencies whose version specifier matches the given specifier types will be assigned to this group.
- If omitted, the default behaviour is to match all dependencies.
- Negated types are also supported, so a value of
["!latest", "!file"]
would assign everything except specifiers of the format*
andfile:path/to/package.tgz
to this group.
label Optional
Section titled “label ”- A short name or description displayed as a header in syncpack's output.
- If a label is not set then eg. "Version Group 3" will be used instead.
packages Optional
Section titled “packages ”- An array of strings which should match the
name
properties of your package.json files. - If omitted, the default behaviour is to match every package.
- Negated types are also supported, so a value of
["!my-client", "!my-server"]
would assign everything except the packagesmy-client
andmy-server
to this group. - The strings can be any combination of exact matches or glob patterns:
// ✅ match any package namepackages: ["**"]
// ✅ match any package name with this scopepackages: ["@my-repo/**"]
// ✅ match specific packages by namepackages: ["my-server", "my-client"]
// ✅ match all packages except negated onespackages: ["!my-server", "!@my-repo/**]
// ❌ no mixing of specific and negated packagespackages: ["my-client", "!@my-repo/**"]
// ❌ not file system paths, name properties of package.json filespackages: ["packages/my-client"]
// ❌ not file system globs, name properties of package.json filespackages: ["packages/**"]
{ "name": "HERE", "version": "1.0.2"}