Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(versions): add support for $pkg keyword #208

Open
wmertens opened this issue Apr 21, 2024 · 1 comment
Open

feat(versions): add support for $pkg keyword #208

wmertens opened this issue Apr 21, 2024 · 1 comment

Comments

@wmertens
Copy link

Description

When you use $pkg as the version in pnpm overrides, which should just use the version specified in dependencies, syncpack is unhappy.

Suggested Solution

replace $pkg by the package's version when comparing versions.

Help Needed

no idea where to start

@ricokahler
Copy link

ricokahler commented Aug 1, 2024

Experiencing the same issue

CleanShot 2024-07-31 at 22 31 40@2x

Using "syncpack": "^12.3.3"

From the pnpm docs:

An override may be defined as a reference to a direct dependency's spec. This is achieved by prefixing the name of the dependency with a $:

{
  "dependencies": {
    "foo": "^1.0.0"
  },
  "pnpm": {
    "overrides": {
      "foo": "$foo"
    }
  }
}

Note that NPM overrides also supports this:

You may not set an override for a package that you directly depend on unless both the dependency and the override itself share the exact same spec. To make this limitation easier to deal with, overrides may also be defined as a reference to a spec for a direct dependency by prefixing the name of the package you wish the version to match with a $.

{
  "dependencies": {
    "foo": "^1.0.0"
  },
  "overrides": {
    // BAD, will throw an EOVERRIDE error
    // "foo": "^2.0.0"
    // GOOD, specs match so override is allowed
    // "foo": "^1.0.0"
    // BEST, the override is defined as a reference to the dependency
    "foo": "$foo",
    // the referenced package does not need to match the overridden one
    "bar": "$foo"
  }
}

@JamieMason JamieMason changed the title Not happy with $pkg in overrides feat(versions): add support for pnpm's $pkg keyword Aug 1, 2024
@JamieMason JamieMason changed the title feat(versions): add support for pnpm's $pkg keyword feat(versions): add support for $pkg keyword Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants