syncpack icon indicating copy to clipboard operation
syncpack copied to clipboard

Allow version groups to pin to latest matching version in the group

Open sgarfinkel opened this issue 1 year ago • 3 comments
trafficstars

Description

The usecase here is for something Lerna packages like Jest, where each subpackage shares the same version. It would be convenient to have a way to say "in this version group, pick the highest version that matches and uses it for all matches". Our specific usecase here is an internal monorepo with several libraries and we'd like to have them all pin to the same version, without needing to manage that pinned version directly in syncpack.

Suggested Solution

See above, all matches in a version group should be, with configuration, able to share the highest version of the matches.

Help Needed

sgarfinkel avatar Jun 28 '24 16:06 sgarfinkel

I might be misunderstanding you @sgarfinkel but this is what a version group will do by default, if you use eg jest multiple times in that group, syncpack will suggest that you use the highest valid semver version in use from that set.

Another feature that came to mind while reading was a Snapped To version group, which lets packages copy the versions another package uses.

I might be missing something though, let me know 👍

JamieMason avatar Jun 28 '24 16:06 JamieMason

Hi @JamieMason--maybe I'm misunderstanding things. Suppose the following monorepo:

packages/
  a/
    package.json
  b/
    package.json

If a/package.json has:

{
  "dependencies": {
    "jest": "^5.0.0",
  }
}

And b/package.json has:

{
  "dependencies": {
    "jest-config": "^6.0.0",
  }
}

And my syncpackrc was:

{
  "versionGroups": [
    {
      "packages": ["**"]
      "dependencies": ["jest*"]
    }
  ]
}

Then the expectation is that the jest dependency in a/package.json would get bumped up to ^6.0.0, but in my testing this wasn't happening.

sgarfinkel avatar Jun 28 '24 20:06 sgarfinkel

Thanks @sgarfinkel, I think I've got you now.

This isn't possible at the moment but is something which has come up before (there might be another open issue I'm not sure).

I think what might be needed is to come up with some kind of merging or aliasing configuration, some way of saying that you want eg jest and jest-config to be treated by syncpack as if they're actually one package – from a version point of view. Their original names would be preserved. but their versions would be combined when being compared.

Let me know if we're thinking of the same thing, and I can stick this on the backlog 👍

JamieMason avatar Jun 28 '24 20:06 JamieMason

@JamieMason Yup, that sounds exactly like what I'm looking for here!

sgarfinkel avatar Jul 01 '24 15:07 sgarfinkel

This isn't possible at the moment but is something which has come up before (there might be another open issue I'm not sure).

I think what might be needed is to come up with some kind of merging or aliasing configuration, some way of saying that you want eg jest and jest-config to be treated by syncpack as if they're actually one package – from a version point of view. Their original names would be preserved. but their versions would be combined when being compared.

#204 is the issue I was thinking of, I was just reminded of it by a new comment.

I'll close this as a duplicate but it can still be referred to for notes.

JamieMason avatar Jul 09 '24 13:07 JamieMason