[rush-lib] Refactor alwaysInjectDependenciesFromOtherSubspaces logic #4724
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.
Summary
We check the injected settings in the package.json to tell if a dependency is injected or not.
However, in the current alwaysInjectDependenciesFromOtherSubspaces implementation, user no need to set injected settings in package.json for these cross subspace dependencies. This leads to inconvenience to check if a dependency is injected or not.
The alternative we check the version representation in pnpm-lock.yaml to see if it is started with
file:
, if yes, then it is a injected dependency. But, this method also has drawback, not all dependencies started withfile:
is the injected dependency, for example , we can't treat thisfile:./tarball/colors-1.4.0.tgz
as a injected dependency.So, we need to refactor the alwaysInjectDependenciesFromOtherSubspaces logic. Now, if user enable this logic, we write
injected:true
in thepackage.json
Details
How it was tested
Impacted documentation