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

[🐛 Bug]: Updating wording on install command when installing dependencies in config wizard #12071

Closed
3 tasks done
Stalinko opened this issue Jan 23, 2024 · 8 comments · Fixed by #12089
Closed
3 tasks done

Comments

@Stalinko
Copy link

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

latest

Node.js Version

latest

Mode

Standalone Mode

Which capabilities are you using?

No response

What happened?

I'm using the standard installer through yarn:

yarn create wdio .

On the last step it asks if I want to run "npm install". I say "no" because I want to run "yarn" instead..
Then it creates the package.json with only one dependency:

{
  "name": "e2e",
  "type": "module",
  "devDependencies": {
    "@wdio/cli": "^8.29.0"
  },
  "scripts": {
    "wdio": "wdio run ./wdio.conf.js"
  }
}

Obviously the project won't work because it misses any other necessary packages.
If you try to run yarn run wdio it will fail.

However if you say "yes" on the last step it won't only run "npm install", but will also prefill the package.json with all the necessary packages selected during install.

What is your expected behavior?

It must generate complete package.json with all the selected packages even if you say "no" to "Run npm install" on the last step of the wizard.

How to reproduce the bug.

Just run yarn create wdio . and press N on the last step.
Then look at your package.json

Relevant log output

-

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues
@Stalinko Stalinko added Bug 🐛 Needs Triaging ⏳ No one has looked into the issue yet labels Jan 23, 2024
@christian-bromann
Copy link
Member

Hey @Stalinko , thanks for raising the issue.

On the last step it asks if I want to run "npm install". I say "no" because I want to run "yarn" instead..

The configuration wizard will use Yarn if it detects that your project is using it. Can you provide more details as you why you wouldn't want to have WebdriverIO install all the dependencies?

It must generate complete package.json with all the selected packages even if you say "no" to "Run npm install" on the last step of the wizard.

We are adding all dependencies as part of running an NPM or Yarn install script. So WebdriverIO doesn't actually do anything except on relying on these package managers to add the dependencies to the package.json. Surely we could parse the package.json and add our dependencies to it but that seems like a overly complicated effort for not much value. If the user doesn't want to install the dependencies we can't assume they are ok to add them to the project either.

@christian-bromann christian-bromann added Discussion and removed Bug 🐛 Needs Triaging ⏳ No one has looked into the issue yet labels Jan 23, 2024
@Stalinko
Copy link
Author

hey @christian-bromann thanks for response

The configuration wizard will use Yarn if it detects that your project is using it. Can you provide more details as you why you wouldn't want to have WebdriverIO install all the dependencies?

Sorry I didn't know this. The wizard asks exactly whether I want to run npm install even if I'm using yarn. But I don't want to run npm install, that's why my idea was to let the wizard create package.json for me and then run yarn manually afterwards.

We are adding all dependencies as part of running an NPM or Yarn install script.

But without adding these dependencies the script is useless. It doesn't matter what I select during the wizard steps - if I say "no" to "npm install" in the end then all the packages I selected will be ignored,

Maybe you should have split the last step into 2 like:

  • Please confirm updating of your package.json [Y/n] (though for me this should be done in any case)
  • Would you like to run npm install? [Y/n]

and in any case it should say "Would you like to run yarn?" when working with yarn.

@christian-bromann
Copy link
Member

and in any case it should say "Would you like to run yarn?" when working with yarn.

I agree, the wording should get fixed here.

Maybe you should have split the last step into 2 like:

Updating the package.json manually seems like some tedious work (reading, parsing and writing updates keeping the same formatting, and injecting the deps in alphabetical order etc.) with not much value in return. Most users like to install the dependencies and have the package.json updated.

I am not sure if it does this already but we could print out the dependencies that needs to be added so the user can inject them manually. Wdyt?

@Stalinko
Copy link
Author

Stalinko commented Jan 23, 2024

Most users like to install the dependencies and have the package.json updated.

Oooooh I've got it just now. I thought you're first updating the package.json somehow, and then just run "npm install" without arguments.
But it turns out you're adding the packages through npm install <package> and let the npm update the package.json

I am not sure if it does this already but we could print out the dependencies that needs to be added so the user can inject them manually. Wdyt?

There IS a way to update package.json without actually installing the packages: https://stackoverflow.com/a/51433146/2244262
But it seems like overengineering :) If you just fix the message to say "yarn" instead of "npm install" that should be enough. IMHO :)

@christian-bromann
Copy link
Member

But it turns out you're adding the packages through npm install <package> and let the npm update the package.json

Correct.

If you just fix the message to say "yarn" instead of "npm install" that should be enough.

Would you be interested raising a PR and contribute to the project?

@christian-bromann christian-bromann added help wanted Issues that are free to take by anyone interested good first pick a reasonable task to start getting familiar with the code base and removed Discussion labels Jan 23, 2024
@wdio-bot
Copy link
Contributor

Thanks for reporting!

We greatly appreciate any contributions that help resolve the bug. While we understand that active contributors have their own priorities, we kindly request your assistance if you rely on this bug being fixed. We encourage you to take a look at our contribution guidelines or join our friendly Discord development server, where you can ask any questions you may have. Thank you for your support, and cheers!

@christian-bromann christian-bromann changed the title [🐛 Bug]: Installer doesn't add dependencies in package.json if you say "no" to "Run npm install" on the latest step [🐛 Bug]: Updating wording on install command when installing dependencies in config wizard Jan 23, 2024
@Stalinko
Copy link
Author

Would you be interested raising a PR and contribute to the project?

Yes sure. Just need to learn your guidelines. Will try to commit soon 😄

@christian-bromann
Copy link
Member

Awesome, happy to help if there are any questions!

@christian-bromann christian-bromann removed help wanted Issues that are free to take by anyone interested good first pick a reasonable task to start getting familiar with the code base labels Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants