@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.
- package/.cursor/skills/deco-api-call-dedup/SKILL.md +443 -0
- package/.cursor/skills/deco-apps-architecture/SKILL.md +255 -0
- package/.cursor/skills/deco-apps-architecture/app-pattern.md +288 -0
- package/.cursor/skills/deco-apps-architecture/commerce-types.md +239 -0
- package/.cursor/skills/deco-apps-architecture/new-app-guide.md +268 -0
- package/.cursor/skills/deco-apps-architecture/scripts-codegen.md +148 -0
- package/.cursor/skills/deco-apps-architecture/shared-utils.md +181 -0
- package/.cursor/skills/deco-apps-architecture/vtex-deep-structure.md +253 -0
- package/.cursor/skills/deco-apps-architecture/website-app.md +169 -0
- package/.cursor/skills/deco-apps-vtex-porting/SKILL.md +189 -0
- package/.cursor/skills/deco-apps-vtex-porting/adaptation-patterns.md +335 -0
- package/.cursor/skills/deco-apps-vtex-porting/commerce-porting.md +155 -0
- package/.cursor/skills/deco-apps-vtex-porting/cookie-auth-patterns.md +148 -0
- package/.cursor/skills/deco-apps-vtex-porting/structure-map.md +234 -0
- package/.cursor/skills/deco-apps-vtex-porting/transform-mapping.md +99 -0
- package/.cursor/skills/deco-apps-vtex-porting/website-porting.md +194 -0
- package/.cursor/skills/deco-apps-vtex-review/SKILL.md +234 -0
- package/.cursor/skills/deco-async-rendering-architecture/SKILL.md +270 -0
- package/.cursor/skills/deco-async-rendering-site-guide/SKILL.md +417 -0
- package/.cursor/skills/deco-cms-layout-caching/SKILL.md +293 -0
- package/.cursor/skills/deco-cms-route-config/SKILL.md +388 -0
- package/.cursor/skills/deco-core-architecture/SKILL.md +185 -0
- package/.cursor/skills/deco-core-architecture/blocks.md +196 -0
- package/.cursor/skills/deco-core-architecture/deco-vs-deco-start.md +191 -0
- package/.cursor/skills/deco-core-architecture/engine.md +220 -0
- package/.cursor/skills/deco-core-architecture/hooks-components.md +157 -0
- package/.cursor/skills/deco-core-architecture/plugins-clients.md +136 -0
- package/.cursor/skills/deco-core-architecture/runtime.md +116 -0
- package/.cursor/skills/deco-core-architecture/site-usage.md +165 -0
- package/.cursor/skills/deco-e2e-testing/SKILL.md +372 -0
- package/.cursor/skills/deco-e2e-testing/discovery.md +337 -0
- package/.cursor/skills/deco-e2e-testing/scripts/scaffold.sh +81 -0
- package/.cursor/skills/deco-e2e-testing/selectors.md +175 -0
- package/.cursor/skills/deco-e2e-testing/templates/package.json +18 -0
- package/.cursor/skills/deco-e2e-testing/templates/playwright.config.ts +65 -0
- package/.cursor/skills/deco-e2e-testing/templates/scripts/baseline.ts +279 -0
- package/.cursor/skills/deco-e2e-testing/templates/scripts/run-e2e.ts +194 -0
- package/.cursor/skills/deco-e2e-testing/templates/specs/ecommerce-flow.spec.ts +612 -0
- package/.cursor/skills/deco-e2e-testing/templates/tsconfig.json +12 -0
- package/.cursor/skills/deco-e2e-testing/templates/utils/metrics-collector.ts +918 -0
- package/.cursor/skills/deco-e2e-testing/troubleshooting.md +602 -0
- package/.cursor/skills/deco-edge-caching/SKILL.md +316 -0
- package/.cursor/skills/deco-full-analysis/SKILL.md +898 -0
- package/.cursor/skills/deco-full-analysis/checklists/asset-optimization.md +251 -0
- package/.cursor/skills/deco-full-analysis/checklists/bug-fix.md +189 -0
- package/.cursor/skills/deco-full-analysis/checklists/cache-strategy.md +144 -0
- package/.cursor/skills/deco-full-analysis/checklists/dependency-update.md +150 -0
- package/.cursor/skills/deco-full-analysis/checklists/hydration-fix.md +191 -0
- package/.cursor/skills/deco-full-analysis/checklists/image-optimization.md +180 -0
- package/.cursor/skills/deco-full-analysis/checklists/loader-optimization.md +165 -0
- package/.cursor/skills/deco-full-analysis/checklists/seo-fix.md +183 -0
- package/.cursor/skills/deco-full-analysis/checklists/site-cleanup.md +281 -0
- package/.cursor/skills/deco-full-analysis/discovery.md +548 -0
- package/.cursor/skills/deco-incident-debugging/SKILL.md +378 -0
- package/.cursor/skills/deco-incident-debugging/headless-mode.md +510 -0
- package/.cursor/skills/deco-incident-debugging/learnings-index.md +227 -0
- package/.cursor/skills/deco-incident-debugging/triage-workflow.md +312 -0
- package/.cursor/skills/deco-islands-migration/SKILL.md +251 -0
- package/.cursor/skills/deco-loader-n-plus-1-detector/SKILL.md +275 -0
- package/.cursor/skills/deco-performance-audit/SKILL.md +530 -0
- package/.cursor/skills/deco-performance-audit/tools-reference.md +428 -0
- package/.cursor/skills/deco-performance-audit/workflow.md +457 -0
- package/.cursor/skills/deco-server-functions-invoke/SKILL.md +92 -0
- package/.cursor/skills/deco-server-functions-invoke/architecture.md +166 -0
- package/.cursor/skills/deco-server-functions-invoke/generator.md +122 -0
- package/.cursor/skills/deco-server-functions-invoke/problem.md +98 -0
- package/.cursor/skills/deco-server-functions-invoke/troubleshooting.md +110 -0
- package/.cursor/skills/deco-site-deployment/SKILL.md +396 -0
- package/.cursor/skills/deco-site-memory-debugging/SKILL.md +121 -0
- package/.cursor/skills/deco-site-memory-debugging/cdp-connection.md +222 -0
- package/.cursor/skills/deco-site-memory-debugging/memory-analysis.md +362 -0
- package/.cursor/skills/deco-site-patterns/SKILL.md +124 -0
- package/.cursor/skills/deco-site-patterns/app-composition.md +337 -0
- package/.cursor/skills/deco-site-patterns/client-patterns.md +341 -0
- package/.cursor/skills/deco-site-patterns/cms-wiring.md +230 -0
- package/.cursor/skills/deco-site-patterns/section-patterns.md +340 -0
- package/.cursor/skills/deco-site-scaling-tuning/SKILL.md +240 -0
- package/.cursor/skills/deco-site-scaling-tuning/analysis-scripts.md +267 -0
- package/.cursor/skills/deco-start-architecture/SKILL.md +218 -0
- package/.cursor/skills/deco-start-architecture/admin-protocol.md +156 -0
- package/.cursor/skills/deco-start-architecture/cms-resolution.md +201 -0
- package/.cursor/skills/deco-start-architecture/code-quality.md +158 -0
- package/.cursor/skills/deco-start-architecture/gap-analysis.md +129 -0
- package/.cursor/skills/deco-start-architecture/sdk-utilities.md +197 -0
- package/.cursor/skills/deco-start-architecture/worker-entry-caching.md +154 -0
- package/.cursor/skills/deco-startup-analysis/SKILL.md +248 -0
- package/.cursor/skills/deco-storefront-test-checklist/SKILL.md +369 -0
- package/.cursor/skills/deco-tanstack-hydration-fixes/SKILL.md +468 -0
- package/.cursor/skills/deco-tanstack-navigation/SKILL.md +681 -0
- package/.cursor/skills/deco-tanstack-search/SKILL.md +411 -0
- package/.cursor/skills/deco-tanstack-storefront-patterns/SKILL.md +1013 -0
- package/.cursor/skills/deco-to-tanstack-migration/SKILL.md +518 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/codemod-commands.md +174 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/commerce/README.md +78 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/deco-framework/README.md +128 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/gotchas.md +719 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/imports/README.md +70 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/platform-hooks/README.md +154 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/signals/README.md +220 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/vite-config/README.md +78 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/package-json.md +55 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/root-route.md +110 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/router.md +96 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/setup-ts.md +167 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/vite-config.md +122 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/worker-entry.md +67 -0
- package/.cursor/skills/deco-typescript-fixes/SKILL.md +178 -0
- package/.cursor/skills/deco-typescript-fixes/common-fixes.md +330 -0
- package/.cursor/skills/deco-typescript-fixes/strategy.md +148 -0
- package/.cursor/skills/deco-variant-selection-perf/SKILL.md +272 -0
- package/.cursor/skills/deco-vtex-fetch-cache/SKILL.md +225 -0
- package/.cursor/skills/find-skills/SKILL.md +133 -0
- package/.cursor/skills/incident-report/SKILL.md +179 -0
- package/.cursor/skills/incident-report/references/5-whys.md +75 -0
- package/.cursor/skills/incident-report/templates/client-report.md +187 -0
- package/.cursor/skills/incident-report/templates/internal-report.md +206 -0
- package/.cursor/skills/template-skill/SKILL.md +38 -0
- package/.github/workflows/release.yml +32 -0
- package/.releaserc.json +25 -0
- package/CLAUDE.md +135 -0
- package/GAP_ANALYSIS.md +224 -0
- package/GAP_ANALYSIS_V2.md +1013 -0
- package/biome.json +39 -0
- package/knip.json +5 -0
- package/package.json +87 -0
- package/scripts/generate-blocks.ts +69 -0
- package/scripts/generate-invoke.ts +378 -0
- package/scripts/generate-schema.ts +657 -0
- package/src/admin/cors.ts +29 -0
- package/src/admin/decofile.ts +72 -0
- package/src/admin/index.ts +24 -0
- package/src/admin/invoke.ts +163 -0
- package/src/admin/liveControls.ts +29 -0
- package/src/admin/meta.ts +70 -0
- package/src/admin/render.ts +205 -0
- package/src/admin/schema.ts +686 -0
- package/src/admin/setup.ts +44 -0
- package/src/cms/index.ts +59 -0
- package/src/cms/loader.ts +180 -0
- package/src/cms/registry.ts +162 -0
- package/src/cms/resolve.ts +1005 -0
- package/src/cms/sectionLoaders.ts +294 -0
- package/src/hooks/DecoPageRenderer.tsx +444 -0
- package/src/hooks/LazySection.tsx +109 -0
- package/src/hooks/LiveControls.tsx +108 -0
- package/src/hooks/SectionErrorFallback.tsx +85 -0
- package/src/hooks/index.ts +8 -0
- package/src/index.ts +5 -0
- package/src/matchers/builtins.ts +184 -0
- package/src/matchers/posthog.ts +154 -0
- package/src/middleware/decoState.ts +55 -0
- package/src/middleware/healthMetrics.ts +131 -0
- package/src/middleware/index.ts +80 -0
- package/src/middleware/liveness.ts +21 -0
- package/src/middleware/observability.ts +205 -0
- package/src/routes/adminRoutes.ts +83 -0
- package/src/routes/cmsRoute.ts +302 -0
- package/src/routes/components.tsx +34 -0
- package/src/routes/index.ts +15 -0
- package/src/sdk/analytics.ts +72 -0
- package/src/sdk/cacheHeaders.ts +268 -0
- package/src/sdk/cachedLoader.ts +206 -0
- package/src/sdk/clx.ts +3 -0
- package/src/sdk/cookie.ts +39 -0
- package/src/sdk/createInvoke.ts +57 -0
- package/src/sdk/csp.ts +59 -0
- package/src/sdk/env.ts +27 -0
- package/src/sdk/index.ts +63 -0
- package/src/sdk/instrumentedFetch.ts +137 -0
- package/src/sdk/invoke.ts +133 -0
- package/src/sdk/mergeCacheControl.ts +150 -0
- package/src/sdk/redirects.ts +217 -0
- package/src/sdk/requestContext.ts +184 -0
- package/src/sdk/serverTimings.ts +68 -0
- package/src/sdk/signal.ts +41 -0
- package/src/sdk/sitemap.ts +143 -0
- package/src/sdk/urlUtils.ts +117 -0
- package/src/sdk/useDevice.ts +82 -0
- package/src/sdk/useId.ts +7 -0
- package/src/sdk/useScript.ts +101 -0
- package/src/sdk/workerEntry.ts +703 -0
- package/src/sdk/wrapCaughtErrors.ts +107 -0
- package/src/types/index.ts +39 -0
- package/src/types/widgets.ts +13 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Codemod Commands
|
|
2
|
+
|
|
3
|
+
All automation commands organized by phase. Run from project root.
|
|
4
|
+
|
|
5
|
+
## Phase 1 — Imports & JSX
|
|
6
|
+
|
|
7
|
+
### Preact → React (safe for bulk)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
find src/ -name '*.ts' -o -name '*.tsx' | xargs sed -i '' \
|
|
11
|
+
-e 's|from "preact/hooks"|from "react"|g' \
|
|
12
|
+
-e 's|from "preact/compat"|from "react"|g' \
|
|
13
|
+
-e 's|from "preact"|from "react"|g'
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### ComponentChildren → ReactNode
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
find src/ -name '*.ts' -o -name '*.tsx' | xargs sed -i '' \
|
|
20
|
+
-e 's/ComponentChildren/ReactNode/g'
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### SVG attributes (safe for bulk)
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
find src/ -name '*.tsx' | xargs sed -i '' \
|
|
27
|
+
-e 's/stroke-width=/strokeWidth=/g' \
|
|
28
|
+
-e 's/stroke-linecap=/strokeLinecap=/g' \
|
|
29
|
+
-e 's/stroke-linejoin=/strokeLinejoin=/g' \
|
|
30
|
+
-e 's/fill-rule=/fillRule=/g' \
|
|
31
|
+
-e 's/clip-rule=/clipRule=/g' \
|
|
32
|
+
-e 's/clip-path=/clipPath=/g' \
|
|
33
|
+
-e 's/stroke-dasharray=/strokeDasharray=/g' \
|
|
34
|
+
-e 's/stroke-dashoffset=/strokeDashoffset=/g'
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### HTML attributes
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
find src/ -name '*.tsx' | xargs sed -i '' \
|
|
41
|
+
-e 's/ for=/ htmlFor=/g' \
|
|
42
|
+
-e 's/ fetchpriority=/ fetchPriority=/g' \
|
|
43
|
+
-e 's/ autocomplete=/ autoComplete=/g'
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Remove JSX pragmas
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
find src/ -name '*.tsx' -o -name '*.ts' | xargs sed -i '' \
|
|
50
|
+
-e '/\/\*\* @jsxRuntime automatic \*\//d' \
|
|
51
|
+
-e '/\/\*\* @jsx h \*\//d' \
|
|
52
|
+
-e '/\/\*\* @jsxFrag Fragment \*\//d'
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Phase 2 — Signals
|
|
56
|
+
|
|
57
|
+
### Module-level signal imports (safe for bulk)
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
find src/ -name '*.ts' -o -name '*.tsx' | xargs sed -i '' \
|
|
61
|
+
's|from "@preact/signals"|from "@decocms/start/sdk/signal"|g'
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Audit useSignal usage (manual conversion needed)
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
grep -rn 'useSignal\|useComputed' src/ --include='*.tsx' --include='*.ts'
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Phase 3 — Deco Framework
|
|
71
|
+
|
|
72
|
+
### Remove $fresh imports
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
find src/ -name '*.ts' -o -name '*.tsx' | xargs sed -i '' \
|
|
76
|
+
-e 's|import { asset } from "\$fresh/runtime.ts";||g' \
|
|
77
|
+
-e 's|asset(\([^)]*\))|\1|g'
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Replace site-local import aliases
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Replace with your actual site name:
|
|
84
|
+
SITE_NAME="osklenbr"
|
|
85
|
+
|
|
86
|
+
find src/ -name '*.ts' -o -name '*.tsx' | xargs sed -i '' \
|
|
87
|
+
-e "s|from \"\\\$store/|from \"~/|g" \
|
|
88
|
+
-e "s|from \"deco-sites/${SITE_NAME}/|from \"~/|g" \
|
|
89
|
+
-e "s|from \"site/|from \"~/|g"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### IS_BROWSER replacement
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
find src/ -name '*.ts' -o -name '*.tsx' | xargs sed -i '' \
|
|
96
|
+
-e 's|import { IS_BROWSER } from "\$fresh/runtime.ts";||g' \
|
|
97
|
+
-e 's|IS_BROWSER|typeof window !== "undefined"|g'
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Phase 4 — Commerce
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
find src/ -name '*.ts' -o -name '*.tsx' | xargs sed -i '' \
|
|
104
|
+
-e 's|from "apps/commerce/types.ts"|from "@decocms/apps/commerce/types"|g' \
|
|
105
|
+
-e 's|from "apps/admin/widgets.ts"|from "~/types/widgets"|g' \
|
|
106
|
+
-e 's|from "apps/website/components/Image.tsx"|from "~/components/ui/Image"|g' \
|
|
107
|
+
-e 's|from "apps/website/components/Picture.tsx"|from "~/components/ui/Picture"|g' \
|
|
108
|
+
-e 's|from "apps/website/components/Video.tsx"|from "~/components/ui/Video"|g'
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### SDK utilities
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
find src/ -name '*.ts' -o -name '*.tsx' | xargs sed -i '' \
|
|
115
|
+
-e 's|from "~/sdk/useOffer.ts"|from "@decocms/apps/commerce/sdk/useOffer"|g' \
|
|
116
|
+
-e 's|from "~/sdk/useOffer"|from "@decocms/apps/commerce/sdk/useOffer"|g' \
|
|
117
|
+
-e 's|from "~/sdk/format.ts"|from "@decocms/apps/commerce/sdk/formatPrice"|g'
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Phase 6 — Islands
|
|
121
|
+
|
|
122
|
+
### Audit island types
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
echo "=== Wrapper islands (re-export from components) ==="
|
|
126
|
+
grep -rl 'export.*from.*components' src/islands/ --include='*.tsx' 2>/dev/null
|
|
127
|
+
|
|
128
|
+
echo ""
|
|
129
|
+
echo "=== Standalone islands (have real logic) ==="
|
|
130
|
+
find src/islands/ -name '*.tsx' ! -exec grep -l 'export.*from.*components' {} \; 2>/dev/null
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Repoint imports from islands/ to components/
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
find src/ -name '*.ts' -o -name '*.tsx' | xargs sed -i '' \
|
|
137
|
+
's|from "~/islands/|from "~/components/|g'
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Verification Commands
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Zero old imports (run after all phases):
|
|
144
|
+
echo "Preact: $(grep -r 'from "preact' src/ --include='*.tsx' --include='*.ts' | wc -l)"
|
|
145
|
+
echo "Signals: $(grep -r '@preact/signals' src/ --include='*.tsx' --include='*.ts' | wc -l)"
|
|
146
|
+
echo "@deco/deco: $(grep -r '@deco/deco' src/ --include='*.tsx' --include='*.ts' | wc -l)"
|
|
147
|
+
echo "\$fresh: $(grep -r '\$fresh' src/ --include='*.tsx' --include='*.ts' | wc -l)"
|
|
148
|
+
echo "apps/: $(grep -r 'from \"apps/' src/ --include='*.tsx' --include='*.ts' | wc -l)"
|
|
149
|
+
echo "islands/: $(grep -r 'from \"~/islands/' src/ --include='*.tsx' --include='*.ts' | wc -l)"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Pre-Flight Audit Script
|
|
153
|
+
|
|
154
|
+
Run against the source site before starting migration:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
echo "=== Source Site Audit ==="
|
|
158
|
+
echo "Components: $(find components/ sections/ -name '*.tsx' 2>/dev/null | wc -l)"
|
|
159
|
+
echo "Islands: $(find islands/ -name '*.tsx' 2>/dev/null | wc -l)"
|
|
160
|
+
echo "Sections: $(find sections/ -name '*.tsx' 2>/dev/null | wc -l)"
|
|
161
|
+
echo "Loaders: $(find loaders/ -name '*.ts' -o -name '*.tsx' 2>/dev/null | wc -l)"
|
|
162
|
+
echo ""
|
|
163
|
+
echo "=== Import Dependencies ==="
|
|
164
|
+
echo "Preact: $(grep -rl 'from "preact' . --include='*.tsx' --include='*.ts' 2>/dev/null | wc -l) files"
|
|
165
|
+
echo "Signals: $(grep -rl '@preact/signals' . --include='*.tsx' --include='*.ts' 2>/dev/null | wc -l) files"
|
|
166
|
+
echo "@deco/deco: $(grep -rl '@deco/deco' . --include='*.tsx' --include='*.ts' 2>/dev/null | wc -l) files"
|
|
167
|
+
echo "\$fresh: $(grep -rl '\$fresh/' . --include='*.tsx' --include='*.ts' 2>/dev/null | wc -l) files"
|
|
168
|
+
echo "apps/: $(grep -rl 'from \"apps/' . --include='*.tsx' --include='*.ts' 2>/dev/null | wc -l) files"
|
|
169
|
+
echo "useSignal: $(grep -r 'useSignal' . --include='*.tsx' --include='*.ts' -c 2>/dev/null | awk -F: '{sum+=$2} END{print sum}')"
|
|
170
|
+
echo ""
|
|
171
|
+
echo "=== CMS Blocks ==="
|
|
172
|
+
echo "Total: $(find .deco/blocks/ -name '*.json' 2>/dev/null | wc -l)"
|
|
173
|
+
echo "Pages: $(find .deco/blocks/ -name 'pages-*.json' 2>/dev/null | wc -l)"
|
|
174
|
+
```
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Commerce & Widget Types Migration
|
|
2
|
+
|
|
3
|
+
## Commerce Types
|
|
4
|
+
|
|
5
|
+
Commerce types live in `@decocms/apps/commerce/types`. Import directly:
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import type { Product, AnalyticsItem, BreadcrumbList } from "@decocms/apps/commerce/types";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Key types available: `Product`, `ProductGroup`, `ProductListingPage`, `ProductDetailsPage`, `Offer`, `AggregateOffer`, `UnitPriceSpecification`, `ImageObject`, `PropertyValue`, `BreadcrumbList`, `SiteNavigationElement`, `Brand`, `Review`, `AggregateRating`, `Filter`, `FilterToggle`, `FilterRange`, `SortOption`, `PageInfo`, `Suggestion`, `Search`, `AnalyticsItem`, `AddToCartParams`.
|
|
12
|
+
|
|
13
|
+
Replace old imports:
|
|
14
|
+
```bash
|
|
15
|
+
sed -i '' 's|from "apps/commerce/types.ts"|from "@decocms/apps/commerce/types"|g'
|
|
16
|
+
sed -i '' 's|from "~/types/commerce"|from "@decocms/apps/commerce/types"|g'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Commerce Utilities
|
|
20
|
+
|
|
21
|
+
Also from `@decocms/apps`:
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { mapProductToAnalyticsItem } from "@decocms/apps/commerce/utils/productToAnalyticsItem";
|
|
25
|
+
import { parseRange, formatRange } from "@decocms/apps/commerce/utils/filters";
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Replace old imports:
|
|
29
|
+
```bash
|
|
30
|
+
sed -i '' 's|from "apps/commerce/utils/productToAnalyticsItem.ts"|from "@decocms/apps/commerce/utils/productToAnalyticsItem"|g'
|
|
31
|
+
sed -i '' 's|from "apps/commerce/utils/filters.ts"|from "@decocms/apps/commerce/utils/filters"|g'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Widget Types
|
|
35
|
+
|
|
36
|
+
CMS widget types are site-local since they're just string aliases. Create `~/types/widgets.ts`:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
export type ImageWidget = string;
|
|
40
|
+
export type HTMLWidget = string;
|
|
41
|
+
export type VideoWidget = string;
|
|
42
|
+
export type TextWidget = string;
|
|
43
|
+
export type RichText = string;
|
|
44
|
+
export type Secret = string;
|
|
45
|
+
export type Color = string;
|
|
46
|
+
export type ButtonWidget = string;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Replace:
|
|
50
|
+
```bash
|
|
51
|
+
sed -i '' 's|from "apps/admin/widgets.ts"|from "~/types/widgets"|g'
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## UI Components (Site-Local)
|
|
55
|
+
|
|
56
|
+
Image, Picture, Seo, Theme etc. are **site-local components** -- they do NOT belong in `@decocms/apps`.
|
|
57
|
+
|
|
58
|
+
Create these in `~/components/ui/`:
|
|
59
|
+
- `Image.tsx` - thin `<img>` wrapper (accepts `preload`, `fit` props for API compat)
|
|
60
|
+
- `Picture.tsx` - `<picture>` + `<Source>` wrapper
|
|
61
|
+
- `Seo.tsx` - head meta tags (stub or real implementation)
|
|
62
|
+
- `Theme.tsx` - CSS variable injection (stub or real)
|
|
63
|
+
- `PoweredByDeco.tsx` - footer badge
|
|
64
|
+
- `Video.tsx` - `<video>` wrapper
|
|
65
|
+
- `SeoPreview.tsx` - admin SEO preview (stub)
|
|
66
|
+
|
|
67
|
+
Replace:
|
|
68
|
+
```bash
|
|
69
|
+
sed -i '' 's|from "apps/website/components/Image.tsx"|from "~/components/ui/Image"|g'
|
|
70
|
+
sed -i '' 's|from "apps/website/components/Picture.tsx"|from "~/components/ui/Picture"|g'
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Verification
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
grep -r 'from "apps/' src/ --include='*.ts' --include='*.tsx'
|
|
77
|
+
# Should return ZERO matches
|
|
78
|
+
```
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Deco Framework Import Elimination
|
|
2
|
+
|
|
3
|
+
Replace all `@deco/deco/*` and `$fresh/*` imports with inline equivalents. No shim files needed.
|
|
4
|
+
|
|
5
|
+
## $fresh/runtime.ts
|
|
6
|
+
|
|
7
|
+
### asset(url)
|
|
8
|
+
|
|
9
|
+
The `asset()` function in Fresh prepends the build hash path. In Vite, static assets are handled automatically. Just remove the wrapper:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
// OLD
|
|
13
|
+
import { asset } from "$fresh/runtime.ts";
|
|
14
|
+
<img src={asset("/sprites.svg")} />
|
|
15
|
+
|
|
16
|
+
// NEW
|
|
17
|
+
<img src="/sprites.svg" />
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### IS_BROWSER
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
// OLD
|
|
24
|
+
import { IS_BROWSER } from "$fresh/runtime.ts";
|
|
25
|
+
|
|
26
|
+
// NEW (inline)
|
|
27
|
+
const IS_BROWSER = typeof document !== "undefined";
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## @deco/deco (bare import)
|
|
31
|
+
|
|
32
|
+
### SectionProps
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
// OLD
|
|
36
|
+
import type { SectionProps } from "@deco/deco";
|
|
37
|
+
type Props = SectionProps<typeof loader>;
|
|
38
|
+
|
|
39
|
+
// NEW (inline type)
|
|
40
|
+
type SectionProps<T extends (...args: any[]) => any> = ReturnType<T>;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Resolved
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
// OLD
|
|
47
|
+
import type { Resolved } from "@deco/deco";
|
|
48
|
+
|
|
49
|
+
// NEW
|
|
50
|
+
type Resolved<T = any> = T;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### context
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
// OLD
|
|
57
|
+
import { context } from "@deco/deco";
|
|
58
|
+
if (context.isDeploy) { ... }
|
|
59
|
+
|
|
60
|
+
// NEW
|
|
61
|
+
const context = { isDeploy: false, platform: "tanstack-start", site: "my-store", siteId: 0 };
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## @deco/deco/blocks
|
|
65
|
+
|
|
66
|
+
### Section, Block
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// OLD
|
|
70
|
+
import type { Section } from "@deco/deco/blocks";
|
|
71
|
+
|
|
72
|
+
// NEW
|
|
73
|
+
type Section = any;
|
|
74
|
+
type Block = any;
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
These were used for Deco CMS section composition. In TanStack Start, sections are just React components.
|
|
78
|
+
|
|
79
|
+
## @deco/deco/hooks
|
|
80
|
+
|
|
81
|
+
### useScript / useScriptAsDataURI
|
|
82
|
+
|
|
83
|
+
These serialize a function into an inline `<script>` string. Create `~/sdk/useScript.ts`:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
export function useScript(fn: (...args: any[]) => void, ...args: any[]): string {
|
|
87
|
+
const serializedArgs = args.map((a) => JSON.stringify(a)).join(",");
|
|
88
|
+
return `(${fn.toString()})(${serializedArgs})`;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function useScriptAsDataURI(fn: (...args: any[]) => void, ...args: any[]): string {
|
|
92
|
+
const code = useScript(fn, ...args);
|
|
93
|
+
return `data:text/javascript;charset=utf-8,${encodeURIComponent(code)}`;
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### usePartialSection
|
|
98
|
+
|
|
99
|
+
Deco partial sections don't apply in TanStack Start. Stub:
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
export function usePartialSection(props?: Record<string, unknown>) {
|
|
103
|
+
return props || {};
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## @deco/deco/o11y
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
// OLD
|
|
111
|
+
import { logger } from "@deco/deco/o11y";
|
|
112
|
+
logger.error("failed", err);
|
|
113
|
+
|
|
114
|
+
// NEW
|
|
115
|
+
console.error("failed", err);
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Automation
|
|
119
|
+
|
|
120
|
+
All of these are safe for bulk sed (each import pattern maps to exactly one replacement).
|
|
121
|
+
|
|
122
|
+
## Verification
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
grep -r '@deco/deco' src/ --include='*.ts' --include='*.tsx'
|
|
126
|
+
grep -r '\$fresh/' src/ --include='*.ts' --include='*.tsx'
|
|
127
|
+
# Both should return ZERO matches
|
|
128
|
+
```
|