-
-
Notifications
You must be signed in to change notification settings - Fork 621
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
Better CLI #121
Better CLI #121
Conversation
- Rename migrate and init options to command. Closes #89 - Use `commands` from yargs - Add start command and made it default - Move all options to one place - Show options only for start command
Ready for review @okonet ? |
Almost there. |
So after spending a good amount of time on this, I reached a dead end it seems. I can't think of a good way of doing this change as a non-breaking change to the existing webpack CLI. The problem is that current CLI syntax looks like this Making Another issue I tried to solve is to not display all options by default when running A breaking change means an introduction of an additional command for webpack default behavior. For example There is probably a solution for this that involves parsing of arguments but I'm not sure yet how reliable this can be implemented. Any feedback is appreciated! @sokra I think you should be involved in this discussion since implications can be pretty big. |
Any good ideas @sokra |
We discussed on Slack but I'm a bit drawn by work now so I'll continue on this in a week or so. |
Usage without config file: webpack <entry> [<entry>] <output> | ||
Usage with config file: webpack | ||
`) | ||
.epilogue('for more information see https://webpack.github.io/docs/cli.html') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should point to new docs?
@okonet anything here for me to help with? |
More free time would be great :( Seriously though, having tests would help dramatically before I refactor even further. Not sure how much of this is covered. |
@okonet we should get that react test suite up and running first, yea? |
What react test suit? You mean Jest snapshot tests? yes, that would be great to have. We need 100% coverage if we don't want break current implementation. |
@okonet You mentioned on Slack that instead of Soren, you could use this https://github.com/vadimdemedes/ink for testing |
@ev1stensberg it's not for testing but for the CLI itself and I'd like to look into it. |
@okonet gotcha! We would need to come up with a way to test E2E and produce results, both for the new features but also the "old" CLI commands that webpack have. |
May be better to redo this in another fresh PR after its been merged with webpack, closing @okonet , reopen if you want to continue to work on this branch! |
What kind of change does this PR introduce?
feature / refactoring
Did you add tests for your changes?
No, we need to introduce e2e tests for that
If relevant, did you update the documentation?
Yes
Summary
Refactors the CLI code so we use commands for
migrate
andinit
.Made use of yargs to simplify the source code.
Consolidated all webpack options into one file.
Does this PR introduce a breaking change?
Yes, the commands should be now called with
webpack-cli migrate
instead ofwebpack-cli --migrate
Other information