webdriverio / create-wdio

One-line installer for WebdriverIO
https://webdriver.io
MIT License
21 stars 10 forks source link

This starter toolkit is using deprecated and no longer updated 'wdio' package #802

Closed gavvvr closed 4 weeks ago

gavvvr commented 4 weeks ago

The problem is this line:

https://github.com/webdriverio/create-wdio/blob/b0c8605cab99f5f0130ca86407e55cd9fba3bdfb/src/index.ts#L18

So, this starter toolkit is using deprecated and no longer updated wdio package v6.0.1 which is 3 years old. I guess it should be using @wdio/cli nowadays.

christian-bromann commented 4 weeks ago

wdio is still the command name for the @wdio/cli package. It is not required to take the same name for a CLI as the NPM package name. Writing wdio is easier than @wdio/cli. So if you npm install @wdio/cli you get a CLI command called wdio.

gavvvr commented 4 weeks ago

@christian-bromann oh, you are right. I was pretty sure it was using deprecated CLI for the following reasons. I conducted the experiment:

# npx wdio --version
Need to install the following packages:
wdio@6.0.1
Ok to proceed? (y)

npm warn deprecated wdio@6.0.1: This package got deprecated. Please use the 'create-wdio' starter toolkit via: 'npm init wdio ./path/to/project' or 'yarn create wdio ./path/to/project'.
v6.0.1

The output shows "v6.0.1" and the corresponding warning.

It seemed like the starter does the same (npx wdio config ...). Why I thought so? Because:

https://github.com/webdriverio/create-wdio/blob/b0c8605cab99f5f0130ca86407e55cd9fba3bdfb/src/index.ts#L94-L99

What is the EXECUTER for npm? It's npx:

https://github.com/webdriverio/create-wdio/blob/b0c8605cab99f5f0130ca86407e55cd9fba3bdfb/src/constants.ts#L67-L68

What is the EXECUTE_COMMAND for npm? it's an empty string:

https://github.com/webdriverio/create-wdio/blob/b0c8605cab99f5f0130ca86407e55cd9fba3bdfb/src/constants.ts#L74-L75

Thus, indeed the starter executes npx wdio config ..., which in clean Docker experiment from above has shown v6.0.1 to me. But there is the difference I did not take into consideration while submitting this issue: before calling npx wdio config the starter installs @wdio/cli, which already provides wdio command and thus starter does not need to resolve legacy package from npm anymore. It uses the most up-to-date command provided by @wdio/cli: https://github.com/webdriverio/create-wdio/blob/b0c8605cab99f5f0130ca86407e55cd9fba3bdfb/src/index.ts#L85-L90

christian-bromann commented 4 weeks ago

FWIW we have access to the wdio NPM package and could make it work for both. We could create an empty project which basically just delegates to this package OR we could publish this package with two different names: create-wdio and wdio, right? WDYT?