rushstack
rushstack copied to clipboard
[rush] Git branch lockfiles of pnpm cannot be used with rush
Summary
We are trying to migrate the repository to rush. The bad thing is that pnpm lockfile is more likely to conflict than yarn lockfile. Our repo has been suffering from conflict problem recently.
I found that pnpm will carry the information of peerDependencies in the lockfile, and the information is on the same line.
if someone change the version of @rushstack/heft, anthoer change the version of @type/node. Conflicts will happen, because they change the same line.
'@rushstack/heft-node-rig':
specifier: 2.6.15
version: 2.6.15(@rushstack/[email protected])(@types/[email protected])([email protected])
I found that pnpm has the git branch lockfile feature that can completely solves conflict problem even though it brings some challenges to code review. However, it can't be used in rush.
Details
Git branch lockfile can completely solves the conflict problem. However, I can't use this feature in rush. It will cause "rush install" to be unusable
When I execute the rush install command, the rush will throw an error:The shrinkwrap file is out of date. You need to run "rush update". Because pnpm-lock.yaml is not match with package.json and rush did not recognize local branch files like pnpm-lock.xxx.yaml.
I have also tried other ways to reduce the probability of conflict:
- change the resolution-mode in .npmrc from
highesttotimed-based. This method can reduce the occurrence of dependencies being bumped. - Use rush subspace feature. This feature can divide pnpm-lock.ymal into multi subspace. However, i found it will create doppelganger dependencies when a package depend on other subspace's packages. It will create a copy of dependency. The package of our repo are close connected. It hard to divide our repo into some unrelated subspaces.