Skip to content

[Feature] Add hash for packageManager to set version CLI command #6657

Description

@MikeMcC399
  • I'd be willing to implement this feature (contributing guide)
  • This feature is important to have in this repository; a contrib plugin wouldn't do

Describe the user story

As a package creator or maintainer, I want to add or update the version of Yarn stored in the packageManager key of the package.json manifest for use when Corepack is enabled.
I want to have consistent results whether I use the

to set the Yarn package manager version.

Describe the solution you'd like

When the Yarn CLI command set version is executed, and it places a packageManager key into the package.json manifest, the key should include a hash. The effect should be the same as executing corepack use.

Describe the drawbacks of your solution

There should not be any drawbacks, because Corepack already uses and generates a packageManager key with a hash, and Yarn is already using this.

Other

package.json examples:

Example yarn (4.6.0)

Execute yarn set version 4.6.0

{
  "packageManager": "yarn@4.6.0"
}

Example corepack (0.30.0)

Execute corepack use yarn@4.6.0

{
  "packageManager": "yarn@4.6.0+sha512.5383cc12567a95f1d668fbe762dfe0075c595b4bfff433be478dbbe24e05251a8e8c3eb992a986667c1d53b6c3a9c85b8398c35a960587fbd9fa3a0915406728"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions