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

[rush] Shouldn't version bumping update pnpm-lock.yaml too? #4977

Open
ingun37 opened this issue Oct 21, 2024 · 4 comments
Open

[rush] Shouldn't version bumping update pnpm-lock.yaml too? #4977

ingun37 opened this issue Oct 21, 2024 · 4 comments

Comments

@ingun37
Copy link

ingun37 commented Oct 21, 2024

Summary

Version bumping does not automatically update pnpm-lock.yaml. Therefore it needs to be updated manually. Otherwise, subsequent PRs fail at rush install or suffers from pnpm-lock.yaml conflict.

Details

When I do rush publish --publish --apply ..., the following version bump commit updates all the versions in the package.json files of the target branch. But since it doesn't update pnpm-lock.yaml, any subsequent PRs that is stemming from the target branch will suffer from the inconsistency between package.json and pnpm-lock.yaml. For example rush install won't work so they will have to run rush update by themselves. Shouldn't version bumping update pnpm-lock.yaml too?

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/rush globally installed version? 5.129.6
rushVersion from rush.json? 5.129.6
useWorkspaces from rush.json? undefined
Operating system? Linux
Would you consider contributing a PR? Yes
Node.js version (node -v)? 20.15.1
@iclanton
Copy link
Member

Local versions aren't supposed to be in the pnpm-lock file. Can you share a repro repo?

@ingun37
Copy link
Author

ingun37 commented Oct 22, 2024

@iclanton In this repro repo

  1. I merged code update ingun37/rush-bug-repro#1
  2. I ran rush publish ...
  3. It produced version bump commit ingun37/rush-bug-repro@9083699 (the current head) which has updated package.jsons.
  4. Now rush install fails from main because the pnpm-lock.yaml's not updated. It would only succeed after rush update and pnpm-lock.yaml is updated.

@dmichon-msft
Copy link
Contributor

Enabling useWorkspaces should resolve this issue. Non-workspace mode is deprecated, and in workspace mode your package.json files should just contain workspace:* as the version specifier for packages within the repository, which means they won't change in a way that impacts pnpm-lock.yaml on version bump.

@ingun37
Copy link
Author

ingun37 commented Oct 24, 2024

@dmichon-msft Thanks that fiix it but there's a preceding problem. I didn't change the workspace version but Rush did when it was publishing a prerelease. I also reproduced in the same repository and this was the step.

  1. Make a branch (Some pr 6 ingun37/rush-bug-repro#6)
  2. Update code & do rush change
  3. Publish prerelease targeting the same branch with rush publish ... --prerelease-name prerelease --target-branch some-pr-6.
  4. In the version bump commit (ingun37/rush-bug-repro@38fda9c) the workspace version is changed from workspace:* to workspace:1.0.8-prerelease
  5. Squash Merge to main
  6. Do the rush publish
  7. In the version bump commit (the current head, ingun37/rush-bug-repro@3db76b9) the workspace version is change from workspace:1.0.8-prerelease to workspace:1.0.8

I wanted to publish prerelease from PR for some integration test with other external projects. But by doing so the workspace version changes. Should I do the prerelease publish process differently?

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

No branches or pull requests

3 participants