create-wdio 8.4.8 → 8.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -34,7 +34,7 @@ _[`npx`](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f
34
34
  npm init wdio@latest ./e2e
35
35
  ```
36
36
 
37
- _[`npm init <initializer>`](https://docs.npmjs.com/cli/v7/commands/npm-init) is available in npm 6+_
37
+ _[`npm init <initializer>`](https://docs.npmjs.com/cli/v10/commands/npm-init) is available in npm 6+_
38
38
 
39
39
  #### yarn
40
40
 
@@ -47,8 +47,8 @@ export const PROGRAM_TITLE = `
47
47
  ${colorIt('test framework for Node.js')}
48
48
  `;
49
49
  export const UNSUPPORTED_NODE_VERSION = ('⚠️ Unsupported Node.js Version Error ⚠️\n' +
50
- `You are using Node.js ${process.version} which is to old to be used with WebdriverIO.\n` +
51
- 'Please update to Node.js v16 to continue.\n');
50
+ `You are using Node.js ${process.version} which is too old to be used with WebdriverIO.\n` +
51
+ 'Please update to Node.js v20 to continue.\n');
52
52
  export const INSTALL_COMMAND = {
53
53
  npm: 'install',
54
54
  pnpm: 'add',
package/build/index.js CHANGED
@@ -21,7 +21,7 @@ export async function run(operation = createWebdriverIO) {
21
21
  /**
22
22
  * ensure right Node.js version is used
23
23
  */
24
- const unsupportedNodeVersion = !semver.satisfies(process.version, '>=16');
24
+ const unsupportedNodeVersion = !semver.satisfies(process.version, '>=18.18.0');
25
25
  if (unsupportedNodeVersion) {
26
26
  console.log(chalk.yellow(UNSUPPORTED_NODE_VERSION));
27
27
  return;
@@ -39,19 +39,26 @@ export async function run(operation = createWebdriverIO) {
39
39
  .parse(process.argv);
40
40
  return operation(program.opts());
41
41
  }
42
+ /**
43
+ * detects the package manager that was used
44
+ * uses the environment variable `npm_config_user_agent` to detect the package manager
45
+ * falls back to `npm` if no package manager could be detected
46
+ */
47
+ function detectPackageManager() {
48
+ if (!process.env.npm_config_user_agent) {
49
+ return 'npm';
50
+ }
51
+ const detectedPM = process.env.npm_config_user_agent.split('/')[0].toLowerCase();
52
+ const matchedPM = PMs.find(pm => pm.toLowerCase() === detectedPM);
53
+ return matchedPM || 'npm';
54
+ }
42
55
  export async function createWebdriverIO(opts) {
43
56
  const npmTag = opts.npmTag.startsWith('@') ? opts.npmTag : `@${opts.npmTag}`;
44
57
  const root = path.resolve(process.cwd(), projectDir || '');
45
58
  /**
46
59
  * find package manager that was used to create project
47
60
  */
48
- const pm = PMs.find((pm) => (
49
- // for pnpm check "~/Library/pnpm/store/v3/..."
50
- // for NPM check "~/.npm/npx/..."
51
- // for Yarn check "~/.yarn/bin/create-wdio"
52
- // for Bun check "~/.bun/bin/create-wdio"
53
- process.argv[1].includes(`${path.sep}${pm}${path.sep}`) ||
54
- process.argv[1].includes(`${path.sep}.${pm}${path.sep}`))) || 'npm';
61
+ const pm = detectPackageManager();
55
62
  const hasPackageJson = await fs.access(path.resolve(root, 'package.json')).then(() => true).catch(() => false);
56
63
  if (!hasPackageJson) {
57
64
  await fs.mkdir(root, { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-wdio",
3
- "version": "8.4.8",
3
+ "version": "8.4.10",
4
4
  "description": "Install and setup a WebdriverIO project with all its dependencies in a single run",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "license": "MIT",
@@ -25,7 +25,7 @@
25
25
  "type": "module",
26
26
  "scripts": {
27
27
  "build": "run-s clean compile",
28
- "clean": "rimraf tsconfig.tsbuildinfo ./build ./coverage",
28
+ "clean": "rm -rf tsconfig.tsbuildinfo ./build ./coverage",
29
29
  "compile": "tsc -p ./tsconfig.json",
30
30
  "release": "release-it --github.release",
31
31
  "release:ci": "npm run release -- --ci --npm.skipChecks --no-git.requireCleanWorkingDir",
@@ -33,23 +33,25 @@
33
33
  "release:minor": "npm run release -- minor",
34
34
  "release:major": "npm run release -- major",
35
35
  "test": "run-s build test:*",
36
- "test:eslint": "eslint -c ./.eslintrc.cjs ./src/**/*.ts ./tests/**/*.ts",
37
- "test:unit": "vitest --run",
38
- "watch": "npm run compile -- --watch"
36
+ "test:eslint": "eslint -c ./eslint.config.js ./src/**/*.ts ./tests/**/*.ts",
37
+ "test:unit": "vitest run",
38
+ "watch": "npm run compile -- --watch",
39
+ "watch:test": "vitest watch"
39
40
  },
40
41
  "devDependencies": {
42
+ "@eslint/js": "^9.13.0",
41
43
  "@types/cross-spawn": "^6.0.6",
44
+ "@types/eslint__js": "^8.42.3",
42
45
  "@types/node": "^22.0.0",
43
46
  "@types/semver": "^7.5.8",
44
- "@typescript-eslint/eslint-plugin": "^8.1.0",
45
- "@typescript-eslint/parser": "^8.1.0",
46
47
  "@vitest/coverage-v8": "^2.0.5",
47
- "eslint": "^8.57.0",
48
- "eslint-plugin-import": "^2.29.1",
49
- "eslint-plugin-unicorn": "^55.0.0",
48
+ "eslint": "^9.13.0",
49
+ "eslint-plugin-import": "^2.31.0",
50
+ "eslint-plugin-unicorn": "^56.0.0",
50
51
  "npm-run-all": "^4.1.5",
51
52
  "release-it": "^17.6.0",
52
- "typescript": "^5.5.4",
53
+ "typescript": "^5.6.3",
54
+ "typescript-eslint": "^8.10.0",
53
55
  "vitest": "^2.0.5"
54
56
  },
55
57
  "dependencies": {
package/vitest.config.ts CHANGED
@@ -7,17 +7,17 @@ export default defineConfig({
7
7
  /**
8
8
  * not to ESM ported packages
9
9
  */
10
- exclude: [
11
- 'build', '.idea', '.git', '.cache',
12
- '**/node_modules/**', '__mocks__'
13
- ],
10
+ exclude: ['build', '.idea', '.git', '.cache', '**/node_modules/**', '__mocks__'],
14
11
  coverage: {
15
12
  enabled: true,
16
- exclude: ['**/build/**', '__mocks__', '**/*.test.ts'],
17
- lines: 97,
18
- functions: 80,
19
- branches: 70,
20
- statements: 97
21
- }
22
- }
13
+ include: ['src/**/*.ts'],
14
+ exclude: ['src/types.ts'],
15
+ thresholds: {
16
+ lines: 96,
17
+ functions: 80,
18
+ branches: 70,
19
+ statements: 96,
20
+ },
21
+ },
22
+ },
23
23
  })
package/.eslintrc.cjs DELETED
@@ -1,45 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- parser: '@typescript-eslint/parser',
4
- plugins: ['@typescript-eslint', 'unicorn'],
5
- extends: [
6
- 'eslint:recommended',
7
- 'plugin:import/errors',
8
- 'plugin:import/warnings'
9
- ],
10
- env: {
11
- node: true,
12
- es6: true,
13
- jest: true
14
- },
15
- parserOptions: {
16
- ecmaVersion: 2019,
17
- sourceType: 'module'
18
- },
19
- rules: {
20
- semi: ['error', 'never'],
21
- quotes: ['error', 'single'],
22
- indent: [2, 4],
23
-
24
- 'no-constant-condition': 0,
25
- // see https://stackoverflow.com/questions/55280555/typescript-eslint-eslint-plugin-error-route-is-defined-but-never-used-no-un
26
- 'no-unused-vars': 'off',
27
- '@typescript-eslint/no-unused-vars': 'error',
28
-
29
- 'import/no-unresolved': 0,
30
- 'import/named': 2,
31
- 'import/namespace': 2,
32
- 'import/default': 2,
33
- 'import/export': 2,
34
-
35
- 'unicorn/prefer-node-protocol': ['error']
36
- },
37
- overrides: [
38
- {
39
- files: ['*.ts'],
40
- rules: {
41
- 'no-undef': 'off'
42
- }
43
- }
44
- ]
45
- }