-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fix #1435 (failing dependencies of optional dependencies) #2811
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
yarn-offline-mirror=./mirror-for-offline | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"optionalDependencies": { | ||
"dep-optional": "1.0.0" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
[email protected]: | ||
version "1.0.0" | ||
resolved dep-optional-1.0.0.tgz#c8cbcee6f23932e14898a2dd4c76e38b37d31531 | ||
dependencies: | ||
dep-incompatible "1.0.0" | ||
|
||
[email protected]: | ||
version "1.0.0" | ||
resolved dep-incompatible-1.0.0.tgz#f711458d716eeb5c2cbbc11ee09edccedbb79e74 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
process.exit(0); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "optional-failing", | ||
"version": "0.0.0", | ||
"scripts": { | ||
"install": "node install.js" | ||
}, | ||
"dependencies": { | ||
"sub-failing": "file:../sub-failing" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"optionalDependencies": { | ||
"optional-dep": "file:optional-dep" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
process.exit(1); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "sub-failing", | ||
"version": "0.0.0", | ||
"scripts": { | ||
"install": "node install.js" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -281,7 +281,8 @@ export default class PackageRequest { | |
promises.push(this.resolver.find({ | ||
pattern: depPattern, | ||
registry: remote.registry, | ||
optional: false, | ||
// dependencies of optional dependencies should themselves be optional | ||
optional: this.optional, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if a dependency is optional in one subtree and is not optional in another:
Would it mark C as optional even though D requires it as a regular dependency? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pretty sure that would work fine because of this code but I'll add a unit test to prove it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm...couldn't your scenario be simplified to
and still prove what you are concerned about? I'm not seeing why the first chain has to have a depth of 3 -- am I missing something? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a gut feeling, we had problems with deeper chains of dependency :) |
||
parentRequest: this, | ||
})); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need offline mirror and .tgz files for the test?
I think you could be fine just using
file:
dependencies for testsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I don't think it's needed. I was trying to make the changes fit with their surroundings and mimic this test which uses a tgz file.
I'm happy to convert the new test to using
file:
dependencies. Should I also convert the one I modeled it after while I'm at it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let's make it simpler in both places.
.tgz file are harder to review