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(cli): throws err when no args passed #862

Merged
merged 15 commits into from
Jun 1, 2019

Conversation

pranshuchittora
Copy link
Member

Closes #861
** Behaviour after fix **
Screenshot from 2019-04-26 11-50-10

What kind of change does this PR introduce?
bugfix

Did you add tests for your changes?
Nopes

trows an error when webpack is not installed and no args passed to the cli
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.

Left a few suggestions! Thanks.

bin/cli.js Outdated Show resolved Hide resolved
bin/cli.js Outdated Show resolved Hide resolved
Copy link
Contributor

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

I think there are two user cases:

  • webpack not installed and no args passed
  • webpack intalled and no args passed

bin/cli.js Outdated Show resolved Hide resolved
tells user to install webpack in order for futher procedures
@pranshuchittora
Copy link
Member Author

pranshuchittora commented Apr 26, 2019

Progress so far:

  • Asks the user to install webpack if it's not been installed && no args passed.

Screenshot from 2019-04-27 01-20-49

  • Shows dynamic message based on package manager. (Default npm)

Screenshot from 2019-04-27 15-39-08

Copy link
Member

@EugeneHlushko EugeneHlushko left a comment

Choose a reason for hiding this comment

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

Looks like it works from the discussion, but code can be shaped better if you want to improve it

bin/cli.js Outdated Show resolved Hide resolved
bin/cli.js Outdated Show resolved Hide resolved
@EugeneHlushko
Copy link
Member

Yes thats what i meant, thank you for implementing 👍

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

Looks great now, left a suggestion :)

bin/cli.js Show resolved Hide resolved
@pranshuchittora
Copy link
Member Author

Need help: Reason for failing CI

@ematipico
Copy link
Contributor

Please rebase, we removed node 6 from the CI

@webpack-bot
Copy link

@pranshuchittora Thanks for your update.

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

@ematipico Please review the new changes.

modified the default stack trace limit and made cli to exit with exit code 1 when no args passed and webpack is not installed
bin/cli.js Outdated Show resolved Hide resolved
bin/cli.js Outdated
@@ -70,6 +70,20 @@ For more information, see https://webpack.js.org/api/cli/.`);
try {
options = require("./utils/convert-argv")(argv);
} catch (err) {
if (err.code === "MODULE_NOT_FOUND") {
let errorMessage =
"\n\u001b[31mwebpack not found, \u001b[33mplease install webpack using\n\t\u001b[32mnpm install --save-dev webpack\n";
Copy link
Member

Choose a reason for hiding this comment

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

webpack not installed, consider installing it using npm install --save-dev webpack

Copy link
Member

Choose a reason for hiding this comment

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

Indentation seems weird here, you don't need different color schemes for the not found part, the please install part and the installation text. Two colors is sufficient, one for the error stack and one for the npm save

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

updates the err message
@pranshuchittora
Copy link
Member Author

Some clarification regarding the return statement.

  • If the func won't return, then a frightening err message will logs out.

Screenshot from 2019-06-01 21-46-29

@pranshuchittora
Copy link
Member Author

@evenstensberg pls review the final changes.
#ReadyToMerge

fixes the linting err
@evenstensberg
Copy link
Member

Tests are failing, could you revise? Having a look now at how it's looking

Copy link
Member

@evenstensberg evenstensberg left a comment

Choose a reason for hiding this comment

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

lgtm, do you mind fixing the eslint stuff? Other than that I think we're ready to merge

console.error(errorMessage);
Error.stackTraceLimit = 1;
process.exitCode = 1;
return;
Copy link
Member

Choose a reason for hiding this comment

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

I guess this is fine, as long as we're doing it in the scope of only MODULE_NOT_FOUND

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.

🐞[cli]: throws err when no args passed.
6 participants