@decocms/parity 0.26.17 → 0.26.18

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.
Files changed (2) hide show
  1. package/dist/cli.js +326 -259
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -62882,6 +62882,322 @@ function escapePipes2(s) {
62882
62882
  // src/migrate/exporters/html.ts
62883
62883
  import { readFileSync as readFileSync15, writeFileSync as writeFileSync21 } from "node:fs";
62884
62884
  import { join as join23 } from "node:path";
62885
+
62886
+ // src/migrate/targets/faststore-v4.ts
62887
+ function pickBreakpointTiers(breakpoints) {
62888
+ const px = breakpoints.map((b) => ({ raw: b, n: Number.parseFloat(b) })).filter((b) => Number.isFinite(b.n));
62889
+ const used = new Set;
62890
+ const nearest = (target) => {
62891
+ let best = null;
62892
+ for (const b of px) {
62893
+ if (used.has(b.raw))
62894
+ continue;
62895
+ const d = Math.abs(b.n - target);
62896
+ if (!best || d < best.d)
62897
+ best = { raw: b.raw, d };
62898
+ }
62899
+ if (best)
62900
+ used.add(best.raw);
62901
+ return best?.raw ?? null;
62902
+ };
62903
+ return {
62904
+ phone: nearest(480),
62905
+ tablet: nearest(768),
62906
+ notebook: nearest(1024),
62907
+ desktop: nearest(1280)
62908
+ };
62909
+ }
62910
+ function buildFastStoreTheme(theme) {
62911
+ const lines = [];
62912
+ const put = (token, value) => {
62913
+ if (value)
62914
+ lines.push(` ${token}: ${value};`);
62915
+ };
62916
+ const fonts = theme.typography.fontFamilies;
62917
+ const radii = theme.radii;
62918
+ const bp = theme.breakpoints;
62919
+ put("--fs-color-primary-bkg", theme.colors.primary);
62920
+ put("--fs-color-accent-0", theme.colors.secondary);
62921
+ put("--fs-color-text", theme.colors.text);
62922
+ put("--fs-color-body-bkg", theme.colors.background);
62923
+ put("--fs-text-face-body", fonts[0]);
62924
+ put("--fs-text-face-title", fonts[1] ?? fonts[0]);
62925
+ put("--fs-border-radius-medium", radii[Math.floor(radii.length / 2)]);
62926
+ put("--fs-shadow", theme.shadows[0]);
62927
+ const tiers = pickBreakpointTiers(bp);
62928
+ put("--fs-grid-breakpoint-phone", tiers.phone);
62929
+ put("--fs-grid-breakpoint-tablet", tiers.tablet);
62930
+ put("--fs-grid-breakpoint-notebook", tiers.notebook);
62931
+ put("--fs-grid-breakpoint-desktop", tiers.desktop);
62932
+ return [
62933
+ "// custom-theme.scss — starter generated by `parity migrate --target faststore`.",
62934
+ "// Brand tokens only; adjust and extend against @faststore/ui global tokens.",
62935
+ ".theme {",
62936
+ ...lines,
62937
+ "}",
62938
+ ""
62939
+ ].join(`
62940
+ `);
62941
+ }
62942
+ var faststore = `## Target: VTEX FastStore (v4)
62943
+
62944
+ Generate the migrated storefront as a FastStore v4 project. Do NOT hand-roll the
62945
+ scaffold — use the official CLI, then fill in sections from the components below.
62946
+
62947
+ ### Setup (once)
62948
+ - Requirements + project setup: https://developers.vtex.com/docs/guides/faststore/getting-started-requirements
62949
+ - Project structure overview: https://developers.vtex.com/docs/guides/faststore/project-structure-overview
62950
+ - \`yarn install\` then \`yarn dev\` → dev store at http://localhost:3000
62951
+
62952
+ ### CLI (@faststore/cli)
62953
+ - \`faststore dev\` — local dev server (localhost:3000)
62954
+ - \`faststore build\` — production build
62955
+ - \`faststore generate\` — regenerate schema + TS types after changes
62956
+ - \`faststore cms-sync\` — sync the \`cms/\` folder with the Headless CMS
62957
+
62958
+ ### Styling — IMPORTANT: FastStore does NOT use Tailwind
62959
+ FastStore v4 styles with **SCSS design tokens + \`data-fs-*\` attributes**, not
62960
+ utility classes. The Tailwind classes in each component README are a convenience
62961
+ approximation — treat the **raw computed styles in manifest.json as the source
62962
+ of truth** for exact values. Package split: \`@faststore/components\` (structure/
62963
+ behavior, unstyled) · \`@faststore/ui\` (styles + design tokens) · \`@faststore/core\`
62964
+ (sections/pages).
62965
+
62966
+ - **Theme** → a starter \`custom-theme.scss\` was generated in this snapshot from
62967
+ the extracted brand tokens. Drop it in \`src/themes/\` and refine. Token map used:
62968
+
62969
+ | Extracted | FastStore global token |
62970
+ | --- | --- |
62971
+ | primary | \`--fs-color-primary-bkg\` |
62972
+ | secondary | \`--fs-color-accent-0\` |
62973
+ | text | \`--fs-color-text\` |
62974
+ | background | \`--fs-color-body-bkg\` |
62975
+ | font (body/title) | \`--fs-text-face-body\` / \`--fs-text-face-title\` |
62976
+ | radius | \`--fs-border-radius-medium\` |
62977
+ | shadow | \`--fs-shadow\` |
62978
+ | breakpoints | \`--fs-grid-breakpoint-phone|tablet|notebook|desktop\` |
62979
+
62980
+ Do NOT override \`--fs-spacing-*\`/\`--fs-text-size-*\` (structural scale).
62981
+ Global tokens: https://developers.vtex.com/docs/guides/faststore/global-tokens-overview
62982
+ - **Per-component styling** → override via each component's \`data-fs-*\` attribute
62983
+ in SCSS (e.g. \`[data-fs-product-shelf]\`), not utility classes.
62984
+ Styling a component: https://developers.vtex.com/docs/guides/faststore/using-themes-components
62985
+
62986
+ ### Icons — Phosphor
62987
+ FastStore ships Phosphor icons via the \`<Icon>\` component (\`data-fs-icon\`, \`weight\`
62988
+ prop: thin|light|regular|bold). Map each entry in this snapshot's **icon inventory**
62989
+ to a Phosphor icon id; add any missing ones as custom icons.
62990
+ - Iconography: https://developers.vtex.com/docs/guides/faststore/reference-icons
62991
+ - Adding custom icons: https://developers.vtex.com/docs/guides/faststore/atoms-icon
62992
+
62993
+ ### Brand assets
62994
+ - Logo + favicon (and apple-touch-icon / OG image) were downloaded to \`assets/\`
62995
+ in this snapshot — drop them into the FastStore project's \`public/\` and wire the
62996
+ logo into the Navbar/Header section.
62997
+
62998
+ ### Where components go — section structure
62999
+ Each detected component → a FastStore section:
63000
+ - \`src/components/<SectionName>.tsx\` (the React section)
63001
+ - register it in \`src/components/index.tsx\` (the components entry)
63002
+ - add its schema to \`cms/faststore/sections.json\` (form editors use in the CMS)
63003
+ - **Global components** (header/footer/minicart) render on every page;
63004
+ **page components** (home/PLP/PDP) go into the matching page content type.
63005
+ - After adding/editing sections: \`faststore generate\` then \`faststore cms-sync\`.
63006
+ - Splitting a legacy CMS structure into components/content-types is supported by
63007
+ \`vtex content split-components\` and \`vtex content split-content-types\`.
63008
+ - Creating a section: https://developers.vtex.com/docs/guides/faststore/building-sections-creating-a-new-section
63009
+ - Headless CMS model: https://developers.vtex.com/docs/guides/faststore/headless-cms-overview
63010
+ - Creating sections: https://developers.vtex.com/docs/guides/faststore/creating-a-new-section-and-content-type
63011
+
63012
+ ### e2e
63013
+ Use the suggested selectors (per component, mapped to known commerce keys) to
63014
+ seed Playwright/Cypress smoke tests on the migrated store.`;
63015
+
63016
+ // src/migrate/targets/faststore-next.ts
63017
+ function buildFastStoreNextTheme(theme) {
63018
+ return buildTailwindTheme(theme, [
63019
+ "/* Brand tokens — starter generated by `parity migrate --target faststore-next`. */",
63020
+ "/* Adjust names to match whatever this template's own tailwind.css already declares */",
63021
+ "/* under @theme inline — don't introduce a second, parallel token set. */"
63022
+ ]);
63023
+ }
63024
+ function buildTailwindTheme(theme, header) {
63025
+ const lines = [];
63026
+ const put = (token, value) => {
63027
+ if (value)
63028
+ lines.push(` ${token}: ${value};`);
63029
+ };
63030
+ const fonts = theme.typography.fontFamilies;
63031
+ const radii = theme.radii;
63032
+ const bp = theme.breakpoints;
63033
+ put("--color-brand-primary", theme.colors.primary);
63034
+ put("--color-brand-secondary", theme.colors.secondary);
63035
+ put("--color-brand-text", theme.colors.text);
63036
+ put("--color-brand-background", theme.colors.background);
63037
+ put("--font-body", fonts[0]);
63038
+ put("--font-heading", fonts[1] ?? fonts[0]);
63039
+ put("--radius-brand", radii[Math.floor(radii.length / 2)]);
63040
+ put("--shadow-brand", theme.shadows[0]);
63041
+ const tiers = pickBreakpointTiers(bp);
63042
+ put("--breakpoint-phone", tiers.phone);
63043
+ put("--breakpoint-tablet", tiers.tablet);
63044
+ put("--breakpoint-notebook", tiers.notebook);
63045
+ put("--breakpoint-desktop", tiers.desktop);
63046
+ return [...header, "@theme {", ...lines, "}", ""].join(`
63047
+ `);
63048
+ }
63049
+ var faststoreNext = `## Target: FastStore Next
63050
+
63051
+ Next.js App Router on \`@faststore/api\`/\`sdk\`/\`ui\` — no \`@faststore/cli\`/\`core\`,
63052
+ Deco CMS decofiles as the content source. This is a DIFFERENT target from
63053
+ \`faststore-v4\` (which scaffolds \`@faststore/cli\` + the VTEX Headless CMS) —
63054
+ don't mix their playbooks. Load \`skills/target-faststore-next/SKILL.md\` for
63055
+ the full picture; this is the condensed version.
63056
+
63057
+ ### Bootstrap
63058
+ - Scaffold by copying \`deco-sites/faststore-next-template\` (clone, copy the
63059
+ tree, re-init git, set the new remote) — NOT the bare FastStore starter.
63060
+ It ships the platform layer (PLP pagination/ISR, gradual-cutover proxy,
63061
+ native Synerise+VTEX-fallback search, WebOps deploy accommodations) —
63062
+ reinventing any of those from scratch is exactly what the template exists
63063
+ to avoid.
63064
+ - \`bun dev\` — localhost:3000 · \`bun run build\` — prod build (runs \`generate\`
63065
+ first) · \`bun run generate:deco\` — after adding/changing a section,
63066
+ restart dev after.
63067
+ - Set \`discovery.config.js\`'s \`api.storeId\` (public, client-bundled — not a
63068
+ secret) to the source VTEX account (the \`*.vtexassets.com\` subdomain in
63069
+ \`blocks.json\`, or the account id from \`window.__RUNTIME__\` on a live
63070
+ vtex-io source).
63071
+
63072
+ ### Styling — Tailwind v4, not SCSS
63073
+ No \`--fs-*\` token contract (that's the other target). A starter
63074
+ \`@theme\` block was generated in this snapshot from the extracted brand
63075
+ tokens — merge it into the template's own \`src/styles/tailwind.css\`
63076
+ \`@theme inline\` block rather than adding a second token layer. Token map
63077
+ used: primary/secondary/text/background colors, body/heading fonts, one
63078
+ mid-scale radius, first shadow, and the four nearest-canonical breakpoint
63079
+ tiers (phone/tablet/notebook/desktop) picked from the extracted breakpoint
63080
+ list.
63081
+
63082
+ ### Icons
63083
+ Sprite-based (\`public/sprites-v2.svg\` + the template's \`Icon\` component,
63084
+ a typed union in \`icons.ts\`) — not Phosphor, not per-icon SVG files. Add
63085
+ missing icons to the sprite + the union type.
63086
+
63087
+ ### Brand assets
63088
+ Logo/favicon downloaded to \`assets/\` in this snapshot — the template ships
63089
+ a generic placeholder at \`public/brand/logo-placeholder.svg\`; replace it
63090
+ and wire it into \`src/components/header/{Desktop,Mobile}Header.tsx\`.
63091
+
63092
+ ### Where components go — this target's 3-point-invariant equivalent
63093
+ Every section needs all three or the CMS silently drops it:
63094
+ 1. The component in \`src/components/sections/<Path>/<Name>.tsx\` — its typed
63095
+ \`Props\` export IS the CMS schema (no separate \`.jsonc\` to hand-write).
63096
+ 2. The shim in \`src/sections/<Path>.tsx\` — thin re-export,
63097
+ \`export { default } from "src/components/sections/<Path>/<Name>"\`, plus
63098
+ convention exports (\`sync\`, \`layout\`, \`cache\`, …). The file's PATH is
63099
+ the Studio block key.
63100
+ 3. \`bun run generate:deco\` to regenerate \`.deco/*.gen.*\`.
63101
+ Global vs page-scoped: \`layout = true\` sections (Header/Footer) resolve
63102
+ once and cache across navigations; everything else is page content.
63103
+
63104
+ ### Editability gate (check every ported section)
63105
+ Does it read from its decofile, or did the port hardcode the captured
63106
+ content into JSX? Trivial/empty \`Props\` or literal strings >~25 chars in
63107
+ the component body means a merchant can't edit it in Studio — visually
63108
+ identical to prod, but a CMS regression \`parity\`'s screenshot/HTML diff
63109
+ cannot see.
63110
+
63111
+ ### Rendering — decide this BEFORE porting the first section
63112
+ CMS data renders SSR; product/search data renders CSR when the site uses a
63113
+ third-party search provider (its requests are shopper-session-dependent and
63114
+ browser-only). This is an architecture decision made once, up front — do
63115
+ not let \`parity\` flag the resulting SSR/CSR delta as a regression against
63116
+ a source that server-rendered products.
63117
+
63118
+ ### Deploy
63119
+ WebOps builds straight from \`discovery.config.js\` + \`package.json\`
63120
+ scripts — no CLI, no deploy workflow to create. Two accommodations that
63121
+ look wrong to a generic Node reviewer but are load-bearing: build-time
63122
+ tooling sits in \`dependencies\` (WebOps production installs skip
63123
+ \`devDependencies\`), and branch names can't contain a second \`/\`.`;
63124
+
63125
+ // src/migrate/targets/tanstack-deco.ts
63126
+ function buildTanstackDecoTheme(theme) {
63127
+ return buildTailwindTheme(theme, [
63128
+ "/* Brand tokens — starter generated by `parity migrate --target tanstack-deco`. */",
63129
+ "/* Reconcile with the template's own tailwind.css @theme block and, if the site uses a",
63130
+ " CMS-editable Theme section, with that block's values — three parallel token sets is",
63131
+ " worse than none. */"
63132
+ ]);
63133
+ }
63134
+ var tanstackDeco = `## Target: TanStack Start + Deco CMS
63135
+
63136
+ Generate the migrated storefront as a TanStack Start / Cloudflare Workers site using
63137
+ the @decocms/* packages. Scaffold from the official template before porting sections.
63138
+
63139
+ ### Setup (once)
63140
+ - Clone: \`gh repo clone decocms/tanstack-storefront <name>\`
63141
+ - Install: \`bun install\`
63142
+ - Dev: \`bun run dev\` → http://localhost:5173
63143
+
63144
+ ### CLI (@faststore/cli is NOT used here — this is TanStack)
63145
+ - \`bun run dev\` local dev server (Vite + Cloudflare Workers)
63146
+ - \`bun run build\` production build
63147
+ - \`bun run predev\` regenerate types + invoke stubs (run after adding sections)
63148
+
63149
+ ### Sections — the CMS unit (mirror of Fresh's sections/)
63150
+ Each component from the capture → a section in \`src/components/sections/<Name>.tsx\`.
63151
+ Three things must stay in sync (TypeScript enforces this at build time):
63152
+ 1. Export in \`src/components/index.tsx\` (the key IS the CMS block type).
63153
+ 2. \`export const schema\` on the component (Zod — replaces Fresh's JSDoc annotations).
63154
+ 3. A loader in \`src/loaders/\` when the section needs server data.
63155
+
63156
+ ### Styling
63157
+ TanStack Deco uses **Tailwind** (utility classes) and CSS Modules for overrides,
63158
+ NOT SCSS design-token variables (that's FastStore v4). The captured Tailwind classes
63159
+ per component are the starting point; cross-check against the prod screenshots.
63160
+
63161
+ ### Commerce (VTEX)
63162
+ \`@decocms/apps-vtex\` provides loaders and hooks. Import from there instead of
63163
+ writing raw GraphQL/REST. Key hooks: \`useCart\`, \`useUser\`, \`useProduct\`.
63164
+
63165
+ ### After porting each section
63166
+ \`bun run predev\` — regenerates \`src/components/manifest.gen.ts\` and
63167
+ \`src/invoke.gen.ts\`. A missing entry here is a 404 in the Deco admin.`;
63168
+
63169
+ // src/migrate/targets/index.ts
63170
+ var FASTSTORE_V4 = {
63171
+ playbook: faststore,
63172
+ theme: { filename: "custom-theme.scss", build: buildFastStoreTheme }
63173
+ };
63174
+ var FASTSTORE_NEXT = {
63175
+ playbook: faststoreNext,
63176
+ theme: { filename: "theme.css", build: buildFastStoreNextTheme }
63177
+ };
63178
+ var TANSTACK_DECO = {
63179
+ playbook: tanstackDeco,
63180
+ theme: { filename: "theme.css", build: buildTanstackDecoTheme }
63181
+ };
63182
+ var TARGETS = {
63183
+ faststore: FASTSTORE_V4,
63184
+ "faststore-v4": FASTSTORE_V4,
63185
+ "faststore-next": FASTSTORE_NEXT,
63186
+ tanstack: TANSTACK_DECO,
63187
+ "tanstack-deco": TANSTACK_DECO
63188
+ };
63189
+ function getTarget(name) {
63190
+ return Object.hasOwn(TARGETS, name) ? TARGETS[name] : undefined;
63191
+ }
63192
+ function getTargetPlaybook(name) {
63193
+ return getTarget(name)?.playbook;
63194
+ }
63195
+ function getTargetTheme(name) {
63196
+ return getTarget(name)?.theme ?? null;
63197
+ }
63198
+ var TARGET_NAMES = Object.keys(TARGETS);
63199
+
63200
+ // src/migrate/exporters/html.ts
62885
63201
  var htmlExporter = {
62886
63202
  name: "html",
62887
63203
  async export(bundle, outDir) {
@@ -63081,13 +63397,19 @@ ${favSrc ? `<link rel="icon" href="${esc2(favSrc)}">` : ""}
63081
63397
  <h2>Files</h2>
63082
63398
  <a href="MIGRATION_PROMPT.md">MIGRATION_PROMPT.md</a>
63083
63399
  <a href="index.md">index.md</a>
63084
- ${b.target === "faststore" ? '<a href="custom-theme.scss">custom-theme.scss</a>' : ""}
63400
+ ${themeLink(b.target)}
63085
63401
  ${b.vtex ? '<a href="component-map.json">component-map.json</a> <a href="blocks.json">blocks.json</a>' : ""}
63086
63402
  <a href="manifest.json">manifest.json (full)</a>
63087
63403
  </section>
63088
63404
 
63089
63405
  </main></body></html>`;
63090
63406
  }
63407
+ function themeLink(target) {
63408
+ const theme = target ? getTargetTheme(target) : null;
63409
+ if (!theme)
63410
+ return "";
63411
+ return `<a href="${theme.filename}">${theme.filename}</a>`;
63412
+ }
63091
63413
 
63092
63414
  // src/migrate/sources/classify.ts
63093
63415
  var has2 = (re, text3) => re.test(text3);
@@ -63478,262 +63800,6 @@ function syntheticSourceComponents(plan) {
63478
63800
  }));
63479
63801
  }
63480
63802
 
63481
- // src/migrate/targets/faststore-v4.ts
63482
- function pickBreakpointTiers(breakpoints) {
63483
- const px = breakpoints.map((b) => ({ raw: b, n: Number.parseFloat(b) })).filter((b) => Number.isFinite(b.n));
63484
- const used = new Set;
63485
- const nearest = (target) => {
63486
- let best = null;
63487
- for (const b of px) {
63488
- if (used.has(b.raw))
63489
- continue;
63490
- const d = Math.abs(b.n - target);
63491
- if (!best || d < best.d)
63492
- best = { raw: b.raw, d };
63493
- }
63494
- if (best)
63495
- used.add(best.raw);
63496
- return best?.raw ?? null;
63497
- };
63498
- return {
63499
- phone: nearest(480),
63500
- tablet: nearest(768),
63501
- notebook: nearest(1024),
63502
- desktop: nearest(1280)
63503
- };
63504
- }
63505
- function buildFastStoreTheme(theme) {
63506
- const lines = [];
63507
- const put = (token, value) => {
63508
- if (value)
63509
- lines.push(` ${token}: ${value};`);
63510
- };
63511
- const fonts = theme.typography.fontFamilies;
63512
- const radii = theme.radii;
63513
- const bp = theme.breakpoints;
63514
- put("--fs-color-primary-bkg", theme.colors.primary);
63515
- put("--fs-color-accent-0", theme.colors.secondary);
63516
- put("--fs-color-text", theme.colors.text);
63517
- put("--fs-color-body-bkg", theme.colors.background);
63518
- put("--fs-text-face-body", fonts[0]);
63519
- put("--fs-text-face-title", fonts[1] ?? fonts[0]);
63520
- put("--fs-border-radius-medium", radii[Math.floor(radii.length / 2)]);
63521
- put("--fs-shadow", theme.shadows[0]);
63522
- const tiers = pickBreakpointTiers(bp);
63523
- put("--fs-grid-breakpoint-phone", tiers.phone);
63524
- put("--fs-grid-breakpoint-tablet", tiers.tablet);
63525
- put("--fs-grid-breakpoint-notebook", tiers.notebook);
63526
- put("--fs-grid-breakpoint-desktop", tiers.desktop);
63527
- return [
63528
- "// custom-theme.scss — starter generated by `parity migrate --target faststore`.",
63529
- "// Brand tokens only; adjust and extend against @faststore/ui global tokens.",
63530
- ".theme {",
63531
- ...lines,
63532
- "}",
63533
- ""
63534
- ].join(`
63535
- `);
63536
- }
63537
- var faststore = `## Target: VTEX FastStore (v4)
63538
-
63539
- Generate the migrated storefront as a FastStore v4 project. Do NOT hand-roll the
63540
- scaffold — use the official CLI, then fill in sections from the components below.
63541
-
63542
- ### Setup (once)
63543
- - Requirements + project setup: https://developers.vtex.com/docs/guides/faststore/getting-started-requirements
63544
- - Project structure overview: https://developers.vtex.com/docs/guides/faststore/project-structure-overview
63545
- - \`yarn install\` then \`yarn dev\` → dev store at http://localhost:3000
63546
-
63547
- ### CLI (@faststore/cli)
63548
- - \`faststore dev\` — local dev server (localhost:3000)
63549
- - \`faststore build\` — production build
63550
- - \`faststore generate\` — regenerate schema + TS types after changes
63551
- - \`faststore cms-sync\` — sync the \`cms/\` folder with the Headless CMS
63552
-
63553
- ### Styling — IMPORTANT: FastStore does NOT use Tailwind
63554
- FastStore v4 styles with **SCSS design tokens + \`data-fs-*\` attributes**, not
63555
- utility classes. The Tailwind classes in each component README are a convenience
63556
- approximation — treat the **raw computed styles in manifest.json as the source
63557
- of truth** for exact values. Package split: \`@faststore/components\` (structure/
63558
- behavior, unstyled) · \`@faststore/ui\` (styles + design tokens) · \`@faststore/core\`
63559
- (sections/pages).
63560
-
63561
- - **Theme** → a starter \`custom-theme.scss\` was generated in this snapshot from
63562
- the extracted brand tokens. Drop it in \`src/themes/\` and refine. Token map used:
63563
-
63564
- | Extracted | FastStore global token |
63565
- | --- | --- |
63566
- | primary | \`--fs-color-primary-bkg\` |
63567
- | secondary | \`--fs-color-accent-0\` |
63568
- | text | \`--fs-color-text\` |
63569
- | background | \`--fs-color-body-bkg\` |
63570
- | font (body/title) | \`--fs-text-face-body\` / \`--fs-text-face-title\` |
63571
- | radius | \`--fs-border-radius-medium\` |
63572
- | shadow | \`--fs-shadow\` |
63573
- | breakpoints | \`--fs-grid-breakpoint-phone|tablet|notebook|desktop\` |
63574
-
63575
- Do NOT override \`--fs-spacing-*\`/\`--fs-text-size-*\` (structural scale).
63576
- Global tokens: https://developers.vtex.com/docs/guides/faststore/global-tokens-overview
63577
- - **Per-component styling** → override via each component's \`data-fs-*\` attribute
63578
- in SCSS (e.g. \`[data-fs-product-shelf]\`), not utility classes.
63579
- Styling a component: https://developers.vtex.com/docs/guides/faststore/using-themes-components
63580
-
63581
- ### Icons — Phosphor
63582
- FastStore ships Phosphor icons via the \`<Icon>\` component (\`data-fs-icon\`, \`weight\`
63583
- prop: thin|light|regular|bold). Map each entry in this snapshot's **icon inventory**
63584
- to a Phosphor icon id; add any missing ones as custom icons.
63585
- - Iconography: https://developers.vtex.com/docs/guides/faststore/reference-icons
63586
- - Adding custom icons: https://developers.vtex.com/docs/guides/faststore/atoms-icon
63587
-
63588
- ### Brand assets
63589
- - Logo + favicon (and apple-touch-icon / OG image) were downloaded to \`assets/\`
63590
- in this snapshot — drop them into the FastStore project's \`public/\` and wire the
63591
- logo into the Navbar/Header section.
63592
-
63593
- ### Where components go — section structure
63594
- Each detected component → a FastStore section:
63595
- - \`src/components/<SectionName>.tsx\` (the React section)
63596
- - register it in \`src/components/index.tsx\` (the components entry)
63597
- - add its schema to \`cms/faststore/sections.json\` (form editors use in the CMS)
63598
- - **Global components** (header/footer/minicart) render on every page;
63599
- **page components** (home/PLP/PDP) go into the matching page content type.
63600
- - After adding/editing sections: \`faststore generate\` then \`faststore cms-sync\`.
63601
- - Splitting a legacy CMS structure into components/content-types is supported by
63602
- \`vtex content split-components\` and \`vtex content split-content-types\`.
63603
- - Creating a section: https://developers.vtex.com/docs/guides/faststore/building-sections-creating-a-new-section
63604
- - Headless CMS model: https://developers.vtex.com/docs/guides/faststore/headless-cms-overview
63605
- - Creating sections: https://developers.vtex.com/docs/guides/faststore/creating-a-new-section-and-content-type
63606
-
63607
- ### e2e
63608
- Use the suggested selectors (per component, mapped to known commerce keys) to
63609
- seed Playwright/Cypress smoke tests on the migrated store.`;
63610
-
63611
- // src/migrate/targets/faststore-next.ts
63612
- var faststoreNext = `## Target: FastStore Next
63613
-
63614
- Next.js App Router on \`@faststore/api\`/\`sdk\`/\`ui\` — no \`@faststore/cli\`/\`core\`,
63615
- Deco CMS decofiles as the content source. This is a DIFFERENT target from
63616
- \`faststore-v4\` (which scaffolds \`@faststore/cli\` + the VTEX Headless CMS) —
63617
- don't mix their playbooks. Load \`skills/target-faststore-next/SKILL.md\` for
63618
- the full picture; this is the condensed version.
63619
-
63620
- ### Bootstrap
63621
- - Scaffold by copying \`deco-sites/faststore-next-template\` (clone, copy the
63622
- tree, re-init git, set the new remote) — NOT the bare FastStore starter.
63623
- It ships the platform layer (PLP pagination/ISR, gradual-cutover proxy,
63624
- native Synerise+VTEX-fallback search, WebOps deploy accommodations) —
63625
- reinventing any of those from scratch is exactly what the template exists
63626
- to avoid.
63627
- - \`bun dev\` — localhost:3000 · \`bun run build\` — prod build (runs \`generate\`
63628
- first) · \`bun run generate:deco\` — after adding/changing a section,
63629
- restart dev after.
63630
- - Set \`discovery.config.js\`'s \`api.storeId\` (public, client-bundled — not a
63631
- secret) to the source VTEX account (the \`*.vtexassets.com\` subdomain in
63632
- \`blocks.json\`, or the account id from \`window.__RUNTIME__\` on a live
63633
- vtex-io source).
63634
-
63635
- ### Styling — Tailwind v4, not SCSS
63636
- No \`--fs-*\` token contract (that's the other target). A starter
63637
- \`@theme\` block was generated in this snapshot from the extracted brand
63638
- tokens — merge it into the template's own \`src/styles/tailwind.css\`
63639
- \`@theme inline\` block rather than adding a second token layer. Token map
63640
- used: primary/secondary/text/background colors, body/heading fonts, one
63641
- mid-scale radius, first shadow, and the four nearest-canonical breakpoint
63642
- tiers (phone/tablet/notebook/desktop) picked from the extracted breakpoint
63643
- list.
63644
-
63645
- ### Icons
63646
- Sprite-based (\`public/sprites-v2.svg\` + the template's \`Icon\` component,
63647
- a typed union in \`icons.ts\`) — not Phosphor, not per-icon SVG files. Add
63648
- missing icons to the sprite + the union type.
63649
-
63650
- ### Brand assets
63651
- Logo/favicon downloaded to \`assets/\` in this snapshot — the template ships
63652
- a generic placeholder at \`public/brand/logo-placeholder.svg\`; replace it
63653
- and wire it into \`src/components/header/{Desktop,Mobile}Header.tsx\`.
63654
-
63655
- ### Where components go — this target's 3-point-invariant equivalent
63656
- Every section needs all three or the CMS silently drops it:
63657
- 1. The component in \`src/components/sections/<Path>/<Name>.tsx\` — its typed
63658
- \`Props\` export IS the CMS schema (no separate \`.jsonc\` to hand-write).
63659
- 2. The shim in \`src/sections/<Path>.tsx\` — thin re-export,
63660
- \`export { default } from "src/components/sections/<Path>/<Name>"\`, plus
63661
- convention exports (\`sync\`, \`layout\`, \`cache\`, …). The file's PATH is
63662
- the Studio block key.
63663
- 3. \`bun run generate:deco\` to regenerate \`.deco/*.gen.*\`.
63664
- Global vs page-scoped: \`layout = true\` sections (Header/Footer) resolve
63665
- once and cache across navigations; everything else is page content.
63666
-
63667
- ### Editability gate (check every ported section)
63668
- Does it read from its decofile, or did the port hardcode the captured
63669
- content into JSX? Trivial/empty \`Props\` or literal strings >~25 chars in
63670
- the component body means a merchant can't edit it in Studio — visually
63671
- identical to prod, but a CMS regression \`parity\`'s screenshot/HTML diff
63672
- cannot see.
63673
-
63674
- ### Rendering — decide this BEFORE porting the first section
63675
- CMS data renders SSR; product/search data renders CSR when the site uses a
63676
- third-party search provider (its requests are shopper-session-dependent and
63677
- browser-only). This is an architecture decision made once, up front — do
63678
- not let \`parity\` flag the resulting SSR/CSR delta as a regression against
63679
- a source that server-rendered products.
63680
-
63681
- ### Deploy
63682
- WebOps builds straight from \`discovery.config.js\` + \`package.json\`
63683
- scripts — no CLI, no deploy workflow to create. Two accommodations that
63684
- look wrong to a generic Node reviewer but are load-bearing: build-time
63685
- tooling sits in \`dependencies\` (WebOps production installs skip
63686
- \`devDependencies\`), and branch names can't contain a second \`/\`.`;
63687
-
63688
- // src/migrate/targets/tanstack-deco.ts
63689
- var tanstackDeco = `## Target: TanStack Start + Deco CMS
63690
-
63691
- Generate the migrated storefront as a TanStack Start / Cloudflare Workers site using
63692
- the @decocms/* packages. Scaffold from the official template before porting sections.
63693
-
63694
- ### Setup (once)
63695
- - Clone: \`gh repo clone decocms/tanstack-storefront <name>\`
63696
- - Install: \`bun install\`
63697
- - Dev: \`bun run dev\` → http://localhost:5173
63698
-
63699
- ### CLI (@faststore/cli is NOT used here — this is TanStack)
63700
- - \`bun run dev\` local dev server (Vite + Cloudflare Workers)
63701
- - \`bun run build\` production build
63702
- - \`bun run predev\` regenerate types + invoke stubs (run after adding sections)
63703
-
63704
- ### Sections — the CMS unit (mirror of Fresh's sections/)
63705
- Each component from the capture → a section in \`src/components/sections/<Name>.tsx\`.
63706
- Three things must stay in sync (TypeScript enforces this at build time):
63707
- 1. Export in \`src/components/index.tsx\` (the key IS the CMS block type).
63708
- 2. \`export const schema\` on the component (Zod — replaces Fresh's JSDoc annotations).
63709
- 3. A loader in \`src/loaders/\` when the section needs server data.
63710
-
63711
- ### Styling
63712
- TanStack Deco uses **Tailwind** (utility classes) and CSS Modules for overrides,
63713
- NOT SCSS design-token variables (that's FastStore v4). The captured Tailwind classes
63714
- per component are the starting point; cross-check against the prod screenshots.
63715
-
63716
- ### Commerce (VTEX)
63717
- \`@decocms/apps-vtex\` provides loaders and hooks. Import from there instead of
63718
- writing raw GraphQL/REST. Key hooks: \`useCart\`, \`useUser\`, \`useProduct\`.
63719
-
63720
- ### After porting each section
63721
- \`bun run predev\` — regenerates \`src/components/manifest.gen.ts\` and
63722
- \`src/invoke.gen.ts\`. A missing entry here is a 404 in the Deco admin.`;
63723
-
63724
- // src/migrate/targets/index.ts
63725
- var TARGETS = {
63726
- faststore,
63727
- "faststore-v4": faststore,
63728
- "faststore-next": faststoreNext,
63729
- tanstack: tanstackDeco,
63730
- "tanstack-deco": tanstackDeco
63731
- };
63732
- function getTargetPlaybook(name) {
63733
- return Object.hasOwn(TARGETS, name) ? TARGETS[name] : undefined;
63734
- }
63735
- var TARGET_NAMES = Object.keys(TARGETS);
63736
-
63737
63803
  // src/migrate/sources/deco-fresh.ts
63738
63804
  import { existsSync as existsSync12, readFileSync as readFileSync17 } from "node:fs";
63739
63805
  import { join as join26 } from "node:path";
@@ -64664,8 +64730,9 @@ async function migrateCommand(opts) {
64664
64730
  notes: sourceInventory.notes
64665
64731
  }), "utf8");
64666
64732
  }
64667
- if (opts.target === "faststore") {
64668
- writeFileSync23(resolve3(runDir, "custom-theme.scss"), buildFastStoreTheme(theme), "utf8");
64733
+ const targetTheme = opts.target ? getTargetTheme(opts.target) : null;
64734
+ if (targetTheme) {
64735
+ writeFileSync23(resolve3(runDir, targetTheme.filename), targetTheme.build(theme), "utf8");
64669
64736
  }
64670
64737
  if (bundle.vtex) {
64671
64738
  writeFileSync23(resolve3(runDir, "component-map.json"), `${JSON.stringify(bundle.vtex.map, null, 2)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/parity",
3
- "version": "0.26.17",
3
+ "version": "0.26.18",
4
4
  "description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with an LLM-ranked HTML report.",
5
5
  "type": "module",
6
6
  "license": "MIT",