yarnpkg / yarnpkg/berry

[Feature] Yarn version should bump all ancestors

Open
#2,256 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
8.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Describe the user story

In my project, a package can have a long chain of dependencies which are all the packages in the workspace. If I run yarn version <version> in a package in the chain, it only updates the version of the given package as well as the version in the dependencies field in its direct parents. The version of its parents and ancestors are not bumped.

Take below dependency tree as example:

package A
"version": "1.0.0"

package B
"version": "1.0.0"
"dependencies": {
   "A": "1.0.0"
}

package C
"version": "1.0.0"
"dependencies": {
   "B": "1.0.0"
}

Run yarn version patch in package A. The result will be as below

package A
"version": "1.0.1"

package B
"version": "1.0.0"
"dependencies": {
   "A": "1.0.1"
}

package C
"version": "1.0.0"
"dependencies": {
   "B": "1.0.0"
}

package B and C are not bumped. This result in no available version of package B and C use the version 1.0.1 of package A

Describe the solution you'd like

When bumping a version, all its ancestors should also be bumped. Using the example above, after running yarn version patch in package A. The result should be

package A
"version": "1.0.1"

package  B
"version": "1.0.1"
"dependencies": {
   "A": "1.0.1"
}

package  C
"version": "1.0.1"
"dependencies": {
   "B": "1.0.1"
}

Describe the drawbacks of your solution

Describe alternatives you've considered

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the yarn version command and its workspace dependency handling, using the A–B–C dependency tree in the issue as the working example. Trace how direct parents are updated, then identify the logic and tests covering version propagation; done means running the command bumps every workspace ancestor and updates each dependency version consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
release, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.