Skip to content

chore(cli): better group handling#1204

Merged
rishabh3112 merged 10 commits intowebpack:nextfrom
ematipico:feature/better-group-handling
Feb 6, 2020
Merged

chore(cli): better group handling#1204
rishabh3112 merged 10 commits intowebpack:nextfrom
ematipico:feature/better-group-handling

Conversation

@ematipico
Copy link
Copy Markdown
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
Copy Markdown

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

Copy link
Copy Markdown
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.

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
Copy Markdown
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.

@webpack-bot
Copy link
Copy Markdown

@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
Copy Markdown
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.

4 participants