create-playwright-performance-regression 0.1.0-next.3 → 0.1.0-next.4
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 +11 -2
- package/index.js +15 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,5 +9,14 @@ npm init playwright-performance-regression
|
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
It installs `playwright-performance-regression` as a dev dependency with the package manager of the
|
|
12
|
-
project (found by its lockfile) and starts the guided setup
|
|
13
|
-
|
|
12
|
+
project (found by its lockfile) and starts the guided setup. In a project where the package is
|
|
13
|
+
already installed it only starts the setup, so you can run it again at any time.
|
|
14
|
+
|
|
15
|
+
The command takes no arguments. The setup asks its questions in a terminal (without a terminal it
|
|
16
|
+
only shows the planned changes); these variables change it:
|
|
17
|
+
|
|
18
|
+
| Variable | Effect |
|
|
19
|
+
| ----------------------- | ------------------------------------------------------------------------------ |
|
|
20
|
+
| `PW_PERF_LANG=<code>` | wizard language without the question: `en`, `es`, `fr`, `pl`, `it`, `uk`, `ru` |
|
|
21
|
+
| `PW_PERF_DRY_RUN=1` | show the planned changes only, write nothing |
|
|
22
|
+
| `PW_PERF_NO_TUTORIAL=1` | print the manual setup steps only, change nothing |
|
package/index.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// create-playwright-performance-regression (01-REQ-39; 04, chapter 4.10): `npm init
|
|
3
3
|
// playwright-performance-regression`, `pnpm create …` and `yarn create …`. Installs the package as
|
|
4
4
|
// a dev dependency with the package manager of the project (found by its lockfile) and hands over
|
|
5
|
-
// to
|
|
5
|
+
// to the wizard (the pw-perf binary without arguments, 04-REQ-01). It takes no arguments: the
|
|
6
|
+
// wizard is controlled by the terminal and PW_PERF_* variables (D-43). No dependencies, no shell, no network access of its own: only the package
|
|
6
7
|
// manager is started.
|
|
7
8
|
import { spawn } from 'node:child_process';
|
|
8
9
|
import { existsSync, readFileSync } from 'node:fs';
|
|
@@ -85,6 +86,14 @@ function installedCli(cwd) {
|
|
|
85
86
|
async function main() {
|
|
86
87
|
const cwd = process.cwd();
|
|
87
88
|
const args = process.argv.slice(2);
|
|
89
|
+
if (args.length > 0) {
|
|
90
|
+
say(
|
|
91
|
+
`takes no arguments, got "${args.join(' ')}". The setup runs in a terminal; its variables are ` +
|
|
92
|
+
'PW_PERF_LANG=<code>, PW_PERF_DRY_RUN=1 and PW_PERF_NO_TUTORIAL=1, e.g. ' +
|
|
93
|
+
`PW_PERF_LANG=pl npm init ${PKG}.`,
|
|
94
|
+
);
|
|
95
|
+
return 3;
|
|
96
|
+
}
|
|
88
97
|
if (!existsSync(join(cwd, 'package.json'))) {
|
|
89
98
|
say(`no package.json in ${cwd}. Run this command in the directory of your Playwright project.`);
|
|
90
99
|
return 3;
|
|
@@ -99,7 +108,7 @@ async function main() {
|
|
|
99
108
|
code = await run(process.execPath, [process.env.npm_execpath, ...installArgs], cwd);
|
|
100
109
|
} else if (process.platform === 'win32') {
|
|
101
110
|
// npm.cmd and friends cannot be started without a shell on Windows.
|
|
102
|
-
say(`run "${manager} ${installArgs.join(' ')}", then "
|
|
111
|
+
say(`run "${manager} ${installArgs.join(' ')}", then "npm init ${PKG}" again.`);
|
|
103
112
|
return 3;
|
|
104
113
|
} else {
|
|
105
114
|
code = await run(manager, installArgs, cwd);
|
|
@@ -111,10 +120,12 @@ async function main() {
|
|
|
111
120
|
}
|
|
112
121
|
const cli = installedCli(cwd);
|
|
113
122
|
if (cli === null) {
|
|
114
|
-
say(
|
|
123
|
+
say(
|
|
124
|
+
`${PKG} is not resolvable from ${cwd} after the installation. Check the installation, then run "npm init ${PKG}" again.`,
|
|
125
|
+
);
|
|
115
126
|
return 3;
|
|
116
127
|
}
|
|
117
|
-
return run(process.execPath, [cli
|
|
128
|
+
return run(process.execPath, [cli], cwd);
|
|
118
129
|
}
|
|
119
130
|
|
|
120
131
|
process.exitCode = await main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-playwright-performance-regression",
|
|
3
|
-
"version": "0.1.0-next.
|
|
3
|
+
"version": "0.1.0-next.4",
|
|
4
4
|
"description": "Set up playwright-performance-regression in a Playwright project: npm init playwright-performance-regression",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"playwright",
|