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

Interesting behavior when using info as a value for --info-verbosity #1383

Closed
lukaselmer opened this issue Mar 26, 2020 · 9 comments · Fixed by #1827
Closed

Interesting behavior when using info as a value for --info-verbosity #1383

lukaselmer opened this issue Mar 26, 2020 · 9 comments · Fixed by #1827
Labels
Milestone

Comments

@lukaselmer
Copy link

The command npx webpack-cli --watch --progress --info-verbosity info executes npx webpack-cli info instead of setting the flag --info-verbosity to info.

Examples to reproduce the issue:

> npx webpack-cli --version --info-verbosity none
npx: installed 204 in 17.126s
3.3.11
=> all good

> npx webpack-cli --version --info-verbosity verbose
npx: installed 204 in 16.779s
3.3.11
=> all good

>npx webpack-cli --version --info-verbosity thisisatest
npx: installed 204 in 21.704s
3.3.11
=> all good

> npx webpack-cli --version --info-verbosity info
npx: installed 204 in 12.299s
The command moved into a separate package: @webpack-cli/info
Would you like to install info? (That will run yarn add -D @webpack-cli/info) (yes/NO) : %
=> tries to install the info package, so it can run `webpack-cli info`!

What is the current behavior?

> npx webpack-cli --version --info-verbosity info
npx: installed 204 in 12.299s
The command moved into a separate package: @webpack-cli/info
Would you like to install info? (That will run yarn add -D @webpack-cli/info) (yes/NO) : %
=> tries to install the info package (or displays the info if already installed)
=> so it actually runs `webpack-cli info` :(

To Reproduce

See above

Expected behavior

> npx webpack-cli --version --info-verbosity info
npx: installed 204 in 12.299s
3.3.11

Please paste the results of webpack-cli info here, and mention other relevant information

> npx webpack-cli --watch --info-verbosity info

undefined

watch is an invalid option

info-verbosity is an invalid option

infoVerbosity is an invalid option

  System:
    OS: macOS 10.15.3
    CPU: (8) x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
    Memory: 512.84 MB / 16.00 GB
  Binaries:
    Node: 12.16.1 - ~/.asdf/installs/nodejs/12.16.1/bin/node
    Yarn: 1.22.4 - ~/.asdf/installs/nodejs/12.16.1/bin/yarn
    npm: 6.14.4 - ~/w/cockpit/node_modules/.bin/npm
  Browsers:
    Chrome: 80.0.3987.149
    Firefox: 71.0
    Safari: 13.0.5
  npmPackages:
    tsconfig-paths-webpack-plugin: ^3.2.0 => 3.2.0
    webpack: ^4.42.1 => 4.42.1
    webpack-bundle-analyzer: ^3.6.1 => 3.6.1
    webpack-cli: ^3.3.11 => 3.3.11
@lukaselmer lukaselmer changed the title Command line parsing bug when using info as a value for --info-verbosity Interesting behavior when using info as a value for --info-verbosity Mar 28, 2020
@snitin315
Copy link
Member

@lukaselmer could you say the same against beta?

Screenshot from 2020-03-29 14-24-50

@lukaselmer
Copy link
Author

@lukaselmer could you say the same against beta?

Screenshot from 2020-03-29 14-24-50

@snitin315: Yes, the issue still persists in the beta release:

> npx webpack-cli@4.0.0-beta.8 --version --info-verbosity verbose
npx: installed 91 in 3.508s
4.0.0-beta.8
[...error unrelated to the issue, see screenshot]

> npx webpack-cli@4.0.0-beta.8 --version --info-verbosity info
npx: installed 91 in 3.876s
The command moved into a separate package: @webpack-cli/info
Would you like to install info? (That will run yarn add -D @webpack-cli/info) (yes/NO) : 
[...error unrelated to the issue, see screenshot]

> npx webpack-cli --version --info-verbosity verbose
3.3.11

> npx webpack-cli --version --info-verbosity info
The command moved into a separate package: @webpack-cli/info
Would you like to install info? (That will run yarn add -D @webpack-cli/info) (yes/NO) : %                                                                                                                         

image

@snitin315 what happens when you run npx webpack-cli --version --info-verbosity info and npx webpack-cli@4.0.0-beta.8 --version --info-verbosity info on your machine?

@alexander-akait
Copy link
Member

alexander-akait commented Mar 31, 2020

Thanks for the issue

@alexander-akait alexander-akait added this to the next milestone Mar 31, 2020
@snitin315
Copy link
Member

snitin315 commented Apr 2, 2020

@lukaselmer Working for me in beta.

Screenshot from 2020-04-02 10-00-37

@snitin315
Copy link
Member

@snitin315 what happens when you run npx webpack-cli --version --info-verbosity info and npx webpack-cli@4.0.0-beta.8 --version --info-verbosity info on your machine?

npx webpack-cli --version --info-verbosity info works fine
npx webpack-cli@4.0.0-beta.8 --version --info-verbosity info this installs beta first and works fine.

Screenshot from 2020-04-02 10-05-48

@alexander-akait
Copy link
Member

@snitin315 Can you send tests to ensure we don't have that problem?

@snitin315
Copy link
Member

Sure , on it.

@anshumanv
Copy link
Member

@evilebottnawi, was able to reproduce this on a machine which doesn't have webpack installed, right now we're expecting the user to supply the webpack version of their choice via peerDependencies, and since when run via npx and the user doesn't have webpack installed globally this throws, only solution that I can think of right now is moving it to dependencies, please let me know if there are any alternatives, will fix appropriately.

image

@alexander-akait
Copy link
Member

@anshumanv we can't fix it, people should have webpack in deps, anyway I think we can improve DX, for example check that webpack is not installed and answer question about installation, for example:

Looks webpack is not installed, do you want install? [Y,n]

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

Successfully merging a pull request may close this issue.

4 participants