@webto-id/variant-check 0.1.0
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 +38 -0
- package/dist/cli.js +3628 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2374 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# @webto-id/variant-check
|
|
2
|
+
|
|
3
|
+
Lint, compile, and preview a **Webto Variant Format (WVF)** section variant — an `.astro` subset — with the exact compiler that [webto.id](https://webto.id)'s marketplace runs when you upload or submit a variant. If it passes here, it passes there.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx @webto-id/variant-check hero-split.astro --type hero
|
|
7
|
+
npx @webto-id/variant-check hero-split.astro --type hero --strict --content sample.json --out preview.html --theme dark
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
| Flag | Meaning |
|
|
11
|
+
|---|---|
|
|
12
|
+
| `--type <sectionType>` | Section type the variant targets (`hero`, `features-grid`, `testimonials`, `cta`, `faq`, …). Required. |
|
|
13
|
+
| `--strict` | Warnings become errors — the mode the marketplace uses when you **submit for review**. |
|
|
14
|
+
| `--content sample.json` | Sample content for the preview (keys = your `interface Props`). |
|
|
15
|
+
| `--out preview.html` | Self-contained HTML preview (written whenever the compile succeeds). |
|
|
16
|
+
| `--theme light\|dark\|warm` | Demo theme for the preview. |
|
|
17
|
+
| `--json` | Print the full compile result (lint, schema, hidden fields, IR) as JSON. |
|
|
18
|
+
|
|
19
|
+
Exit codes: `0` clean · `1` lint errors · `2` usage.
|
|
20
|
+
|
|
21
|
+
## Programmatic use
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { compile, buildPreviewDoc } from "@webto-id/variant-check";
|
|
25
|
+
|
|
26
|
+
const result = await compile(source, { sectionType: "hero", strict: true });
|
|
27
|
+
if (result.ok) {
|
|
28
|
+
const html = buildPreviewDoc(result.ir!, { headline: "Halo" }, "light");
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Writing a variant
|
|
33
|
+
|
|
34
|
+
- Format spec, theme tokens, inline-edit contract, JavaScript rules and the submit checklist: <https://docs.webto.id/marketplace/format-variant/>
|
|
35
|
+
- Section schema reference (which `Props` fields each section type accepts): <https://docs.webto.id/marketplace/referensi-schema/>
|
|
36
|
+
- AI skill that converts raw HTML into a WVF variant: <https://docs.webto.id/downloads/html-to-webto-variant.zip>
|
|
37
|
+
|
|
38
|
+
Sell it on the marketplace: <https://app.webto.id/marketplace/mine>.
|