rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

[rush] preferredVersions doesn't work when subspace is enabled.

Open fzxen opened this issue 9 months ago • 2 comments
trafficstars

Summary

I am trying to enable subspace in my repo by flowing the doc. Then discovered a problem: After enabling the subspace feature, the preferredVersions in common-version will not take effect.

Details

when subspace is disable, rush will create a file named as pnpmfileSettings.json including preferredVersions.

https://github.com/microsoft/rushstack/blob/e64a1e51976626f95250205cbb9d21b5fc805769/libraries/rush-lib/src/logic/pnpm/IPnpmfile.ts#L13-L22

Then, pnpmfile.cjs read preferredVersions from pnpmfileSettings.json and it can set the preferred versions on the dependency map

https://github.com/microsoft/rushstack/blob/e64a1e51976626f95250205cbb9d21b5fc805769/libraries/rush-lib/src/logic/pnpm/PnpmfileShim.ts#L82-L103

However, when subspace is enable, pnpmfileSettings.json no longer contains preferredVersion information

https://github.com/microsoft/rushstack/blob/e64a1e51976626f95250205cbb9d21b5fc805769/libraries/rush-lib/src/logic/pnpm/IPnpmfile.ts#L34-L39

rush create a file named as global-pnpmfile.cjs and it doesn't seem to implement any logic related to preferredVersions.

https://github.com/microsoft/rushstack/blob/e64a1e51976626f95250205cbb9d21b5fc805769/libraries/rush-lib/src/logic/pnpm/SubspaceGlobalPnpmfileShim.ts#L34-L64

Subspace does not support preferredVersions, does it?

Standard questions

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

Question Answer
@microsoft/rush globally installed version? 5.147.2
rushVersion from rush.json? 5.147.2
useWorkspaces from rush.json? Yes
Operating system? Mac
Would you consider contributing a PR? Yes
Node.js version (node -v)? v20.16.0

fzxen avatar Feb 20 '25 03:02 fzxen