Skip to content
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

chore(cli): better group handling #1204

Merged
merged 10 commits into from Feb 6, 2020

Conversation

ematipico
Copy link
Contributor

What kind of change does this PR introduce?

A refactor of how configuration and arguments are handled and creating the final configuration to pass to webpack compiler

Did you add tests for your changes?
It's a refactor and all the existing tests are still passing

If relevant, did you update the documentation?
Yes, I added JSDoc to help the refactor

Summary

The problem of the current logic is that all the group helpers are randomly created and with a simple loop their logic is run. Which mean there's no order and we don't know which options comes first and which after.

For example, we have a group helper responsible to handle the configuration object (ConfigHelper) and we have a group helper responsible of the output (OutputHelper).
If OutputHelper is run first and ConfigHelper second, the information that we have inside the configuration will override the one inside the output, which is not the behaviour that the CLI should have.

The arguments passed via CLI have to override the one that we have inside the configuration. So now the order is the following:

  • defaults
  • webpack configuration
  • CLI arguments

Does this PR introduce a breaking change?

Nope

Other information

@ematipico ematipico requested a review from a team as a code owner February 5, 2020 14:04
@webpack-bot
Copy link

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

Copy link
Member

@rishabh3112 rishabh3112 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refactor!
Have left a review.

lib/groups/StatsGroup.js Outdated Show resolved Hide resolved
lib/groups/ZeroConfigGroup.js Outdated Show resolved Hide resolved
lib/groups/ZeroConfigGroup.js Outdated Show resolved Hide resolved
lib/utils/GroupHelper.js Show resolved Hide resolved
lib/utils/GroupHelper.js Outdated Show resolved Hide resolved
bin/cli.js Outdated Show resolved Hide resolved
Co-Authored-By: Rishabh Chawla <rishabh31121999@gmail.com>
ematipico and others added 5 commits February 5, 2020 16:52
Co-Authored-By: Rishabh Chawla <rishabh31121999@gmail.com>
Co-Authored-By: Rishabh Chawla <rishabh31121999@gmail.com>
Co-Authored-By: Rishabh Chawla <rishabh31121999@gmail.com>
…webpack-cli into feature/better-group-handling

# Conflicts:
#	lib/utils/GroupHelper.js
rishabh3112
rishabh3112 previously approved these changes Feb 5, 2020
Copy link
Member

@jamesgeorge007 jamesgeorge007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple of comments.

.prettierrc Show resolved Hide resolved
lib/webpack-cli.js Outdated Show resolved Hide resolved
lib/webpack-cli.js Show resolved Hide resolved
lib/webpack-cli.js Outdated Show resolved Hide resolved
lib/webpack-cli.js Outdated Show resolved Hide resolved
@webpack-bot
Copy link

@ematipico Thanks for your update.

I labeled the Pull Request so reviewers will review it again.

@jamesgeorge007 Please review the new changes.

@rishabh3112
Copy link
Member

Thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants