Manage npm engines throughout monorepo
Add the engines property of package.json files to also be inspected by syncpack.
1. Add a custom type
I've chosen a name of engines but it can be anything you like. Once defined, every syncpack command checks versions under engines alongside the default dependency types.
{ "customTypes": { "engines": { // ^ this is your custom name "path": "engines", "strategy": "versionsByName", }, },}2. Look for mismatches
Perform a one-off check of all versions defined under engines in your monorepo.
syncpack list --dependency-types enginesIf the versions are not identical, they can be synchronised to all use the highest of the semver versions currently in use.
syncpack fix --dependency-types engines3. Relax the rules (optional)
If you don't want the Node.js version to be identical in every package but do want them all to be compatible with each other, you can use a Same Range Version Group. This defines an exception which only applies to Node.js, leaving anything else found under engines unaffected.
{ "customTypes": { "engines": { "path": "engines", "strategy": "versionsByName" } }, "versionGroups": [ { "dependencies": ["node"], "dependencyTypes": ["engines"], "policy": "sameRange" } ]}