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

changeset incorrectly bumps version after exit mode. #1543

Open
novaknole opened this issue Dec 15, 2024 · 0 comments
Open

changeset incorrectly bumps version after exit mode. #1543

novaknole opened this issue Dec 15, 2024 · 0 comments

Comments

@novaknole
Copy link

novaknole commented Dec 15, 2024

Affected Packages

Problem

I have a monorepo where sometimes I only want to release one package only. I want to start using changesets. My current monorepo has 2 packages where packageA has 1.6.0-alpha.1 and packageB has 1.8.1. Ofc, I also want to be doing pre-releases. Let's say I want to release packageB in a pre-release mode.

  1. I added changeset code.
  2. I run npx changeset pre enter alpha.
  3. For changeset action, I pass my command of yarn run version. Note that changeset action allows you to pass version and publish commands.
  4. yarn run version runs my code which basically does: npx changeset version --ignore packageA
  5. The PR is created.

If you look at the PR, it contains the change of updating packageB's package.json from 1.8.1 to 1.8.1-alpha.0. So far so good. Assume that I decided to release this with non-prerelease. I changed my mind, so I re-run the workflow which basically exists the pre mode and updates the PR. Now, the PR contains packageB's package.json change from 1.8.1 to 1.9.0 (assuming I used minor). So far so good, but here is the problem. The PR now also contains packageA's package.json version change from 1.6.0-alpha.1 to 1.7.0 which is NOT correct.

After looking into the src code, I found:

if (preInfo.preVersions.get(pkg.packageJson.name) !== 0) {

There's a link on top of this line: #382 (comment) and reading it makes sense why you're doing this, but the problem is that my packages don't depend on each other., but your discussion explains this when there's dependency. Since my packages don't depend on each other, your solution seems wrong(i.e doesn't handle my scenario).

Tagging @emmatown for visibility due to her explanation on the link.

Is this clear ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant