feat(groups): allow many dependencies to be interpreted as one
moltar opened this issue ยท 7 comments
For example, it is possible to force all @aws-sdk/*
packages to use the same version?
I know there is this example: https://jamiemason.github.io/syncpack/examples/fix-aws-sdk-version-mismatch/
But it enforces a specific version via pinVersion
.
I don't want to enforce a specific version, but rather ensure that all of them are using the same one.
Thanks!
In addition to that, is there a way to enforce the same version, but for alpha packages?
E.g. in the cdk-land, there's this convention for alpha packages:
2.114.1-alpha.0
Where 2.114.1
is the version of the aws-cdk-lib
package.
They are always released together, so versions always go together, just appending -alpha.0
to the end.
I'd like to lint (and possibly fix) this to be always the same.
Thanks!
Hey @moltar,
I think for this there needs to be some kind of merging/aliasing config along these lines.
{
"versionGroups": [
{
"label": "Ensure AWS SDK dependencies always use the same version",
"packages": ["**"],
"dependencies": [{ "@aws-sdk/core": ["@aws-sdk/**"] }]
}
]
}
Where the key is the dependency whose version should be the source of truth, and the array contains the patterns for which dependencies should be 1) included in this group and 2) treated as actually being @aws-sdk/core instead.
So in summary, dependencies would be extended to not only contain an array of pattern strings, but a combination of those and/or these objects as well.
We could use the same approach for packages.
Why can't it be some policy or some such that basically says:
"packages in this group shall all have the same version"
EDIT:
{
"versionGroups": [
{
"dependencies": ["@aws-sdk/**"],
"policy": "sameVersion",
"label": "AWS SDK dependencies should all have the same version"
}
]
}
Ahh, I see what you mean. Yeah that could work really well, let me think it through but yeah that does sound better.
This feature would be incredibly useful to not have to update the config file for pinned version on dep update.