Ensure that semver ranges for a dependency all match each other
Add a Same Range Version Group which allows local packages installed in devDependencies or peerDependencies to use different semver ranges, as long as they all match the local package version.
- An optional label can be added to document the rule.
- The dependencies array defines the names of the dependencies we want to target.
- dependencyTypes results in these dependencies only being targeted by this group when they are located in
devDependenciesorpeerDependencies. - The policy of sameRange states that these dependencies are considered valid if every range matches the others.
{ "versionGroups": [ { "label": "Ensure semver ranges for locally developed packages satisfy the local version", "dependencies": [ "@your-repo/node-client-plugin-retry", "@your-repo/node-client", "dashboard-ui" ], "dependencyTypes": ["dev", "peer"], "policy": "sameRange" } ]}The above example can be shortened: The $LOCAL keyword is a helper to avoid writing out the names of every local package.
"dependencies": [ "$LOCAL" "@your-repo/node-client-plugin-retry", "@your-repo/node-client", "dashboard-ui"],