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

fix: merge resolvers #2049

Merged
merged 10 commits into from Nov 7, 2020
Merged

fix: merge resolvers #2049

merged 10 commits into from Nov 7, 2020

Conversation

anshumanv
Copy link
Member

What kind of change does this PR introduce?

refactor

Did you add tests for your changes?
Yes

If relevant, did you update the documentation?
NA

Summary

This merges multiple arg resolvers so we don't run them all separately even when they're simple. Not merged with config resolver as it's quite complex.

Does this PR introduce a breaking change?
No

Other information

@codecov
Copy link

codecov bot commented Nov 6, 2020

Codecov Report

Merging #2049 into master will decrease coverage by 0.51%.
The diff coverage is 89.02%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2049      +/-   ##
==========================================
- Coverage   68.82%   68.31%   -0.52%     
==========================================
  Files          82       77       -5     
  Lines        2435     2408      -27     
  Branches      493      496       +3     
==========================================
- Hits         1676     1645      -31     
- Misses        759      763       +4     
Impacted Files Coverage Δ
packages/webpack-cli/lib/utils/arg-parser.js 93.47% <ø> (ø)
packages/webpack-cli/lib/webpack-cli.js 90.19% <89.02%> (-3.93%) ⬇️
...kages/webpack-cli/lib/utils/get-package-manager.js 83.33% <0.00%> (-3.34%) ⬇️
packages/webpack-cli/lib/utils/cli-flags.js 100.00% <0.00%> (ø)
...kages/webpack-cli/lib/utils/prompt-installation.js 33.33% <0.00%> (ø)
packages/webpack-cli/lib/groups/resolveAdvanced.js

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 53bc4ee...021f4d9. Read the comment docs.

@anshumanv anshumanv marked this pull request as ready for review November 6, 2020 11:49
@anshumanv anshumanv requested a review from a team as a code owner November 6, 2020 11:49
return finalOptions;
}
};
Copy link
Member

Choose a reason for hiding this comment

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

Let's move it to WebpackCLI classs as method resolveArgs

Copy link
Member

Choose a reason for hiding this comment

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

No groups anymore

Copy link
Member Author

Choose a reason for hiding this comment

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

yes we can move but then it will be a big file, still continue?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think it will be very big, keeping logic in one places sometimes is better than separate it, this will help us in future improvements and refactor to see everything

Copy link
Member Author

Choose a reason for hiding this comment

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

cool lets do it

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Anyway good job, one note and we can merge it

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Couple improvements and we can merge it

@alexander-akait
Copy link
Member

And let's fix tests

@alexander-akait
Copy link
Member

Great, I will merge after CI green, next - let's refactor and resolving config as method resolveConfig

@anshumanv
Copy link
Member Author

Yep

@alexander-akait
Copy link
Member

@anshumanv tests still broken

@anshumanv
Copy link
Member Author

Yes wip 😄

@@ -48,7 +48,8 @@ class WebpackCLI {

async resolveArgs(args, configOptions = {}) {
// Since color flag has a default value, when there are no other args then exit
if (Object.keys(args).length === 1) return {};
// eslint-disable-next-line no-prototype-builtins
if (Object.keys(args).length === 1 && args.hasOwnProperty('color')) return {};
Copy link
Member

Choose a reason for hiding this comment

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

Why we have color property here?

Copy link
Member Author

Choose a reason for hiding this comment

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

because color is default in args, we only need to skip it in that case

Copy link
Member Author

Choose a reason for hiding this comment

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

in tests we're passing properties which are not color

Copy link
Member

Choose a reason for hiding this comment

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

hm, why we have color in args?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think default is assigned there, will take a look and remove next

Copy link
Member

Choose a reason for hiding this comment

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

Yep, let's do it in the new PR

Copy link
Member

Choose a reason for hiding this comment

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

WIP already on color #2042 (comment)

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Good improve, A couple more of these things and we will normalize the architecture, and it will be very easy to fix errors in future

@snitin315 snitin315 merged commit 3feaae6 into webpack:master Nov 7, 2020
@anshumanv anshumanv deleted the merge-res branch November 7, 2020 05:10
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