-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: incorrect optional ignore in nested dependencies (#4448)
**Summary** Fixes #4445. The bug was introduced in https://github.com/yarnpkg/yarn/pull/3976/files#diff-7066979f95168f7bb59e4f9cfb3ba8fcR211 with an incomplete package optional check. This caused many transient dependencies to be ignored at linking stage when `--ignore-optional` flag is passed. This patch fixes the check to combine the flag with the package's actual optional mark. **Test plan** Manually verified #4445 is resolved. Also added a unit test.
- Loading branch information
Showing
8 changed files
with
34 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
3 changes: 3 additions & 0 deletions
3
__tests__/fixtures/install/install-optional-dependencies/dep-a/package.json
This file contains 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
10 changes: 10 additions & 0 deletions
10
__tests__/fixtures/install/install-optional-dependencies/dep-c/package.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "dep-c", | ||
"version": "1.0.0", | ||
"optionalDependencies": { | ||
"dep-e": "file:../dep-e" | ||
}, | ||
"dependencies": { | ||
"dep-d": "file:../dep-d" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
__tests__/fixtures/install/install-optional-dependencies/dep-d/package.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "dep-d", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"dep-e": "file:../dep-e" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
__tests__/fixtures/install/install-optional-dependencies/dep-e/package.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "dep-e", | ||
"version": "1.0.0" | ||
} |
This file contains 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
This file contains 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
This file contains 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