zappie 0.1.2 → 0.1.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # zappie
2
2
 
3
+ ## 0.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - b74e9a9: Verify can run on a build worker. `zappie verify` takes `--only` with check IDs or the `quick` set (V01 to V07, V09, V10 and V13), `--no-build` to serve the existing build, `--port` for the local preview, `--artifacts` for screenshots and the trace, and `--runner` for the report. `@zappie/verify` launches the Chromium named by `browserExecutablePath` or `ZAPPIE_VERIFY_CHROMIUM` instead of Playwright's own, exports `CHECK_SETS`, and refuses an `only` entry that names no check.
8
+
3
9
  ## 0.1.2
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -11,18 +11,18 @@ npx zappie add cart-drawer
11
11
 
12
12
  ## Commands
13
13
 
14
- | Command | What it does |
15
- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
16
- | `zappie add <name...>` | Add components from the registry. `--dry-run` shows the plan, `--overwrite` replaces files you've changed, and `--no-install` skips npm installs. |
17
- | `zappie list` | Show the components in the registry. `--installed` shows the ones in your project. |
18
- | `zappie diff [name]` | Compare your components with the registry. `--apply` merges updates into files you've changed. |
19
- | `zappie doctor` | Check your project, its `zappie.json` and its installed components. |
20
- | `zappie check [dir]` | Run the storefront checks from `@zappie/check` in your project. |
21
- | `zappie verify [url]` | Test a storefront through customer journeys with `@zappie/verify`. |
14
+ | Command | What it does |
15
+ | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
16
+ | `zappie add <name...>` | Add components from the registry. `--dry-run` shows the plan, `--overwrite` replaces files you've changed, and `--no-install` skips npm installs. |
17
+ | `zappie list` | Show the components in the registry. `--installed` shows the ones in your project. |
18
+ | `zappie diff [name]` | Compare your components with the registry. `--apply` merges updates into files you've changed. |
19
+ | `zappie doctor` | Check your project, its `zappie.json` and its installed components. |
20
+ | `zappie check [dir]` | Run the storefront checks from `@zappie/check` in your project. |
21
+ | `zappie verify [url]` | Test a storefront through customer journeys with `@zappie/verify`. `--only quick` runs the quick set, and `--no-build` verifies the existing build. |
22
22
 
23
23
  Add `--json` to any command for machine-readable output, including errors. Components come from `https://registry.zappie.ai/v1` unless you pass `--registry <url|dir>` or set `registry` in `zappie.json`.
24
24
 
25
- `zappie check` and `zappie verify` run `@zappie/check` and `@zappie/verify` from your project. Install whichever you use as a dev dependency. `@zappie/verify` also needs `@playwright/test` and its Chromium browser.
25
+ `zappie check` and `zappie verify` run `@zappie/check` and `@zappie/verify` from your project. Install whichever you use as a dev dependency. `@zappie/verify` also needs `@playwright/test` and its Chromium browser, or `ZAPPIE_VERIFY_CHROMIUM` set to another Chromium's executable.
26
26
 
27
27
  Run `zappie --help` for every option.
28
28
 
package/dist/cli.js CHANGED
@@ -67,6 +67,37 @@ function registrySource(flag, configured) {
67
67
 
68
68
  // src/args.ts
69
69
  var registryFlag = "--registry <url|dir>";
70
+ var verifyRunners = ["cli", "ci", "build-worker", "sandbox"];
71
+ var verifyCheckSets = {
72
+ quick: ["V01", "V02", "V03", "V04", "V05", "V06", "V07", "V09", "V10", "V13"]
73
+ };
74
+ function parseOnly(value) {
75
+ const entries = value.split(",").map((entry) => entry.trim()).filter(Boolean);
76
+ if (entries.length === 0) {
77
+ throw new CliError("Name at least one check or check set for --only.");
78
+ }
79
+ const ids = /* @__PURE__ */ new Set();
80
+ for (const entry of entries) {
81
+ const set = verifyCheckSets[entry.toLowerCase()];
82
+ if (set) {
83
+ set.forEach((id) => ids.add(id));
84
+ } else if (/^[VE]\d{2}$/i.test(entry)) {
85
+ ids.add(entry.toUpperCase());
86
+ } else {
87
+ throw new CliError(
88
+ `"${entry}" is not a check ID or set for --only. Pass IDs such as V01,V02 or one of: ${Object.keys(verifyCheckSets).join(", ")}.`
89
+ );
90
+ }
91
+ }
92
+ return [...ids];
93
+ }
94
+ function parsePort(value) {
95
+ const port = Number(value);
96
+ if (!/^\d+$/.test(value) || port < 1 || port > 65535) {
97
+ throw new CliError("Pass a port between 1 and 65535 for --port.");
98
+ }
99
+ return port;
100
+ }
70
101
  var usage = `Usage: zappie <command>
71
102
 
72
103
  Commands:
@@ -85,7 +116,12 @@ Options:
85
116
  --json Print machine-readable output for init, add, list, diff, doctor, check or verify
86
117
  --all Keep running check after a step fails
87
118
  --suite <name> Run the standard or extended verify suite
119
+ --only <checks> Run only these verify checks, such as V01,V04 or quick
88
120
  --report <file> Save your verification report to a file
121
+ --no-build Verify the project's existing build without building it again
122
+ --port <number> Serve verify's local preview on this port. Default: a free port
123
+ --artifacts <dir> Save verify screenshots and the trace here. Default: verify-artifacts
124
+ --runner <name> Record cli, ci, build-worker or sandbox as the report's runner
89
125
  --key <pk_test_...> Use this test publishable key for init or verify
90
126
  --store <slug> Choose your store for init or verify
91
127
  --overwrite Replace files you changed locally during add
@@ -121,6 +157,11 @@ function parseCommand(argv) {
121
157
  report: { type: "string" },
122
158
  key: { type: "string" },
123
159
  store: { type: "string" },
160
+ only: { type: "string" },
161
+ "no-build": { type: "boolean" },
162
+ port: { type: "string" },
163
+ artifacts: { type: "string" },
164
+ runner: { type: "string" },
124
165
  help: { type: "boolean", short: "h" }
125
166
  },
126
167
  allowPositionals: true,
@@ -214,7 +255,20 @@ ${usage}`);
214
255
  }
215
256
  const suite = values.suite ?? "standard";
216
257
  if (suite !== "standard" && suite !== "extended") {
217
- throw new CliError("Choose standard or extended for --suite.");
258
+ throw new CliError(
259
+ "Choose standard or extended for --suite. To run the quick checks, pass --only quick."
260
+ );
261
+ }
262
+ const runner = values.runner;
263
+ if (typeof runner === "string" && !verifyRunners.includes(runner)) {
264
+ throw new CliError(`Choose ${verifyRunners.join(", ")} for --runner.`);
265
+ }
266
+ const build = values["no-build"] !== true;
267
+ const port = typeof values.port === "string" ? parsePort(values.port) : void 0;
268
+ if (rest[0] && (!build || port !== void 0)) {
269
+ throw new CliError(
270
+ "--no-build and --port apply to the local preview. Drop them, or drop the URL."
271
+ );
218
272
  }
219
273
  return {
220
274
  name: name2,
@@ -223,6 +277,11 @@ ${usage}`);
223
277
  report: typeof values.report === "string" ? values.report : void 0,
224
278
  key: typeof values.key === "string" ? values.key : void 0,
225
279
  store: typeof values.store === "string" ? values.store : void 0,
280
+ only: typeof values.only === "string" ? parseOnly(values.only) : void 0,
281
+ build,
282
+ port,
283
+ artifacts: typeof values.artifacts === "string" ? values.artifacts : void 0,
284
+ runner,
226
285
  json: json4
227
286
  };
228
287
  }
@@ -1719,6 +1778,11 @@ async function runProjectVerify(options) {
1719
1778
  packageManager: options.packageManager,
1720
1779
  ...options.url ? { url: options.url } : {},
1721
1780
  ...options.store ? { store: options.store } : {},
1781
+ ...options.only ? { only: options.only } : {},
1782
+ ...options.build === false ? { build: false } : {},
1783
+ ...options.port ? { port: options.port } : {},
1784
+ ...options.artifacts ? { artifactsDir: path15.resolve(options.cwd, options.artifacts) } : {},
1785
+ ...options.runner ? { runner: options.runner } : {},
1722
1786
  ...options.signal ? { signal: options.signal } : {}
1723
1787
  });
1724
1788
  if (options.report) {
@@ -1851,6 +1915,11 @@ async function main(argv) {
1851
1915
  ...command.report ? { report: command.report } : {},
1852
1916
  ...command.key ? { key: command.key } : {},
1853
1917
  ...command.store ? { store: command.store } : {},
1918
+ ...command.only ? { only: command.only } : {},
1919
+ ...command.build ? {} : { build: false },
1920
+ ...command.port ? { port: command.port } : {},
1921
+ ...command.artifacts ? { artifacts: command.artifacts } : {},
1922
+ ...command.runner ? { runner: command.runner } : {},
1854
1923
  packageManager: detectPackageManager(cwd),
1855
1924
  signal: controller.signal
1856
1925
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zappie",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Install Zappie kit components and check storefront projects.",
5
5
  "type": "module",
6
6
  "bin": {