@zappie/check
The checks behind zappie check. They look over a Zappie storefront project before you ship it, and report each problem with how to fix it.
npm install --save-dev @zappie/check
npx zappie check
What it checks
zappie check runs these steps in order and stops at the first that fails. Pass --all to run every step anyway.
| Step |
What it looks at |
config |
zappie.config.ts and theme.json, against the SDK and token rules |
allowlist |
Dependencies, devDependencies and lockfile install scripts, against Zappie's allowlists |
audit |
High and critical dependency advisories, with critical findings enforced on request |
lint |
The eslint-plugin-zappie rules and the jsx-a11y accessibility baseline. The security rules run on every source file, whatever your ESLint config says |
types |
A TypeScript check of the project |
test |
Your project's tests |
build |
A production build, and one pass over its output for the problems below |
secrets |
No secret keys or tokens in your source or build |
readiness |
Initial route discovery is enabled, or the config records why the site opts out |
budgets |
Built JavaScript and CSS sizes, against Zappie's default budgets or the ones in your config |
css |
Your source CSS and class names, and the built client CSS, for the problems below |
Build output problems
The build step reads every HTML and JavaScript file under build/client and build/server once, so code from packages and generated code are covered too.
| Code |
What it catches |
build/no-offsite-navigation |
Code that sends the shopper to a URL written out in full, such as location.href = "https://...", off Zappie's hosts |
build/no-meta-refresh |
A refresh tag or Refresh header to a URL off Zappie's hosts |
build/no-external-script |
A built page that loads a script from another host or a data: URL |
build/unlisted-link-host |
A link, form or source on a host that isn't Zappie's, the SDK's or listed in your config |
A store's own domains and the sites it links to go in security.links in zappie.config.ts. Image and font hosts can go in security.csp, and request hosts in outbound.allow. A refresh or navigation to a URL computed at run time isn't caught here; the lint rules cover the source that builds it.
CSS problems
| Code |
Level |
What it catches |
css/important |
Error |
!important in source CSS or @apply, or an important utility such as p-4! or !p-4 |
css/class-patch |
Error |
A selector that matches a class attribute, such as [class*="bg-white"]. Dark mode goes through tokens |
css/duplicate-keyframes |
Warning |
Two @keyframes with the same frames under different names, or one name defined twice |
css/duplicate-selector |
Warning |
A selector, or a selector list, styled by more than one source rule in the same context |
css/arbitrary-token |
Warning |
An arbitrary utility that restates a token from your @theme, such as text-[hsl(var(--foreground))] |
css/literal-token |
Warning |
A plain CSS colour, radius or shadow that equals a token your CSS defines |
css/unused-custom-property |
Warning |
A custom property your CSS defines that no CSS, source or built script reads |
css/reduced-motion |
Warning |
An animation or transition with no prefers-reduced-motion path |
css/unreadable |
Warning |
A CSS file that can't be parsed |
Warnings don't fail the step. A reviewed !important passes with /* zappie-allow-important: <reason> */ on the same line. Declarations inside @media (prefers-reduced-motion: reduce) may use !important.
Add --json for a machine-readable result. Its shape is the JSON Schema at @zappie/check/schema/check-result.v1.json.
Progress and time limits
zappie check writes a line to stderr as each step starts and finishes, with or without --json. Stdout still holds only the result, so the last line of stdout stays the JSON document.
check: types started
check: types passed in 3.1s
check: test started
check: test failed in 120.0s (stopped at its time limit)
Each step has a time limit. A step that runs past it is stopped and fails with a <step>/timeout problem that names the limit. The run then carries on as it does after any failed step: it stops, or moves to the next step with --all. An audit that runs past its limit is reported as audit/unavailable, so it follows the audit mode. The defaults, in seconds:
| Step |
Limit |
config, allowlist, readiness, budgets |
30 |
audit, css |
60 |
lint, types, test, secrets |
120 |
build |
180 |
Each command a step runs gets its own process group with stdin closed. When a step is stopped, or its command exits, every process left in that group gets SIGTERM, then SIGKILL 2 seconds later. No package manager, compiler or test process outlives its step. The CLI stops the same way on SIGINT, SIGTERM or SIGHUP.
Dependency auditing defaults to --audit=report. Use --audit=off when the registry is unavailable or --audit=enforce to fail on an unacknowledged critical advisory. A high or critical advisory with no fixed version can be acknowledged for at most 90 days:
export default defineConfig({
// ...
audit: {
ignore: [
{
id: "GHSA-abcd-1234-5678",
reason: "The maintainer has not published a fixed release",
until: "2026-11-30",
},
],
},
});
An unreadable or missing lockfile, registry failure, timeout, or unsupported Yarn or Bun project is reported as audit/unavailable. Report mode keeps checking and enforce mode fails. Invalid or expired acknowledgements are reported without hiding the advisory or stopping later checks.
Pass --prebuilt, or set ZAPPIE_CHECK_PREBUILT=1, when you have just built the project. The build step then scans the existing output under build/client and build/server instead of building again, and adds a build/prebuilt note to its result. Its progress line ends (used the existing build). With no output there the step builds as usual, so the output is always scanned.
Pass --history to include committed Git history in the secret scan. The normal scan covers every tracked file plus generated files under workers/**, build/client/** and build/server/**.
From code
import { runCheck } from "@zappie/check";
const result = await runCheck({
cwd: process.cwd(),
packageManager: "npm",
all: true,
});
console.log(result.result); // "passed" or "failed"
onProgress gets a started and a finished event for each step. A finished event carries the step's result, its durationMs, and timedOut. timeouts sets a step's limit in milliseconds, and signal stops the run and every process it started:
const result = await runCheck({
cwd: process.cwd(),
packageManager: "pnpm",
all: true,
timeouts: { test: 60_000, build: 120_000 },
signal: AbortSignal.timeout(300_000),
onProgress(event) {
if (event.type === "finished") {
console.error(`${event.step} ${event.result} in ${event.durationMs} ms`);
}
},
});
DEFAULT_STEP_TIMEOUTS holds the defaults. prebuilt: true scans the existing build as --prebuilt does, and a finished event for that build step carries note: "used the existing build". Left unset, prebuilt follows ZAPPIE_CHECK_PREBUILT.
Docs
Status
@zappie/check is at 0.x. Its steps and result can change in a minor release while it settles. Each change is listed in CHANGELOG.md.
License
MIT