Skip to content

Fix missing subdeps in production install when those are present in devDependencies list - #2921

Merged
bestander merged 3 commits into
yarnpkg:masterfrom
blexrob:fix-prodininstall-missing-deduped-direct-devdeps
Apr 7, 2017
Merged

bestander merged 3 commits into
yarnpkg:masterfrom
blexrob:fix-prodininstall-missing-deduped-direct-devdeps

Conversation

@blexrob

@blexrob blexrob commented Mar 14, 2017

Copy link
Copy Markdown
Contributor

Summary

This PR fixes #2819.

This bug originates in the package hoister, which, in production mode, fails to mark devDependencies that are also a sub-dependency of the normal dependencies as non-ignored.

This happens in the following scenario:
dep: A -> B
devDep: B

In the first hoisting round, A en B are both processed. Because the reference to B was marked as 'ignore' in production mode, as a root package (without a parent) it will have inheritIsIgnored set to false. Later, when propagating non-ignoredness, B will be skipped (thus keeping it as ignored), and not installed (as well as its private subdepencies).

At the moment, the 'ignore' field in the package reference has a dual purpose - signalling incompatible optional packages and ignored devDependencies. When propagating non-ignoredness, it can always be propagated to devDependencies, but never to incompatible packages.

To fix the bug, this PR adds an explicit 'incompatible' flag in the package reference. In the packagehoister, the isIgnored flag is replaced with isRequired, better signalling intent. Propagating requiredness is done for all compatible packages, and inheritIsIgnored flag is replaced by checks for compatibility.

Test plan
A test has been added that fails before the fix, and passes after it. Also, I have recreated the package.json from #2819, and verified that gulp is now installed properly.

@blexrob

blexrob commented Apr 7, 2017

Copy link
Copy Markdown
Contributor Author

@SimenB requested a few extra tests in #2895 (comment), haven't come round to adding them.

@bestander
bestander merged commit 713d671 into yarnpkg:master Apr 7, 2017
@SimenB

SimenB commented Apr 7, 2017

Copy link
Copy Markdown
Contributor

Can this get backported to the freshly minted 0.22.0? 👼

@bestander

Copy link
Copy Markdown
Member

@SimenB, send a PR targeting 0.22-stable branch and we'll make a patch release.

@SimenB

SimenB commented Apr 7, 2017

Copy link
Copy Markdown
Contributor

@bestander done: #3065

bestander pushed a commit that referenced this pull request Apr 7, 2017
…evDependencies list (#2921) (#3065)

* Test for install skipping subdependencies when those are named in root devDependencies

* Add 'incompatible' flag to references, use that to ignore incompatible packages instead of faulty inherit logic. Fixes #2819

* Unconditionally mark packages as ignored, hoister now fully corrects transitive uses
arcanis pushed a commit to arcanis/yarn that referenced this pull request Apr 7, 2017
…evDependencies list (yarnpkg#2921)

* Test for install skipping subdependencies when those are named in root devDependencies

* Add 'incompatible' flag to references, use that to ignore incompatible packages instead of faulty inherit logic. Fixes yarnpkg#2819

* Unconditionally mark packages as ignored, hoister now fully corrects transitive uses
bestander pushed a commit that referenced this pull request Apr 7, 2017
* Checks that the webpack builds are working properly (#3064)

* Fix missing subdeps in production install when those are present in devDependencies list (#2921)

* Test for install skipping subdependencies when those are named in root devDependencies

* Add 'incompatible' flag to references, use that to ignore incompatible packages instead of faulty inherit logic. Fixes #2819

* Unconditionally mark packages as ignored, hoister now fully corrects transitive uses

* replaced deprecated asserts (#3069)

* fixing lint (#3070)

* Fixes integrity check for --production flag (#3067)

* fixed integrity check when running with --production

* added test

* removed unused var

* Remove the dependency on the "rc" module (#3063)

* Removes dependency on the "rc" module

* Removers shebang-loader, not used anymore

* Fixes flow errors

* Fixes tests on Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'yarn install --production' does not install transitive dependencies if listed as devDependencies in the project

3 participants