Skip to content

[rush] preferredVersions in common-versions not respected in subspace scenario #5346

@2772788276

Description

@2772788276

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//common-versions.json). Despite setting preferredVersions in this subspace-specific file, the specified versions are not being respected when installing dependencies for that subspace. Instead, the dependencies use versions from either the root common-versions.json or default resolutions.

Repro steps

  1. Set up a Rush monorepo with at least one subspace configured
  2. Create a subspace-specific common-versions.json file at: common/config/subspaces//common-versions.json
  3. Add preferredVersions entries to this subspace-specific file (e.g., "react": "18.2.0")
  4. Run rush update --subspace <subspace-name> targeting the specific subspace
  5. 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//common-versions.json file

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/rush@5.157.0
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Waiting for Author

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions