Refactor visibility to fix numerous environmental bugs - #2116
Conversation
b98be45 to
8be51e4
Compare
| }, create); | ||
| }); | ||
|
|
||
| test.concurrent('--production flag ignores dev dependencies', () => { |
| key: String(opts.key || this.getOption('key') || ''), | ||
| }); | ||
|
|
||
| if (this.getOption('production') || process.env.NODE_ENV === 'production') { |
There was a problem hiding this comment.
We had a bug recently in React Native.
One of the scripts that calls yarn install had NODE_ENV = production and I could not override this with --no-production.
Should we open a separate issue for that?
| Object.assign(manifest, json); | ||
|
|
||
| const pushDeps = (depType, {hint, visibility, optional}) => { | ||
| const pushDeps = (depType, {hint, optional}, isUsed) => { |
There was a problem hiding this comment.
I don't know your stance/thoughts on default parameters, but you could default isUsed = true here and in the one instance below just pass in the evaluation of production flag.
There was a problem hiding this comment.
I've changed the callsites so there's just one use of true now. Eventually if we add a --dev-only flag we'd have to remove it anyway so I don't think there's much value.
8be51e4 to
0a0f445
Compare
|
Just tried this against one of our apps and I'm still seeing problems:
Example for 2.: I suspect the problem is that those lodash/minimist/mkdirp are used elsewhere in the tree and the "is in use" logic doesn't handle the case where the same |
|
@jkrems Try the latest version of this PR, I've pushed a few times since creating it. |
0a0f445 to
40fe079
Compare
|
Same result w/ 40fe079. |
|
|
||
| const install2 = new Install({flat: true}, config, reporter, lockfile); | ||
| expect(install2.generateIntegrityHash('foo', [])).not.toEqual(install.generateIntegrityHash('foo', [])); | ||
| test.concurrent('hoisting should factor ignored dependencies', async () => { |
|
Looks good, do you know why it fails on Windows with this? |
bestander
left a comment
There was a problem hiding this comment.
Looks great, merge once the Windows build is green
|
@jkrems Can you put together some small steps that I can use to repro? I'm not sure what issue you're describing so it's hard for me to reproduce or add a test for it. |
1a1d038 to
2c8d15f
Compare
|
Sorry, I assume I forgot to run Looks good now! No more non-prod packages in |
2c8d15f to
d15c473
Compare
|
Tests are passing across all CI. |
Summary
This PR refactors package visibility, simplifies it heavily and fixes numerous bugs around production and optional dependencies.
productionflag fromconfigrather than anInstallinstance.Test plan
npm run test