[rush] preferredVersions in common-versions not respected in subspace scenario
Summary
I am trying to configure subspace-specific dependency versions using the common-versions.json file located in the subspace-specific configuration directory (common/config/subspaces/
Repro steps
- Set up a Rush monorepo with at least one subspace configured
- Create a subspace-specific common-versions.json file at: common/config/subspaces/
/common-versions.json - Add preferredVersions entries to this subspace-specific file (e.g.,
"react": "18.2.0") - Run
rush update --subspace <subspace-name>targeting the specific subspace - Check the installed dependency versions in the subspace's node_modules
Expected result: The subspace should use the dependency versions specified in its own common/config/subspaces/
Actual result: The subspace ignores its specific common-versions.json and uses either root configuration or other version resolutions. No errors are logged regarding the subspace-specific configuration file.
Details
It seems that Rush is not properly loading or applying the common-versions.json files located in subspace-specific configuration directories. The subspace isolation mechanism may not be correctly resolving the path to these subspace-specific configuration files, or there may be a missing step in the configuration aggregation process that should prioritize subspace-specific settings.
A potential fix would involve updating the configuration loading logic to check for and apply subspace-specific common-versions.json files, ensuring they take precedence over root configurations for their respective subspaces.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question | Answer |
|---|---|
@microsoft/rush globally installed version? |
@microsoft/[email protected] |
rushVersion from rush.json? |
5.122.0 |
useWorkspaces from rush.json? |
Yes |
| Operating system? | Mac |
| Would you consider contributing a PR? | No |
Node.js version (node -v)? |
19.9.0 |
According to the issue template you are on a very old version of Rush (as configured in rush.json); does this still repro for you on latest 5.157.0?
Thank you for your suggestion. I've tried updating to the latest version 5.157.0, but unfortunately, the issue still persists. The problem remains unchanged after the update. Could you please provide further guidance on how to resolve this?