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-lib] Fix filtered install behavior when there are dependencies on other subspaces #5019

Merged

Conversation

pedro-gomes-92
Copy link
Contributor

@pedro-gomes-92 pedro-gomes-92 commented Nov 26, 2024

Summary

Fix install all projects of all subspaces in a monorepo

Details

What happened?

We have a project which depends on ALL of the rest of the local packages of different subspaces.

CleanShot 2024-11-26 at 13 00 01@2x

When we run rush install -t P1, all subspaces except the current, are ignored with the message: "No projects matched the filters in XXX".

In other words, NO dependencies are installed (node_modules folders are empty) for the cross-subspaces that the project requires.

Subspace S1 is installed, but S2 and S3 are not! Both S2 and S3 will show the message "No projects matched the filters in XXX".

What I expected to happen?

All related cross-subspaces should be properly installed. I would expect no message: "No projects matched the filters in XXX" to be shown.

The solution

After diagnosing the pnpm install command during a subspace installation, we discovered a package filtering parameter for the current project (e.g. --filter P1), which fails to exist on any cross-subspace dependency. PNPM will then skip each cross-subspace installation.

/XXX/.rush/node-v18.20.5/pnpm-8.8.0/node_modules/pnpm/bin/pnpm.cjs install --store /YYY/common/temp/pnpm-store --config.cacheDir=/YYY/common/temp/pnpm-store --config.stateDir=/YYY/common/temp/pnpm-store --frozen-lockfile --config.dedupe-peer-dependents=false --reporter ndjson --no-strict-peer-dependencies --config.auto-install-peers=false --config.resolutionMode=highest --config.ignoreCompatibilityDb --recursive --link-workspace-packages false --filter @P1...

This filter should NOT exist when Rush wants to install all projects of all subspaces.

How it was tested

  1. Create a repository with subspaces enabled: https://rushjs.io/pages/advanced/subspaces/
  2. Create 2 subspaces (e.g. default and s1)
  3. Create a project inside of s1 and default and add s1 project as a local dependency of default
  4. Run rush install -t <project_of_default>

The message "No projects matched the filters in XXX" during s1 installation.

@pedro-gomes-92 pedro-gomes-92 marked this pull request as ready for review November 26, 2024 06:15
@octogonz octogonz changed the title [rush-lib] Fix install all projects of all subspaces in a monorepo [rush-lib] Fix filtered install behavior when there are dependencies on other subspaces Nov 27, 2024
…ects_2024-11-26-04-35.json

Co-authored-by: Pete Gonzalez <[email protected]>
@octogonz octogonz merged commit 8685c7c into microsoft:main Nov 27, 2024
4 checks passed
@pedro-gomes-92 pedro-gomes-92 deleted the pedrogomes/fix-install-all-projects branch December 3, 2024 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

2 participants