@decocms/start 0.19.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.
Files changed (185) hide show
  1. package/.cursor/skills/deco-api-call-dedup/SKILL.md +443 -0
  2. package/.cursor/skills/deco-apps-architecture/SKILL.md +255 -0
  3. package/.cursor/skills/deco-apps-architecture/app-pattern.md +288 -0
  4. package/.cursor/skills/deco-apps-architecture/commerce-types.md +239 -0
  5. package/.cursor/skills/deco-apps-architecture/new-app-guide.md +268 -0
  6. package/.cursor/skills/deco-apps-architecture/scripts-codegen.md +148 -0
  7. package/.cursor/skills/deco-apps-architecture/shared-utils.md +181 -0
  8. package/.cursor/skills/deco-apps-architecture/vtex-deep-structure.md +253 -0
  9. package/.cursor/skills/deco-apps-architecture/website-app.md +169 -0
  10. package/.cursor/skills/deco-apps-vtex-porting/SKILL.md +189 -0
  11. package/.cursor/skills/deco-apps-vtex-porting/adaptation-patterns.md +335 -0
  12. package/.cursor/skills/deco-apps-vtex-porting/commerce-porting.md +155 -0
  13. package/.cursor/skills/deco-apps-vtex-porting/cookie-auth-patterns.md +148 -0
  14. package/.cursor/skills/deco-apps-vtex-porting/structure-map.md +234 -0
  15. package/.cursor/skills/deco-apps-vtex-porting/transform-mapping.md +99 -0
  16. package/.cursor/skills/deco-apps-vtex-porting/website-porting.md +194 -0
  17. package/.cursor/skills/deco-apps-vtex-review/SKILL.md +234 -0
  18. package/.cursor/skills/deco-async-rendering-architecture/SKILL.md +270 -0
  19. package/.cursor/skills/deco-async-rendering-site-guide/SKILL.md +417 -0
  20. package/.cursor/skills/deco-cms-layout-caching/SKILL.md +293 -0
  21. package/.cursor/skills/deco-cms-route-config/SKILL.md +388 -0
  22. package/.cursor/skills/deco-core-architecture/SKILL.md +185 -0
  23. package/.cursor/skills/deco-core-architecture/blocks.md +196 -0
  24. package/.cursor/skills/deco-core-architecture/deco-vs-deco-start.md +191 -0
  25. package/.cursor/skills/deco-core-architecture/engine.md +220 -0
  26. package/.cursor/skills/deco-core-architecture/hooks-components.md +157 -0
  27. package/.cursor/skills/deco-core-architecture/plugins-clients.md +136 -0
  28. package/.cursor/skills/deco-core-architecture/runtime.md +116 -0
  29. package/.cursor/skills/deco-core-architecture/site-usage.md +165 -0
  30. package/.cursor/skills/deco-e2e-testing/SKILL.md +372 -0
  31. package/.cursor/skills/deco-e2e-testing/discovery.md +337 -0
  32. package/.cursor/skills/deco-e2e-testing/scripts/scaffold.sh +81 -0
  33. package/.cursor/skills/deco-e2e-testing/selectors.md +175 -0
  34. package/.cursor/skills/deco-e2e-testing/templates/package.json +18 -0
  35. package/.cursor/skills/deco-e2e-testing/templates/playwright.config.ts +65 -0
  36. package/.cursor/skills/deco-e2e-testing/templates/scripts/baseline.ts +279 -0
  37. package/.cursor/skills/deco-e2e-testing/templates/scripts/run-e2e.ts +194 -0
  38. package/.cursor/skills/deco-e2e-testing/templates/specs/ecommerce-flow.spec.ts +612 -0
  39. package/.cursor/skills/deco-e2e-testing/templates/tsconfig.json +12 -0
  40. package/.cursor/skills/deco-e2e-testing/templates/utils/metrics-collector.ts +918 -0
  41. package/.cursor/skills/deco-e2e-testing/troubleshooting.md +602 -0
  42. package/.cursor/skills/deco-edge-caching/SKILL.md +316 -0
  43. package/.cursor/skills/deco-full-analysis/SKILL.md +898 -0
  44. package/.cursor/skills/deco-full-analysis/checklists/asset-optimization.md +251 -0
  45. package/.cursor/skills/deco-full-analysis/checklists/bug-fix.md +189 -0
  46. package/.cursor/skills/deco-full-analysis/checklists/cache-strategy.md +144 -0
  47. package/.cursor/skills/deco-full-analysis/checklists/dependency-update.md +150 -0
  48. package/.cursor/skills/deco-full-analysis/checklists/hydration-fix.md +191 -0
  49. package/.cursor/skills/deco-full-analysis/checklists/image-optimization.md +180 -0
  50. package/.cursor/skills/deco-full-analysis/checklists/loader-optimization.md +165 -0
  51. package/.cursor/skills/deco-full-analysis/checklists/seo-fix.md +183 -0
  52. package/.cursor/skills/deco-full-analysis/checklists/site-cleanup.md +281 -0
  53. package/.cursor/skills/deco-full-analysis/discovery.md +548 -0
  54. package/.cursor/skills/deco-incident-debugging/SKILL.md +378 -0
  55. package/.cursor/skills/deco-incident-debugging/headless-mode.md +510 -0
  56. package/.cursor/skills/deco-incident-debugging/learnings-index.md +227 -0
  57. package/.cursor/skills/deco-incident-debugging/triage-workflow.md +312 -0
  58. package/.cursor/skills/deco-islands-migration/SKILL.md +251 -0
  59. package/.cursor/skills/deco-loader-n-plus-1-detector/SKILL.md +275 -0
  60. package/.cursor/skills/deco-performance-audit/SKILL.md +530 -0
  61. package/.cursor/skills/deco-performance-audit/tools-reference.md +428 -0
  62. package/.cursor/skills/deco-performance-audit/workflow.md +457 -0
  63. package/.cursor/skills/deco-server-functions-invoke/SKILL.md +92 -0
  64. package/.cursor/skills/deco-server-functions-invoke/architecture.md +166 -0
  65. package/.cursor/skills/deco-server-functions-invoke/generator.md +122 -0
  66. package/.cursor/skills/deco-server-functions-invoke/problem.md +98 -0
  67. package/.cursor/skills/deco-server-functions-invoke/troubleshooting.md +110 -0
  68. package/.cursor/skills/deco-site-deployment/SKILL.md +396 -0
  69. package/.cursor/skills/deco-site-memory-debugging/SKILL.md +121 -0
  70. package/.cursor/skills/deco-site-memory-debugging/cdp-connection.md +222 -0
  71. package/.cursor/skills/deco-site-memory-debugging/memory-analysis.md +362 -0
  72. package/.cursor/skills/deco-site-patterns/SKILL.md +124 -0
  73. package/.cursor/skills/deco-site-patterns/app-composition.md +337 -0
  74. package/.cursor/skills/deco-site-patterns/client-patterns.md +341 -0
  75. package/.cursor/skills/deco-site-patterns/cms-wiring.md +230 -0
  76. package/.cursor/skills/deco-site-patterns/section-patterns.md +340 -0
  77. package/.cursor/skills/deco-site-scaling-tuning/SKILL.md +240 -0
  78. package/.cursor/skills/deco-site-scaling-tuning/analysis-scripts.md +267 -0
  79. package/.cursor/skills/deco-start-architecture/SKILL.md +218 -0
  80. package/.cursor/skills/deco-start-architecture/admin-protocol.md +156 -0
  81. package/.cursor/skills/deco-start-architecture/cms-resolution.md +201 -0
  82. package/.cursor/skills/deco-start-architecture/code-quality.md +158 -0
  83. package/.cursor/skills/deco-start-architecture/gap-analysis.md +129 -0
  84. package/.cursor/skills/deco-start-architecture/sdk-utilities.md +197 -0
  85. package/.cursor/skills/deco-start-architecture/worker-entry-caching.md +154 -0
  86. package/.cursor/skills/deco-startup-analysis/SKILL.md +248 -0
  87. package/.cursor/skills/deco-storefront-test-checklist/SKILL.md +369 -0
  88. package/.cursor/skills/deco-tanstack-hydration-fixes/SKILL.md +468 -0
  89. package/.cursor/skills/deco-tanstack-navigation/SKILL.md +681 -0
  90. package/.cursor/skills/deco-tanstack-search/SKILL.md +411 -0
  91. package/.cursor/skills/deco-tanstack-storefront-patterns/SKILL.md +1013 -0
  92. package/.cursor/skills/deco-to-tanstack-migration/SKILL.md +518 -0
  93. package/.cursor/skills/deco-to-tanstack-migration/references/codemod-commands.md +174 -0
  94. package/.cursor/skills/deco-to-tanstack-migration/references/commerce/README.md +78 -0
  95. package/.cursor/skills/deco-to-tanstack-migration/references/deco-framework/README.md +128 -0
  96. package/.cursor/skills/deco-to-tanstack-migration/references/gotchas.md +719 -0
  97. package/.cursor/skills/deco-to-tanstack-migration/references/imports/README.md +70 -0
  98. package/.cursor/skills/deco-to-tanstack-migration/references/platform-hooks/README.md +154 -0
  99. package/.cursor/skills/deco-to-tanstack-migration/references/signals/README.md +220 -0
  100. package/.cursor/skills/deco-to-tanstack-migration/references/vite-config/README.md +78 -0
  101. package/.cursor/skills/deco-to-tanstack-migration/templates/package-json.md +55 -0
  102. package/.cursor/skills/deco-to-tanstack-migration/templates/root-route.md +110 -0
  103. package/.cursor/skills/deco-to-tanstack-migration/templates/router.md +96 -0
  104. package/.cursor/skills/deco-to-tanstack-migration/templates/setup-ts.md +167 -0
  105. package/.cursor/skills/deco-to-tanstack-migration/templates/vite-config.md +122 -0
  106. package/.cursor/skills/deco-to-tanstack-migration/templates/worker-entry.md +67 -0
  107. package/.cursor/skills/deco-typescript-fixes/SKILL.md +178 -0
  108. package/.cursor/skills/deco-typescript-fixes/common-fixes.md +330 -0
  109. package/.cursor/skills/deco-typescript-fixes/strategy.md +148 -0
  110. package/.cursor/skills/deco-variant-selection-perf/SKILL.md +272 -0
  111. package/.cursor/skills/deco-vtex-fetch-cache/SKILL.md +225 -0
  112. package/.cursor/skills/find-skills/SKILL.md +133 -0
  113. package/.cursor/skills/incident-report/SKILL.md +179 -0
  114. package/.cursor/skills/incident-report/references/5-whys.md +75 -0
  115. package/.cursor/skills/incident-report/templates/client-report.md +187 -0
  116. package/.cursor/skills/incident-report/templates/internal-report.md +206 -0
  117. package/.cursor/skills/template-skill/SKILL.md +38 -0
  118. package/.github/workflows/release.yml +32 -0
  119. package/.releaserc.json +25 -0
  120. package/CLAUDE.md +135 -0
  121. package/GAP_ANALYSIS.md +224 -0
  122. package/GAP_ANALYSIS_V2.md +1013 -0
  123. package/biome.json +39 -0
  124. package/knip.json +5 -0
  125. package/package.json +87 -0
  126. package/scripts/generate-blocks.ts +69 -0
  127. package/scripts/generate-invoke.ts +378 -0
  128. package/scripts/generate-schema.ts +657 -0
  129. package/src/admin/cors.ts +29 -0
  130. package/src/admin/decofile.ts +72 -0
  131. package/src/admin/index.ts +24 -0
  132. package/src/admin/invoke.ts +163 -0
  133. package/src/admin/liveControls.ts +29 -0
  134. package/src/admin/meta.ts +70 -0
  135. package/src/admin/render.ts +205 -0
  136. package/src/admin/schema.ts +686 -0
  137. package/src/admin/setup.ts +44 -0
  138. package/src/cms/index.ts +59 -0
  139. package/src/cms/loader.ts +180 -0
  140. package/src/cms/registry.ts +162 -0
  141. package/src/cms/resolve.ts +1005 -0
  142. package/src/cms/sectionLoaders.ts +294 -0
  143. package/src/hooks/DecoPageRenderer.tsx +444 -0
  144. package/src/hooks/LazySection.tsx +109 -0
  145. package/src/hooks/LiveControls.tsx +108 -0
  146. package/src/hooks/SectionErrorFallback.tsx +85 -0
  147. package/src/hooks/index.ts +8 -0
  148. package/src/index.ts +5 -0
  149. package/src/matchers/builtins.ts +184 -0
  150. package/src/matchers/posthog.ts +154 -0
  151. package/src/middleware/decoState.ts +55 -0
  152. package/src/middleware/healthMetrics.ts +131 -0
  153. package/src/middleware/index.ts +80 -0
  154. package/src/middleware/liveness.ts +21 -0
  155. package/src/middleware/observability.ts +205 -0
  156. package/src/routes/adminRoutes.ts +83 -0
  157. package/src/routes/cmsRoute.ts +302 -0
  158. package/src/routes/components.tsx +34 -0
  159. package/src/routes/index.ts +15 -0
  160. package/src/sdk/analytics.ts +72 -0
  161. package/src/sdk/cacheHeaders.ts +268 -0
  162. package/src/sdk/cachedLoader.ts +206 -0
  163. package/src/sdk/clx.ts +3 -0
  164. package/src/sdk/cookie.ts +39 -0
  165. package/src/sdk/createInvoke.ts +57 -0
  166. package/src/sdk/csp.ts +59 -0
  167. package/src/sdk/env.ts +27 -0
  168. package/src/sdk/index.ts +63 -0
  169. package/src/sdk/instrumentedFetch.ts +137 -0
  170. package/src/sdk/invoke.ts +133 -0
  171. package/src/sdk/mergeCacheControl.ts +150 -0
  172. package/src/sdk/redirects.ts +217 -0
  173. package/src/sdk/requestContext.ts +184 -0
  174. package/src/sdk/serverTimings.ts +68 -0
  175. package/src/sdk/signal.ts +41 -0
  176. package/src/sdk/sitemap.ts +143 -0
  177. package/src/sdk/urlUtils.ts +117 -0
  178. package/src/sdk/useDevice.ts +82 -0
  179. package/src/sdk/useId.ts +7 -0
  180. package/src/sdk/useScript.ts +101 -0
  181. package/src/sdk/workerEntry.ts +703 -0
  182. package/src/sdk/wrapCaughtErrors.ts +107 -0
  183. package/src/types/index.ts +39 -0
  184. package/src/types/widgets.ts +13 -0
  185. package/tsconfig.json +13 -0
@@ -0,0 +1,183 @@
1
+ # SEO Fix Checklist
2
+
3
+ 10 learnings from real Deco sites. Check these during analysis.
4
+
5
+ ## Structured Data (JSON-LD)
6
+
7
+ ### 1. Safe JSON-LD Embedding
8
+ **Check**: Is JSON-LD properly escaped?
9
+
10
+ ```typescript
11
+ // Bad: Vulnerable to injection
12
+ <script type="application/ld+json">
13
+ {JSON.stringify(product)}
14
+ </script>
15
+
16
+ // Good: Escape < character
17
+ <script type="application/ld+json">
18
+ {JSON.stringify(product).replace(/</g, '\\u003c')}
19
+ </script>
20
+ ```
21
+
22
+ This prevents:
23
+ - Google Search Console errors
24
+ - XSS injection attacks
25
+
26
+ ### 2. Price Formatting
27
+ **Check**: Are prices formatted to exactly 2 decimals?
28
+
29
+ ```typescript
30
+ // Bad: Variable decimals
31
+ price: product.price // 99.9 or 99
32
+
33
+ // Good: Always 2 decimals
34
+ price: product.price.toFixed(2) // "99.90"
35
+ ```
36
+
37
+ Google Merchant Center requires exactly 2 decimal places.
38
+
39
+ ### 3. GTIN/EAN Validation
40
+ **Check**: Are GTIN codes validated before including?
41
+
42
+ ```typescript
43
+ function isValidGTIN(gtin: string): boolean {
44
+ // Implement checksum validation
45
+ const digits = gtin.replace(/\D/g, '');
46
+ if (![8, 12, 13, 14].includes(digits.length)) return false;
47
+ // ... checksum logic
48
+ }
49
+
50
+ // Only include if valid
51
+ gtin: isValidGTIN(product.gtin) ? product.gtin : undefined
52
+ ```
53
+
54
+ Invalid GTINs cause Merchant Center penalties.
55
+
56
+ ### 4. FAQ Schema
57
+ **Check**: Do FAQ sections inject JSON-LD?
58
+
59
+ ```typescript
60
+ const faqSchema = {
61
+ "@context": "https://schema.org",
62
+ "@type": "FAQPage",
63
+ "mainEntity": questions.map(q => ({
64
+ "@type": "Question",
65
+ "name": q.question,
66
+ "acceptedAnswer": {
67
+ "@type": "Answer",
68
+ "text": q.answer
69
+ }
70
+ }))
71
+ };
72
+ ```
73
+
74
+ ## Meta Tags
75
+
76
+ ### 5. Duplicate Meta Descriptions
77
+ **Check**: Is only one SEO section active per page?
78
+
79
+ ```bash
80
+ # Find pages with multiple SEO sections
81
+ grep -l "SEO" .deco/blocks/pages-*.json | xargs grep -c "SEO"
82
+ ```
83
+
84
+ Multiple SEO sections = duplicate meta tags = SEO penalty.
85
+
86
+ ### 6. SEO Block on Every Page
87
+ **Check**: Does every page block have an `seo` section?
88
+
89
+ ```json
90
+ {
91
+ "name": "Home",
92
+ "sections": [...],
93
+ "seo": {
94
+ "__resolveType": "website/sections/Seo/Seo.tsx",
95
+ "title": "...",
96
+ "description": "..."
97
+ }
98
+ }
99
+ ```
100
+
101
+ ## Canonical URLs
102
+
103
+ ### 7. Strip Non-SEO Parameters
104
+ **Check**: Do canonical URLs include tracking params?
105
+
106
+ ```typescript
107
+ // Good: Strip UTMs and tracking
108
+ function getCanonicalUrl(url: URL): string {
109
+ const canonical = new URL(url);
110
+ ['utm_source', 'utm_medium', 'utm_campaign', 'gclid', 'fbclid']
111
+ .forEach(param => canonical.searchParams.delete(param));
112
+ return canonical.toString();
113
+ }
114
+ ```
115
+
116
+ ### 8. Noindex for Filtered PLPs
117
+ **Check**: Are PLPs with filters indexed?
118
+
119
+ ```typescript
120
+ // Add noindex for filtered/sorted pages
121
+ const hasFilters = url.searchParams.has('filter') ||
122
+ url.searchParams.has('sort');
123
+
124
+ <meta name="robots" content={hasFilters ? "noindex,follow" : "index,follow"} />
125
+ ```
126
+
127
+ ## Semantic HTML
128
+
129
+ ### 9. Single H1 Per Page
130
+ **Check**: Is the primary title wrapped in `<h1>`?
131
+
132
+ ```tsx
133
+ // PDP: Product name should be h1
134
+ <h1>{product.name}</h1>
135
+
136
+ // PLP: Category name should be h1
137
+ <h1>{category.name}</h1>
138
+
139
+ // Search: Search term should be h1
140
+ <h1>Results for "{query}"</h1>
141
+ ```
142
+
143
+ ### 10. Language Attribute
144
+ **Check**: Is the `lang` attribute correct?
145
+
146
+ ```typescript
147
+ // In fresh.config.ts
148
+ export default defineConfig({
149
+ lang: "pt-BR", // or "en-US", etc.
150
+ });
151
+ ```
152
+
153
+ ## Quick Audit Commands
154
+
155
+ ```bash
156
+ # Check for pages without SEO section
157
+ for f in .deco/blocks/pages-*.json; do
158
+ grep -q '"seo"' "$f" || echo "Missing SEO: $f"
159
+ done
160
+
161
+ # Find duplicate meta descriptions in page
162
+ grep -c '"description"' .deco/blocks/pages-*.json | grep -v ':1$'
163
+
164
+ # Check for unescaped JSON-LD
165
+ grep -r "JSON.stringify" sections/ | grep -v "replace"
166
+ ```
167
+
168
+ ## SEO Audit Table
169
+
170
+ Add this to AGENTS.md:
171
+
172
+ ```markdown
173
+ ## SEO Health
174
+
175
+ | Check | Status |
176
+ |-------|--------|
177
+ | All pages have SEO section | ✅ |
178
+ | JSON-LD properly escaped | ✅ |
179
+ | Prices have 2 decimals | ❌ Check ProductCard |
180
+ | GTIN validation | ⚠️ Not implemented |
181
+ | Canonical URLs clean | ✅ |
182
+ | Filtered PLPs noindex | ❌ Missing |
183
+ ```
@@ -0,0 +1,281 @@
1
+ # Site Cleanup Checklist
2
+
3
+ Patterns for cleaning up Deco sites, removing dead code, and simplifying architecture. Based on real migration work from casaevideo.
4
+
5
+ ## Platform File Cleanup
6
+
7
+ Most Deco sites start from the storefront template which includes files for **all** supported platforms (VTEX, Shopify, Wake, Linx, VNDA, Nuvemshop). If your site only uses one platform, the other files are dead weight causing:
8
+
9
+ - **TypeScript errors** when imports break
10
+ - **Larger bundle analysis** (unused code is still parsed)
11
+ - **Confusion** for developers
12
+ - **Stale code** that accumulates over time
13
+
14
+ ### 1. Identify Unused Platform Files
15
+
16
+ **Check**: Which platform does the site actually use?
17
+
18
+ ```bash
19
+ # Check apps configuration
20
+ grep -r "__resolveType.*apps/vtex\|apps/shopify\|apps/wake\|apps/linx\|apps/vnda\|apps/nuvemshop" .deco/blocks/
21
+
22
+ # Check deno.json for platform imports
23
+ grep -E "vtex|shopify|wake|linx|vnda|nuvemshop" deno.json
24
+ ```
25
+
26
+ **Common locations of platform-specific files:**
27
+
28
+ | Directory | Pattern | Purpose |
29
+ |-----------|---------|---------|
30
+ | `components/header/Buttons/Cart/` | `{platform}.tsx` | Cart button per platform |
31
+ | `components/minicart/` | `{platform}/Cart.tsx` | Minicart implementation |
32
+ | `components/product/AddToCartButton/` | `{platform}.tsx` | Add to cart button |
33
+ | `islands/AddToCartButton/` | `{platform}.tsx` | Interactive cart buttons |
34
+ | `islands/Header/Cart/` | `{platform}.tsx` | Header cart islands |
35
+
36
+ ### 2. Delete Unused Platform Files
37
+
38
+ For a VTEX-only site, remove these files:
39
+
40
+ ```bash
41
+ # Cart buttons (header)
42
+ rm components/header/Buttons/Cart/{linx,shopify,vnda,wake,nuvemshop}.tsx
43
+
44
+ # Minicart implementations
45
+ rm -rf components/minicart/{linx,shopify,vnda,wake,nuvemshop}/
46
+
47
+ # Add to cart buttons
48
+ rm components/product/AddToCartButton/{linx,shopify,vnda,wake,nuvemshop}.tsx
49
+
50
+ # Islands
51
+ rm islands/AddToCartButton/{linx,shopify,vnda,wake,nuvemshop}.tsx
52
+ rm islands/Header/Cart/{linx,shopify,vnda,wake,nuvemshop}.tsx
53
+ ```
54
+
55
+ **For Shopify-only sites**, delete vtex, wake, linx, vnda, nuvemshop. And so on.
56
+
57
+ ### 3. Simplify Platform Switching Logic
58
+
59
+ After removing files, simplify components that had platform conditionals:
60
+
61
+ **Before (multi-platform):**
62
+ ```typescript
63
+ // components/minicart/Cart.tsx
64
+ import { lazy } from "preact/compat";
65
+ import type { usePlatform } from "$store/sdk/usePlatform.tsx";
66
+
67
+ const CartVTEX = lazy(() => import("./vtex/Cart.tsx"));
68
+ const CartVNDA = lazy(() => import("./vnda/Cart.tsx"));
69
+ const CartWake = lazy(() => import("./wake/Cart.tsx"));
70
+ const CartLinx = lazy(() => import("./linx/Cart.tsx"));
71
+ const CartShopify = lazy(() => import("./shopify/Cart.tsx"));
72
+ const CartNuvemshop = lazy(() => import("./nuvemshop/Cart.tsx"));
73
+
74
+ export interface Props {
75
+ platform: ReturnType<typeof usePlatform>;
76
+ minicartProps: MinicartProps;
77
+ }
78
+
79
+ function Cart({ platform, minicartProps }: Props) {
80
+ if (platform === "vtex") return <CartVTEX minicartProps={minicartProps} />;
81
+ if (platform === "vnda") return <CartVNDA />;
82
+ if (platform === "wake") return <CartWake />;
83
+ // ... etc
84
+ return null;
85
+ }
86
+ ```
87
+
88
+ **After (VTEX-only):**
89
+ ```typescript
90
+ // components/minicart/Cart.tsx
91
+ import { lazy } from "preact/compat";
92
+ import type { MinicartProps } from "$store/components/header/Drawers.tsx";
93
+
94
+ const CartVTEX = lazy(() => import("./vtex/Cart.tsx"));
95
+
96
+ export interface Props {
97
+ minicartProps: MinicartProps;
98
+ }
99
+
100
+ function Cart({ minicartProps }: Props) {
101
+ return <CartVTEX minicartProps={minicartProps} />;
102
+ }
103
+
104
+ export default Cart;
105
+ ```
106
+
107
+ ### 4. Clean Up apps/site.ts
108
+
109
+ Remove unused platform imports and simplify the Platform type:
110
+
111
+ **Before:**
112
+ ```typescript
113
+ import { color as shopify } from "apps/shopify/mod.ts";
114
+ import { color as vnda } from "apps/vnda/mod.ts";
115
+ import type vtex from "apps/vtex/mod.ts";
116
+ import { color as vtexColor } from "apps/vtex/mod.ts";
117
+ import { color as wake } from "apps/wake/mod.ts";
118
+ import { color as linx } from "apps/linx/mod.ts";
119
+ import { color as nuvemshop } from "apps/nuvemshop/mod.ts";
120
+
121
+ export type Platform = "vtex" | "vnda" | "shopify" | "wake" | "linx" | "nuvemshop" | "custom";
122
+ ```
123
+
124
+ **After:**
125
+ ```typescript
126
+ import vtex, { color as vtexColor } from "apps/vtex/mod.ts";
127
+
128
+ export type Platform = "vtex" | "custom";
129
+ ```
130
+
131
+ ### 5. Clean Up runtime.ts
132
+
133
+ Remove unused manifest imports:
134
+
135
+ ```diff
136
+ - import vnda from "apps/vnda/manifest.gen.ts";
137
+
138
+ import manifest from "./manifest.gen.ts";
139
+
140
+ export const invoke = Deco.init({
141
+ manifest,
142
+ - importMap: { "apps/vnda/": vnda },
143
+ });
144
+ ```
145
+
146
+ ## Component Props Cleanup
147
+
148
+ ### 6. Remove Unused `platform` Props
149
+
150
+ After platform simplification, many components pass a `platform` prop that's no longer needed:
151
+
152
+ ```typescript
153
+ // Before: Header passes platform to children
154
+ interface Props {
155
+ platform: Platform;
156
+ // ...
157
+ }
158
+
159
+ // After: Remove platform prop entirely
160
+ interface Props {
161
+ // ...
162
+ }
163
+ ```
164
+
165
+ Search for components still passing platform:
166
+ ```bash
167
+ grep -rn "platform={platform}" components/
168
+ grep -rn "usePlatform()" components/
169
+ ```
170
+
171
+ ## Runtime Type Fixes
172
+
173
+ ### 7. Custom Types for GraphQL Responses
174
+
175
+ When VTEX GraphQL responses don't match official types, create custom interfaces:
176
+
177
+ ```typescript
178
+ // loaders/getOrderingOrders.ts
179
+ // The official Order type from apps/vtex/utils/types.ts
180
+ // is for REST API, not GraphQL queries
181
+
182
+ export interface VtexOrderData {
183
+ orderId: string;
184
+ status: string;
185
+ creationDate: string;
186
+ totals: Array<{
187
+ id: string;
188
+ name: string;
189
+ value: number;
190
+ }>;
191
+ // ... only the fields actually returned by your query
192
+ }
193
+
194
+ // Then use this type instead of importing from vtex/utils/types.ts
195
+ export default async function loader(): Promise<VtexOrderData[]> {
196
+ // ...
197
+ }
198
+ ```
199
+
200
+ ### 8. Third-Party SDK Types
201
+
202
+ When integrating third-party SDKs (Emarsys, Google Analytics, etc.), add proper types to `global.d.ts`:
203
+
204
+ ```typescript
205
+ // types/global.d.ts
206
+ interface RecommendOptions {
207
+ logic?: string;
208
+ containerId?: string;
209
+ limit?: number;
210
+ filters?: Record<string, unknown>;
211
+ }
212
+
213
+ interface ScarabQueue {
214
+ push: (args: [string, ...unknown[]]) => void;
215
+ recommend?: (options: RecommendOptions) => void;
216
+ }
217
+
218
+ declare global {
219
+ interface Window {
220
+ ScarabQueue?: ScarabQueue;
221
+ // Other third-party globals
222
+ }
223
+ }
224
+
225
+ export {};
226
+ ```
227
+
228
+ ### 9. Export Props from Section Wrappers
229
+
230
+ When a section re-exports from an island, also export the Props type:
231
+
232
+ ```typescript
233
+ // sections/Live.tsx
234
+ // Bad: Missing Props export causes TypeScript errors
235
+ export { default } from "$store/islands/Live.tsx";
236
+
237
+ // Good: Export both default and Props
238
+ export { default, type Props } from "$store/islands/Live.tsx";
239
+
240
+ export const LoadingFallback = () => {
241
+ return <div></div>;
242
+ };
243
+ ```
244
+
245
+ ## Quick Audit Commands
246
+
247
+ ```bash
248
+ # Find all platform files
249
+ find . -name "*.tsx" | xargs grep -l "platform.*vtex\|platform.*shopify" | head -20
250
+
251
+ # Find unused platform imports
252
+ grep -rn "from.*apps/shopify\|from.*apps/wake\|from.*apps/linx\|from.*apps/vnda\|from.*apps/nuvemshop" --include="*.ts" --include="*.tsx"
253
+
254
+ # Find usePlatform calls (candidates for removal)
255
+ grep -rn "usePlatform()" components/ sections/ islands/
256
+
257
+ # Find platform conditionals
258
+ grep -rn 'platform === "shopify"\|platform === "wake"' components/ sections/
259
+
260
+ # Count platform-specific files
261
+ for platform in vtex shopify wake linx vnda nuvemshop; do
262
+ echo "$platform: $(find . -name "*$platform*" -type f | wc -l) files"
263
+ done
264
+ ```
265
+
266
+ ## Cleanup Impact
267
+
268
+ For casaevideo (VTEX-only site), this cleanup removed:
269
+
270
+ | Metric | Before | After | Reduction |
271
+ |--------|--------|-------|-----------|
272
+ | Platform files | 25 | 0 | -25 files |
273
+ | Lines of code | ~564 | 0 | -564 LOC |
274
+ | TypeScript errors | 15+ | 0 | Fixed |
275
+ | Component complexity | Multi-platform conditionals | Single path | Simpler |
276
+
277
+ ## When NOT to Clean Up
278
+
279
+ - **Multi-tenant setups**: If the same codebase serves multiple platforms
280
+ - **Migration in progress**: If you're moving from one platform to another
281
+ - **Shared components**: If you maintain a template for multiple stores