fix(workspace-tools): resolve catalog workspace deps in foreach#7161
Open
puneetdixit200 wants to merge 1 commit into
Open
fix(workspace-tools): resolve catalog workspace deps in foreach#7161puneetdixit200 wants to merge 1 commit into
puneetdixit200 wants to merge 1 commit into
Conversation
6508e1a to
8a2480c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's the problem this PR addresses?
Fixes #7129.
When a workspace dependency is declared through a catalog entry that resolves to
workspace:*,workspaces foreach --recursive --topological-dev --from ... --exclude ...can miss that workspace dependency if transparent workspace matching is disabled. The foreach dependency graph was checking raw manifest descriptors such ascatalog:instead of the descriptor after Yarn's dependency reduction hooks had resolved it.How did you fix it?
workspaces foreachnow reduces dependency descriptors through the existingreduceDependencyhook path before checking whether they point at a workspace. The same helper is used for recursive dependency selection, recursive dependent selection, and topological wait checks.I also added an acceptance test that disables transparent workspaces, puts
workspace:*behind a catalog entry, and verifies thatforeach --recursive --topological-dev --from my-package --exclude my-packagestill runs the dependency workspace.Checklist
Testing
yarn build:cliyarn workspace acceptance-tests test:integration packages/acceptance-tests/pkg-tests-specs/sources/commands/workspaces/foreach.test.js -t 'should include workspace dependencies resolved through catalogs'yarn workspace acceptance-tests test:integration packages/acceptance-tests/pkg-tests-specs/sources/commands/workspaces/foreach.test.js -t 'should include dependencies|should include workspace dependencies|following the topological order'yarn typecheck:allyarn version checkyarn constraintsgit diff --check