syncpack icon indicating copy to clipboard operation
syncpack copied to clipboard

feat(versions): support optional `v` prefix in git semver tags

Open b0o opened this issue 1 year ago • 1 comments
trafficstars

Description

I have the following syncpack configuration:

{
  "versionGroups": [
    {
      "label": "Use workspace protocol for local packages",
      "dependencies": ["$LOCAL"],
      "dependencyTypes": ["dev", "prod", "peer"],
      "pinVersion": "workspace:*"
    }
  ],
  "semverGroups": [
    {
      "label": "use exact version numbers in production",
      "packages": ["**"],
      "dependencyTypes": ["prod"],
      "dependencies": ["**"],
      "range": ""
    }
  ]
}

I'm having an issue with my dependency https://github.com/uNetworking/uWebSockets.js. The developers do not publish their package on NPM, and only support installing from GitHub releases. Their releases are semver-versioned, but their git tags are prefixed with a v:

  "dependencies": {
    "uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.43.0"
  }

The v prefix seems to trip up syncpack:

✘ name uWebSockets.js or version github:uNetworking/uWebSockets.js#v20.43.0 are not supported packages/a/package.json > dependencies [UnsupportedMismatch]
✘ name uWebSockets.js or version github:uNetworking/uWebSockets.js#v20.43.0 are not supported packages/b/package.json > dependencies [UnsupportedMismatch]

I tested removing the v prefix; syncpack correctly handles the dependency:

  "dependencies": {
    "uWebSockets.js": "github:uNetworking/uWebSockets.js#20.43.0"
  }

Suggested Solution

Support an optional v prefix for git semver tags. Also, might want to consider supporting other common prefixes?

b0o avatar May 07 '24 00:05 b0o

Sounds good @b0o, thanks for raising 👍

JamieMason avatar May 07 '24 08:05 JamieMason