-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fix devDependencies being installed when passing --production #4210
Conversation
Hi @olingern, thanks a lot for the PR! That said this is not the correct approach at all. Let me elaborate.
It does not. It just resolves these dependencies too to get a complete and consistent picture of all dependencies. See #3630 (comment) Unfortunately your diagnosis is not correct. I have just tested this locally and In its current form, this PR is not mergable because it actually breaks a core functionality as you can tell from the failing unit tests. What needs to be done is preventing resolution requests from happening for This may not be an easy thing to solve TBH :( |
I see. Looking at this more closely, looks to be an oversight on my part :(
I see. So, this block below from steps.push(async (curr: number, total: number) => {
this.reporter.step(curr, total, this.reporter.lang('resolvingPackages'), emoji.get('mag'));
await this.resolver.init(this.prepareRequests(depRequests), {
isFlat: this.flags.flat,
isFrozen: this.flags.frozenLockfile,
workspaceLayout,
});
topLevelPatterns = this.preparePatterns(rawPatterns);
flattenedTopLevelPatterns = await this.flatten(topLevelPatterns);
return {bailout: await this.bailout(topLevelPatterns, workspaceLayout)};
}); If this is a behemoth of a task to take on, I can close this out for now |
It may be. Sorry, we were too busy working towards 1.0 tasks, hence the radio silence. Will come back to this in a few weeks. |
😢 |
@BYK Not to worry :) I'd love to work on this, but I think my initial diagnosis of the problem was off the mark. It's probably easier / makes more sense to start anew when there's more of a consensus on a solution
Ping me on Discord @olingern if it's easier to chat there :) |
Quick fix for #3630
Sypnosis:
Passing
--production
flag to yarn installs currently still installsdevDependencies
Notes:
This is a quick fix. I think there could be a good refactor to move dependency retrieval out of
fetchRequestFromCwd
for testability, and reduce the number of states thatpushDeps
tries to handle at the moment.Let me know if merging this now is good, or if I should break this apart / add tests.
Cause:
devDependencies
is always called, and the var,isUsed
, should handle this -- but the early return never happens due toignoreUnusedPatterns
evaluating to false.