checkLast updated on
Last updated on
Check a React composition against its artifact without rendering a PDF
Checks a @paradoc/react composition against the form artifact whose React
layer it renders — the same tree walk the default PDF path runs — and
reports every fault without producing PDF bytes.
Usage
paradoc check <target> [options]Arguments
| Argument | Description |
|---|---|
target | The composition file (.tsx/.jsx), or the artifact file that declares its React layer |
Options
| Option | Description |
|---|---|
--layer <key> | React layer key to check, when the artifact declares more than one |
--data <pathOrJson> | Complete valid data: a file path or inline JSON, overriding any discovered sample |
--adapter <name> | Adapter whose class vocabulary to check against: takumi (default) or chromium |
Description
paradoc check resolves target to one artifact and one React layer, binds the
layer's module to a component, and walks the rendered tree the way the
default PDF path would — without invoking a PDF engine. It reports three
kinds of fault, independently:
- Unsupported classes — a Tailwind class outside the default adapter's
verified vocabulary. Checking against
--adapter chromiumskips this, since a real browser accepts whatever CSS the tree produces. - Unresolved field paths — a
Field/Tablepath, or aSignatureparty role, the artifact does not declare. - Missing images — an image
srcthat is not adata:URI, which a render would need bytes for.
Passing the composition file searches the project for the one artifact whose
React layer resolves to it; passing the artifact file reads its declared
layer directly. If more than one artifact points at the composition, or the
artifact declares more than one React layer, pass --layer to pick one.
The check runs through @paradoc/react-pdf/check. Install @paradoc/react-pdf, @paradoc/react, react, and react-dom in the project.
Whichever way the artifact is found, from the target, from a layer that
points at the composition, or as a sibling of the same name, it must carry
the current schema version in $schema, as for
paradoc dev. A missing, outdated, or unknown $schema exits 1 and points
to paradoc migrate.
Sample data, when --data is not given, is discovered sibling-first and may be partial: a
<composition>.sample.{ts,tsx,js,mjs,jsx} file next to the composition wins
if present; only when none exists does discovery fall back to a named
sample export on the composition module itself. Neither found, the check
still runs with empty data — every Field/Table path is checked against
the artifact's schema regardless of whether data is present.
Both check and dev search from the nearest project. Outside one, check
starts at the composition directory and dev at its [dir] argument. Pass the
artifact explicitly when it sits above the composition.
The command exits non-zero when it finds any fault. A composition using
Totals over a def checks cleanly with no sample data at all: a value with
no data anywhere in it is not treated as a fault, only a value that carries
real data a serializer still rejects is.
Examples
Check a composition by its own file:
paradoc check ./compositions/purchase-order.tsxCheck the artifact directly, naming a layer:
paradoc check ./artifacts/purchase-order.json --layer compositionCheck against the Chromium adapter's rules instead of the default:
paradoc check ./compositions/purchase-order.tsx --adapter chromiumSee also
add— install document components from the Paradoc component registry- Components — the component vocabulary the check walks
An artifact argument may be a file path or an installed @namespace/name reference from .paradoc/lock.json. An uninstalled reference fails with an error.