create-wdio 8.4.0 → 8.4.1
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/build/constants.js +12 -0
- package/build/index.js +9 -6
- package/package.json +1 -1
package/build/constants.js
CHANGED
|
@@ -55,6 +55,18 @@ export const INSTALL_COMMAND = {
|
|
|
55
55
|
yarn: 'add',
|
|
56
56
|
bun: 'install'
|
|
57
57
|
};
|
|
58
|
+
export const EXECUTER = {
|
|
59
|
+
npm: 'npx',
|
|
60
|
+
pnpm: 'pnpm',
|
|
61
|
+
yarn: 'yarn',
|
|
62
|
+
bun: 'bunx'
|
|
63
|
+
};
|
|
64
|
+
export const EXECUTE_COMMAND = {
|
|
65
|
+
npm: '',
|
|
66
|
+
pnpm: 'exec',
|
|
67
|
+
yarn: 'exec',
|
|
68
|
+
bun: ''
|
|
69
|
+
};
|
|
58
70
|
export const DEV_FLAG = {
|
|
59
71
|
npm: '--save-dev',
|
|
60
72
|
pnpm: '--save-dev',
|
package/build/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import semver from 'semver';
|
|
|
6
6
|
import { Command } from 'commander';
|
|
7
7
|
import { resolve } from 'import-meta-resolve';
|
|
8
8
|
import { runProgram, getPackageVersion } from './utils.js';
|
|
9
|
-
import { ASCII_ROBOT, PROGRAM_TITLE, UNSUPPORTED_NODE_VERSION, DEFAULT_NPM_TAG, INSTALL_COMMAND, DEV_FLAG, PMs } from './constants.js';
|
|
9
|
+
import { ASCII_ROBOT, PROGRAM_TITLE, UNSUPPORTED_NODE_VERSION, DEFAULT_NPM_TAG, INSTALL_COMMAND, DEV_FLAG, PMs, EXECUTER, EXECUTE_COMMAND } from './constants.js';
|
|
10
10
|
import { execSync } from 'node:child_process';
|
|
11
11
|
const WDIO_COMMAND = 'wdio';
|
|
12
12
|
let projectDir;
|
|
@@ -46,9 +46,11 @@ export async function createWebdriverIO(opts) {
|
|
|
46
46
|
* find package manager that was used to create project
|
|
47
47
|
*/
|
|
48
48
|
const pm = PMs.find((pm) => (
|
|
49
|
-
// for pnpm check
|
|
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"
|
|
50
53
|
process.argv[1].includes(`${path.sep}${pm}${path.sep}`) ||
|
|
51
|
-
// for NPM and Yarn check for "~/.npm/npx/..." or "~/.yarn/bin/create-wdio"
|
|
52
54
|
process.argv[1].includes(`${path.sep}.${pm}${path.sep}`))) || 'npm';
|
|
53
55
|
const hasPackageJson = await fs.access(path.resolve(root, 'package.json')).then(() => true).catch(() => false);
|
|
54
56
|
if (!hasPackageJson) {
|
|
@@ -72,11 +74,12 @@ export async function createWebdriverIO(opts) {
|
|
|
72
74
|
await runProgram(pm, args, { cwd: root, stdio: 'ignore' });
|
|
73
75
|
console.log(chalk.green.bold('✔ Success!'));
|
|
74
76
|
}
|
|
75
|
-
return runProgram(pm
|
|
76
|
-
|
|
77
|
+
return runProgram(EXECUTER[pm], [
|
|
78
|
+
EXECUTE_COMMAND[pm],
|
|
79
|
+
WDIO_COMMAND,
|
|
77
80
|
'config',
|
|
78
81
|
...(opts.yes ? ['--yes'] : [])
|
|
79
|
-
], { cwd: root });
|
|
82
|
+
].filter(i => !!i), { cwd: root });
|
|
80
83
|
}
|
|
81
84
|
async function isCLIInstalled(path) {
|
|
82
85
|
try {
|
package/package.json
CHANGED