@decocms/start 2.6.0 → 2.7.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.
@@ -136,7 +136,7 @@ See: `references/deco-framework/README.md`
136
136
 
137
137
  **Actions**:
138
138
  1. `from "apps/commerce/types.ts"` → `from "@decocms/apps/commerce/types"`
139
- 2. `from "apps/admin/widgets.ts"` → `from "~/types/widgets"` (create local file)
139
+ 2. `from "apps/admin/widgets.ts"` → `from "@decocms/start/types/widgets"` (framework owns the string aliases — do **not** create a local `src/types/widgets.ts`)
140
140
  3. `from "apps/website/components/Image.tsx"` → `from "~/components/ui/Image"` (create local)
141
141
  4. SDK utilities: `~/sdk/useOffer` → `@decocms/apps/commerce/sdk/useOffer`, etc.
142
142
 
@@ -135,7 +135,38 @@ utility). Your runtime behavior gets MUCH better — segment cookies, IS
135
135
  cookies, VTEX session auth all start working again instead of being
136
136
  silently stubbed to `{}` / `null`.
137
137
 
138
- ## 6. Search for orphan `TODO: move into framework` comments
138
+ ## 6. Drop `src/types/widgets.ts` framework owns it
139
+
140
+ Older migrations scaffold a local `src/types/widgets.ts` containing 8
141
+ string-aliased widget types (`ImageWidget`, `HTMLWidget`, …). The
142
+ framework now exports the same set (plus `TextArea`) at
143
+ `@decocms/start/types/widgets`, and the schema generator detects the
144
+ widgets via type-text matching, so the local file is purely
145
+ duplicated boilerplate.
146
+
147
+ ```bash
148
+ # Quick check
149
+ rg -n "from ['\"]~/types/widgets['\"]" src/ | wc -l # >0 → cleanup applies
150
+ ```
151
+
152
+ Replace all imports in one pass:
153
+
154
+ ```bash
155
+ # macOS / BSD sed: drop the empty quotes after -i
156
+ rg -l "from ['\"]~/types/widgets['\"]" src/ \
157
+ | xargs sed -i '' "s|from ['\"]~/types/widgets['\"]|from \"@decocms/start/types/widgets\"|g"
158
+ ```
159
+
160
+ Then delete the now-orphan local file:
161
+
162
+ ```bash
163
+ rm src/types/widgets.ts
164
+ ```
165
+
166
+ Confirm `tsc --noEmit` is still clean — the framework version is a
167
+ strict superset of what the migration script generated.
168
+
169
+ ## 7. Search for orphan `TODO: move into framework` comments
139
170
 
140
171
  Real sites accumulate `TODO` comments like `// TODO: move into decoVitePlugin
141
172
  in next @decocms/start release`. These are roadmap items the framework
@@ -152,7 +183,7 @@ For each hit, decide:
152
183
 
153
184
  ## Verification checklist
154
185
 
155
- After completing 1-6:
186
+ After completing 1-7:
156
187
 
157
188
  - [ ] `npm run typecheck` baseline matches pre-cleanup count (no new errors)
158
189
  - [ ] `npm run dev` starts and `/`, `/some-pdp/p`, `/s?q=foo` all render
@@ -218,7 +218,7 @@ See: `references/deco-framework/README.md`
218
218
 
219
219
  **Actions**:
220
220
  1. `from "apps/commerce/types.ts"` → `from "@decocms/apps/commerce/types"`
221
- 2. `from "apps/admin/widgets.ts"` → `from "~/types/widgets"` (create local file with string aliases)
221
+ 2. `from "apps/admin/widgets.ts"` → `from "@decocms/start/types/widgets"` (framework owns the string aliases — `ImageWidget`, `HTMLWidget`, etc.; do **not** create a local `src/types/widgets.ts`)
222
222
  3. `from "apps/website/components/Image.tsx"` → `from "~/components/ui/Image"` (create local components)
223
223
  4. SDK utilities: `~/sdk/useOffer` → `@decocms/apps/commerce/sdk/useOffer`, `~/sdk/format` → `@decocms/apps/commerce/sdk/formatPrice`, etc.
224
224
 
@@ -135,7 +135,38 @@ utility). Your runtime behavior gets MUCH better — segment cookies, IS
135
135
  cookies, VTEX session auth all start working again instead of being
136
136
  silently stubbed to `{}` / `null`.
137
137
 
138
- ## 6. Search for orphan `TODO: move into framework` comments
138
+ ## 6. Drop `src/types/widgets.ts` framework owns it
139
+
140
+ Older migrations scaffold a local `src/types/widgets.ts` containing 8
141
+ string-aliased widget types (`ImageWidget`, `HTMLWidget`, …). The
142
+ framework now exports the same set (plus `TextArea`) at
143
+ `@decocms/start/types/widgets`, and the schema generator detects the
144
+ widgets via type-text matching, so the local file is purely
145
+ duplicated boilerplate.
146
+
147
+ ```bash
148
+ # Quick check
149
+ rg -n "from ['\"]~/types/widgets['\"]" src/ | wc -l # >0 → cleanup applies
150
+ ```
151
+
152
+ Replace all imports in one pass:
153
+
154
+ ```bash
155
+ # macOS / BSD sed: drop the empty quotes after -i
156
+ rg -l "from ['\"]~/types/widgets['\"]" src/ \
157
+ | xargs sed -i '' "s|from ['\"]~/types/widgets['\"]|from \"@decocms/start/types/widgets\"|g"
158
+ ```
159
+
160
+ Then delete the now-orphan local file:
161
+
162
+ ```bash
163
+ rm src/types/widgets.ts
164
+ ```
165
+
166
+ Confirm `tsc --noEmit` is still clean — the framework version is a
167
+ strict superset of what the migration script generated.
168
+
169
+ ## 7. Search for orphan `TODO: move into framework` comments
139
170
 
140
171
  Real sites accumulate `TODO` comments like `// TODO: move into decoVitePlugin
141
172
  in next @decocms/start release`. These are roadmap items the framework
@@ -152,7 +183,7 @@ For each hit, decide:
152
183
 
153
184
  ## Verification checklist
154
185
 
155
- After completing 1-6:
186
+ After completing 1-7:
156
187
 
157
188
  - [ ] `npm run typecheck` baseline matches pre-cleanup count (no new errors)
158
189
  - [ ] `npm run dev` starts and `/`, `/some-pdp/p`, `/s?q=foo` all render
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/start",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "type": "module",
5
5
  "description": "Deco framework for TanStack Start - CMS bridge, admin protocol, hooks, schema generation",
6
6
  "main": "./src/index.ts",
@@ -30,7 +30,9 @@ const REQUIRED_FILES = [
30
30
  "src/hooks/useCart.ts",
31
31
  "src/hooks/useUser.ts",
32
32
  "src/hooks/useWishlist.ts",
33
- "src/types/widgets.ts",
33
+ // src/types/widgets.ts intentionally omitted — provided by the
34
+ // framework at `@decocms/start/types/widgets`; sites no longer
35
+ // shadow the file locally.
34
36
  "src/types/deco.ts",
35
37
  "src/types/commerce-app.ts",
36
38
  "src/components/ui/Image.tsx",
@@ -442,7 +444,8 @@ const checks: Check[] = [
442
444
  severity: "warning",
443
445
  fn: (ctx) => {
444
446
  const typeFiles = [
445
- "src/types/widgets.ts",
447
+ // widgets.ts is provided by @decocms/start/types/widgets, not
448
+ // scaffolded locally.
446
449
  "src/types/deco.ts",
447
450
  "src/types/commerce-app.ts",
448
451
  ];
@@ -3,15 +3,12 @@ import type { MigrationContext } from "../types";
3
3
  export function generateTypeFiles(ctx: MigrationContext): Record<string, string> {
4
4
  const files: Record<string, string> = {};
5
5
 
6
- files["src/types/widgets.ts"] = `export type ImageWidget = string;
7
- export type HTMLWidget = string;
8
- export type VideoWidget = string;
9
- export type TextWidget = string;
10
- export type RichText = string;
11
- export type Secret = string;
12
- export type Color = string;
13
- export type ButtonWidget = string;
14
- `;
6
+ // src/types/widgets.ts is no longer generated the framework owns these
7
+ // string aliases (`ImageWidget`, `HTMLWidget`, …) at
8
+ // `@decocms/start/types/widgets`, and `transforms/imports.ts` rewrites
9
+ // `apps/admin/widgets.ts` directly to that path. Schema generation
10
+ // works the same way: the generator matches by type *text*, not module
11
+ // identity (see scripts/generate-schema.ts:WIDGET_TYPE_FORMATS).
15
12
 
16
13
  files["src/types/deco.ts"] = `export type SectionProps<T extends (...args: any[]) => any> = Awaited<
17
14
  ReturnType<T>
@@ -29,7 +29,12 @@ const IMPORT_RULES: Array<[RegExp, string | null]> = [
29
29
  [/^"@deco\/deco"$/, `"~/types/deco"`],
30
30
 
31
31
  // Apps — widgets & components
32
- [/^"apps\/admin\/widgets\.ts"$/, `"~/types/widgets"`],
32
+ // Widget aliases (ImageWidget, HTMLWidget, ...) are framework-owned —
33
+ // every site has the same type set, and the schema generator detects
34
+ // them via type-text matching, not module identity. Re-export from
35
+ // @decocms/start/types/widgets so we don't keep a duplicated 8-line
36
+ // file in every site.
37
+ [/^"apps\/admin\/widgets\.ts"$/, `"@decocms/start/types/widgets"`],
33
38
  [/^"apps\/website\/components\/Image\.tsx"$/, `"~/components/ui/Image"`],
34
39
  [/^"apps\/website\/components\/Picture\.tsx"$/, `"~/components/ui/Picture"`],
35
40
  [/^"apps\/website\/components\/Video\.tsx"$/, `"~/components/ui/Video"`],