@decocms/blocks 8.11.0 → 8.12.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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/protocol/conformance/blockMetaVectors.json +80 -0
- package/dist/protocol/index.d.ts +5 -2
- package/dist/protocol/index.d.ts.map +1 -1
- package/dist/protocol/index.js +5 -2
- package/dist/protocol/index.js.map +1 -1
- package/dist/v8/blockMeta.d.ts +33 -4
- package/dist/v8/blockMeta.d.ts.map +1 -1
- package/dist/v8/blockMeta.js +70 -13
- package/dist/v8/blockMeta.js.map +1 -1
- package/dist/v8/client.d.ts +6 -4
- package/dist/v8/client.d.ts.map +1 -1
- package/dist/v8/client.js +26 -70
- package/dist/v8/client.js.map +1 -1
- package/dist/v8/cms.d.ts.map +1 -1
- package/dist/v8/cms.js +1 -2
- package/dist/v8/cms.js.map +1 -1
- package/dist/v8/contentIndex.d.ts +18 -7
- package/dist/v8/contentIndex.d.ts.map +1 -1
- package/dist/v8/contentIndex.js +46 -17
- package/dist/v8/contentIndex.js.map +1 -1
- package/dist/v8/draftChanges.d.ts.map +1 -1
- package/dist/v8/draftChanges.js +4 -1
- package/dist/v8/draftChanges.js.map +1 -1
- package/dist/v8/index.d.ts +1 -1
- package/dist/v8/index.d.ts.map +1 -1
- package/dist/v8/remoteLoader.d.ts +4 -2
- package/dist/v8/remoteLoader.d.ts.map +1 -1
- package/dist/v8/remoteLoader.js +13 -3
- package/dist/v8/remoteLoader.js.map +1 -1
- package/dist/v8/types.d.ts +47 -7
- package/dist/v8/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/skills/deco-make-editable/SKILL.md +1 -1
- package/skills/deco-make-editable/references/content-shapes.md +14 -9
- package/skills/deco-nextjs-site/references/rendering.md +6 -5
- package/skills/deco-site-authoring/references/pages.md +6 -4
- package/skills/deco-site-workflow/SKILL.md +12 -3
- package/skills/deco-site-workflow/references/cli-reference.md +2 -0
- package/skills/deco-v7-to-v8-migration/SKILL.md +2 -1
- package/skills/deco-v7-to-v8-migration/references/hosted-releases.md +1 -1
- package/skills/deco-v7-to-v8-migration/references/nextjs.md +2 -2
- package/skills/deco-v7-to-v8-migration/references/verify.md +3 -0
- package/skills/deco-v7-to-v8-migration/scripts/checkContentReads.ts +32 -0
- package/skills/deco-v7-to-v8-migration/scripts/contentReads.ts +157 -0
- package/skills/deco-v7-to-v8-migration/scripts/imports.ts +1 -1
- package/skills/deco-v7-to-v8-migration/scripts/migrate.ts +4 -0
- package/src/index.ts +1 -1
- package/src/protocol/conformance/blockMetaVectors.json +80 -0
- package/src/protocol/index.ts +8 -1
- package/src/v8/blockMeta.ts +75 -11
- package/src/v8/client.ts +32 -77
- package/src/v8/cms.ts +1 -2
- package/src/v8/contentIndex.ts +49 -19
- package/src/v8/draftChanges.ts +5 -1
- package/src/v8/index.ts +1 -1
- package/src/v8/remoteLoader.ts +13 -3
- package/src/v8/types.ts +48 -7
package/dist/v8/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/v8/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAM7D;;;;GAIG;AACH,MAAM,MAAM,KAAK,GAAG;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC;AAExE,mCAAmC;AACnC,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAExE,oEAAoE;AACpE,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,C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,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACxC;;;;OAIG;IACH,QAAQ,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACvC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACjG,sFAAsF;IACtF,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC3D;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC3D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: deco-make-editable
|
|
3
|
-
description: "@decocms/blocks 8: turn a hardcoded site, or a Figma design, into blocks that people edit in deco Studio, without changing how the site looks. Covers the inventory of content vs interface, the three content shapes (global blocks read by name, composed pages of type page, collections read with client.
|
|
3
|
+
description: "@decocms/blocks 8: turn a hardcoded site, or a Figma design, into blocks that people edit in deco Studio, without changing how the site looks. Covers the inventory of content vs interface, the three content shapes (global blocks read by name, composed pages of type page, collections read with client.entries), the foo/fooPt bilingual field convention, seeding .deco/blocks from the existing code and sending it with deco push --draft and deco check --draft, implementing sections from a Figma file with the Figma MCP tools, pixel-parity checks with Playwright, accessibility and functional checks, and working in small PRs. Load it when asked to make a site, page, menu, footer or landing editable in Studio, to move hardcoded text into the CMS, to handle two languages in CMS content, or to build a Figma design as editable sections on a v8 site."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Make a site editable in Studio
|
|
@@ -7,7 +7,7 @@ shapes. Pick the shape first; the code follows from it.
|
|
|
7
7
|
|---|---|---|---|
|
|
8
8
|
| **Global block** | Things on every page: header menu, footer, a top banner | One saved block with a fixed name, e.g. `.deco/blocks/Header%20menu.json` | `client.resolve("Header menu")` in a loader shared by every page |
|
|
9
9
|
| **Composed page** | Pages editors rearrange: home, landings | A saved block of type `page` with `name`, `path`, `seo` and `sections` | `client.routes()` + `matchRoute`, then `client.resolve(name)` |
|
|
10
|
-
| **Collection** | Many documents of one kind: articles, FAQ entries, store addresses | One saved block per document, all of one type | `client.
|
|
10
|
+
| **Collection** | Many documents of one kind: articles, FAQ entries, store addresses | One saved block per document, all of one type | `client.entries(type)` for names and paths (index only), then `client.resolve(name)` per document shown |
|
|
11
11
|
|
|
12
12
|
A saved block's file name is `encodeURIComponent(name) + ".json"`, so the
|
|
13
13
|
block named `Header menu` lives in `Header%20menu.json`. Subfolders of
|
|
@@ -182,17 +182,22 @@ post its own URL, list the posts and match them together with the pages, as
|
|
|
182
182
|
`examples/nextjs-binding-smoke/src/open-page.server.ts` does:
|
|
183
183
|
`matchRoute(href, { routes: [...routes, ...posts] })`.
|
|
184
184
|
|
|
185
|
-
List them with `client.
|
|
185
|
+
List them with `client.entries`, which reads only the content index (names,
|
|
186
|
+
types, paths, references, `noIndex`), and resolve the documents you show:
|
|
186
187
|
|
|
187
188
|
```ts
|
|
188
|
-
const [
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
})
|
|
189
|
+
const [entries, error] = await client.entries("post");
|
|
190
|
+
if (error) throw error;
|
|
191
|
+
const posts = await Promise.all(
|
|
192
|
+
entries.slice(0, 20).map(async ({ name }) => (await client.resolve<Post>(name))[0]),
|
|
193
|
+
);
|
|
192
194
|
```
|
|
193
195
|
|
|
194
|
-
`
|
|
195
|
-
|
|
196
|
-
|
|
196
|
+
`entries` is sorted by block name and costs no block fetch however many
|
|
197
|
+
documents there are; each `resolve(name)` reads one body. Sort by a field of
|
|
198
|
+
the body (a date) only over the documents you resolved, or put the sort key in
|
|
199
|
+
the name. For pages, route with `client.routes()` and `client.redirects()`.
|
|
200
|
+
There is no working `client.list()`: it was removed (it fetched every block of
|
|
201
|
+
the type) and throws, naming these replacements.
|
|
197
202
|
|
|
198
203
|
See `examples/nextjs-binding-smoke/src/app/blog/page.tsx` for a list page.
|
|
@@ -60,8 +60,8 @@ Why each step is there:
|
|
|
60
60
|
- **`cache()`** from React: `generateMetadata` and the page call `openPage`
|
|
61
61
|
with the same arguments in one request; they share one result.
|
|
62
62
|
- **`routes()`** reads `{ name, path }` of every page from the content index,
|
|
63
|
-
without page bodies.
|
|
64
|
-
|
|
63
|
+
without page bodies. `client.list()` was removed and throws: route with
|
|
64
|
+
`routes()` and `redirects()`, and read other types with `entries(type)`.
|
|
65
65
|
- **`matchRoute(pathname, { routes, redirects })`** returns
|
|
66
66
|
`{ kind: "match", entry, params }`, `{ kind: "redirect", location, status }`
|
|
67
67
|
or `{ kind: "not-found" }`. Exact segments win over `:params`, params over a
|
|
@@ -74,12 +74,13 @@ Why each step is there:
|
|
|
74
74
|
resolved, so `sections` holds what each block function returned.
|
|
75
75
|
|
|
76
76
|
The example app also routes a custom block type (blog posts that carry a
|
|
77
|
-
`path`): it adds `(await c.
|
|
78
|
-
|
|
77
|
+
`path`): it adds the `{ name, path }` of `(await c.entries("post"))` to the
|
|
78
|
+
routes it matches (from the index, no post body read) and reads the one post
|
|
79
|
+
that matched.
|
|
79
80
|
|
|
80
81
|
## Results and errors
|
|
81
82
|
|
|
82
|
-
`resolve`, `
|
|
83
|
+
`resolve`, `entries`, `routes` and `redirects` return a tuple instead of
|
|
83
84
|
throwing: `[value, null]` or `[null, CMSError]`. (`revision()` is the
|
|
84
85
|
exception: it rejects when content can't load.) `CMSError` has `code`, `message`, `path` (where in the
|
|
85
86
|
tree, such as `["sections", 2, "product"]`) and, for function failures,
|
|
@@ -138,12 +138,14 @@ changes one section. See the `deco-variants` skill.
|
|
|
138
138
|
route it next to pages:
|
|
139
139
|
|
|
140
140
|
```ts
|
|
141
|
-
const [posts] = await c.
|
|
142
|
-
const
|
|
141
|
+
const [posts] = await c.entries("post");
|
|
142
|
+
const postRoutes = posts.flatMap(({ name, path }) => (path ? [{ name, path }] : []));
|
|
143
|
+
const match = matchRoute(pathname, { routes: [...routes, ...postRoutes] });
|
|
143
144
|
```
|
|
144
145
|
|
|
145
|
-
`client.
|
|
146
|
-
|
|
146
|
+
`client.entries(type)` reads only the content index (`{ name, type, path?, refs,
|
|
147
|
+
noIndex? }`, no body fetched); resolve the post that matched with
|
|
148
|
+
`client.resolve(match.entry.name)`. `client.list()` was removed and throws.
|
|
147
149
|
|
|
148
150
|
## Checklist for a new page
|
|
149
151
|
|
|
@@ -67,9 +67,18 @@ takes `--json`.
|
|
|
67
67
|
|
|
68
68
|
## Get these skills into a site
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
From 8.11.0, `@decocms/blocks` ships the skills of `.agents/skills/` and the CLI copies them into the
|
|
71
|
+
site, offline:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npx deco skills install # into .claude/skills/<skill>/
|
|
75
|
+
npx deco skills install --dir=.agents/skills # elsewhere; relative to the folder that contains .deco/
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
It finds `.deco/` like every command (walk up, or `--root`; none found exits 1) and takes `--json`
|
|
79
|
+
(`{ ok, dir, version, skills }`). Each shipped skill's folder is deleted and copied again, so files
|
|
80
|
+
from an older version go away; folders of skills it doesn't ship are left alone. Run it again after
|
|
81
|
+
upgrading `@decocms/blocks`. On 8.10 or older, copy the folders from `.agents/skills/` on `main`.
|
|
73
82
|
|
|
74
83
|
## Related skills
|
|
75
84
|
|
|
@@ -19,6 +19,7 @@ The same commands are importable from `@decocms/blocks/cli` (`runCli`, `schema`,
|
|
|
19
19
|
| `deco content` | `--watch` | `.deco/blocks` into `.deco/blocks.gen.ts`, for content without a site |
|
|
20
20
|
| `deco schema` | `--watch` \| `--check` | `.deco/index.ts` into `.deco/schema.gen.json` |
|
|
21
21
|
| `deco schema push` | | Uploads `.deco/schema.gen.json` to Studio |
|
|
22
|
+
| `deco skills install` | `--dir=<path>` | 8.11.0+. Copies the agent skills this `@decocms/blocks` ships into `.claude/skills/<skill>/` (or `--dir`, relative to the folder that contains `.deco/`). Replaces each shipped skill's folder whole, leaves other folders alone, no network. No `.deco/`: exit 1 |
|
|
22
23
|
| `deco help`, `--help`, `-h` | | Usage (exit 0). No command at all prints usage and exits 64 |
|
|
23
24
|
|
|
24
25
|
Details: [content-sync.md](./content-sync.md) (pull, diff, push, drafts, publish, releases),
|
|
@@ -88,6 +89,7 @@ Per command, the result carries:
|
|
|
88
89
|
| `releases` | `live`, `revisions: [{ id, status, meta }]` (`status`: `current`, `listed`, `unreadable`), `nextCursor` |
|
|
89
90
|
| `check` | `blocks`, `errors`, `warnings`, `problems` |
|
|
90
91
|
| `schema push` | `etag`, `blocksMajor` |
|
|
92
|
+
| `skills install` | `dir` (absolute), `version`, `skills` (names, sorted) |
|
|
91
93
|
| `login` | `command` |
|
|
92
94
|
|
|
93
95
|
## Common errors before any command runs
|
|
@@ -69,6 +69,7 @@ The full text of each step: [`references/manual-steps.md`](./references/manual-s
|
|
|
69
69
|
```bash
|
|
70
70
|
bunx deco schema && bunx deco content && bunx deco check # 0 errors
|
|
71
71
|
bun run typecheck && bun run build
|
|
72
|
+
bun <skill>/scripts/checkContentReads.ts --root . # no client.list()
|
|
72
73
|
```
|
|
73
74
|
|
|
74
75
|
Then the rest of [`references/verify.md`](./references/verify.md): the committed schema, type errors counted against v7, drafts probed by hand, and a page-by-page parity run with every approved difference encoded as a rule ([`references/parity.md`](./references/parity.md)).
|
|
@@ -106,7 +107,7 @@ What the site migrations taught, one subject per file. Commit hashes refer to `d
|
|
|
106
107
|
| [`site-code.md`](./references/site-code.md) | What stays site code: SEO, devices, cookies, commerce code, error reporting, A/B splits |
|
|
107
108
|
| [`server-functions.md`](./references/server-functions.md) | `/deco/invoke` → server functions |
|
|
108
109
|
| [`caching-and-privacy.md`](./references/caching-and-privacy.md) | Per-visitor data, QueryClient scope, draft bypass, hydration waits |
|
|
109
|
-
| [`nextjs.md`](./references/nextjs.md) | Next.js App Router: `@decocms/nextjs` drafts and proxy, `
|
|
110
|
+
| [`nextjs.md`](./references/nextjs.md) | Next.js App Router: `@decocms/nextjs` drafts and proxy, `entries('page')`, head order, Jest |
|
|
110
111
|
| [`hosted-releases.md`](./references/hosted-releases.md) | Hosted CMS instead of fast deploy, bundled content, v7 leftovers to delete |
|
|
111
112
|
| [`content.md`](./references/content.md) | `deco check` as a deploy gate, content it rejects, editing the bundled content, moving it to Studio's hosted CMS |
|
|
112
113
|
| [`telemetry.md`](./references/telemetry.md) | Telemetry params, resource attributes, dropped v7 bindings, analytics |
|
|
@@ -6,7 +6,7 @@ From the site migrations; the sites and what the commit hashes refer to are list
|
|
|
6
6
|
|
|
7
7
|
**v7 fast deploy becomes the hosted CMS.** A v7 TanStack site that published content without a deploy (`DECO_FAST_DEPLOY` plus a `DECO_KV` namespace) needs `site` on `createCMS` for the same feature (and `token` for hosted telemetry): the site reads its own `DECO_SITE` var and `DECO_SITE_TOKEN` secret and passes them, since the SDK reads no environment variable; without `site` every content change needs a deploy. Put the two `wrangler secret put` commands in the deploy checklist. v8 keeps content out of the bundle too: with `site`, it is fetched at runtime only. On a site with ~300 saved blocks (11 MB of JSON), Node measured about 13 MB per parsed copy, plus a transient string up to twice the JSON while a snapshot parses: under the Workers 128 MB limit, but measure memory and cold start with `wrangler tail` on a preview before turning it on.
|
|
8
8
|
|
|
9
|
-
With `site` set on `createCMS`, a published release goes live without a deploy, but only for what reads through the CMS client. Before turning it on, grep for direct imports of `.deco/blocks/*.json` (redirects, proxy tables, config blocks) and for build-time scripts that read `.deco/blocks`: those stay on the last deploy. v7 behaved the same, so it isn't a parity break; route them through the client or document the limitation and keep hosted releases off until you do.
|
|
9
|
+
With `site` set on `createCMS`, a published release goes live without a deploy, but only for what reads through the CMS client. Before turning it on, grep for direct imports of `.deco/blocks/*.json` (redirects, proxy tables, config blocks) and for build-time scripts that read `.deco/blocks`: those stay on the last deploy. v7 behaved the same, so it isn't a parity break; route them through the client or document the limitation and keep hosted releases off until you do. Through the client means the index for anything that enumerates (`client.entries(type)`: paths and `noIndex` for a sitemap, a block per path for a path-keyed map) and `resolve(name)` for one block: `client.list()` was removed and throws, and `scripts/checkContentReads.ts` lists the scans left.
|
|
10
10
|
|
|
11
11
|
## v7 leftovers to delete
|
|
12
12
|
|
|
@@ -13,7 +13,7 @@ From the site migrations; the sites and what the commit hashes refer to are list
|
|
|
13
13
|
- **Images**: `createDecoImageLoader(imageUrl, { fallback: nextImageOptimizer })` from `@decocms/nextjs/image-loader` as `images.loaderFile`, over `createImageUrl` from `@decocms/blocks/image` with the platform's helpers first (`@decocms/apps-vtex/image`; see `framework-code.md`). A Server Component can't pass the URL function to a client component, so use the loader file, not a wrapper component.
|
|
14
14
|
- **A pointer that doesn't parse.** `cms.draftPointer` ignores a `?__draft=`/cookie value that doesn't parse (it returns `null`, so `?__draft=junk` gets the release). On a `@decocms/blocks` release without that fix it returned the raw value and `cms.forDraft` failed with `LOADER_FAILED`, so `?__draft=junk` on a preview host answered 500: there, treat `parseDraftPointer(pointer) === null` as no draft, in the proxy and the page.
|
|
15
15
|
- **Views wrapped in `next/dynamic`.** The script types each section from its view (`PropsOf<view>`). A lazy view that re-exports a `next/dynamic` wrapper loses its props type, and its form collapses. Type those sections from the component module (`section<import("…").Props>(…)`) and diff the forms against v7's.
|
|
16
|
-
-
|
|
17
|
-
- **
|
|
16
|
+
- **Sitemaps read the index.** `client.entries('page')` gives every page's `name`, `path` and `noIndex` without reading a body (`client.list()` was removed and throws; on a hosted release it fetched one block per page, 730 requests on umbro). A sitemap is those paths minus templates (a `:param` segment or a `*`) minus `noIndex`. `entries()` sorts by block name; v7 listed saved pages in file order, so output that lists pages in order has to keep v7's order explicitly. `noIndex` is absent on a release last published before Studio wrote it (the next publish adds it): treat that as `false`, as v7 rendered such a page.
|
|
17
|
+
- **Route from the index.** `routes()` and `entries()` return the same array for the same revision (a draft has its own), so hand it to `matchRoute` as is and it reuses its lookup. Health and readiness probes read it too, never a body.
|
|
18
18
|
- **Head meta order.** If v7 emitted `theme-color`/`color-scheme` after the root layout's metas on some routes, that was a race with Next's viewport resolution. To keep the order deterministic, render those tags from the segment layout (React hoists in tree order) rather than approving a reorder. The race can go the other way: where v7 had the viewport tags *before* the root layout's metas and v8's faster shell now wins, a segment layout can't move them earlier. Look for a deterministic fix (the tags rendered ahead of the root layout's metas on every route, checked against every route's head), and keep the reorder pending, with that reasoning, if none holds.
|
|
19
19
|
- **Jest** is CJS-only: transform `@decocms/blocks` (ESM) with ts-jest and keep it out of `transformIgnorePatterns`. When mocking a site module in a test, spread `jest.requireActual` so sibling exports other code imports stay real.
|
|
@@ -5,8 +5,11 @@ The full checklist behind `SKILL.md` ("Verify").
|
|
|
5
5
|
```bash
|
|
6
6
|
bunx deco schema && bunx deco content && bunx deco check # 0 errors
|
|
7
7
|
bun run typecheck && bun run build
|
|
8
|
+
bun <skill>/scripts/checkContentReads.ts --root . # 0 client.list() calls
|
|
8
9
|
```
|
|
9
10
|
|
|
11
|
+
`checkContentReads.ts` exits 1 while the site's code calls `client.list(…)` (removed in 8.12: it throws at runtime, while the typecheck still passes, since `Client` keeps a deprecated `list` signature; a wrapper that calls it is found only by grepping for `.list(`) and prints every `.deco/blocks` scan. Replace each with `client.routes()` and `client.redirects()` for routing, `client.entries(type)` (names, types, paths, references and `noIndex`, from the index, no body fetched) or one `client.resolve(name)`. A big map keyed by path (SEO texts, highlights per category) becomes one saved block per path: the page reads its own block, found through `entries()`, never the whole map.
|
|
12
|
+
|
|
10
13
|
The committed `.deco/schema.gen.json` must carry the top-level `"blocksMajor": 8` that `deco schema` writes: Studio treats a site as v8 **only** when its schema has `blocksMajor === 8` (the file name doesn't count; anything else edits as v7), and `deco check` fails without it. A schema generated by a CLI that predates the field must be regenerated with one that writes it, then committed.
|
|
11
14
|
|
|
12
15
|
A v7 site often carries type errors of its own. Count them on the v7 commit first, and report the v8 count against it per file: name every remaining error in a file the migration touched instead of claiming there are none. Fix them with type-only changes, and rerun `deco schema` + `deco check` after each: a section's `Props` type *is* its editor form, so repairing a broken type import there (one that resolved to `any`) changes the schema and can make `deco check` reject saved content. Leave such an error, or fix the content with it, never silently. Don't fix an error by giving code that never ran (an undefined variable in a component) real values: that changes what renders.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `bun scripts/checkContentReads.ts [--root <dir>]`: fails (exit 1) when the
|
|
3
|
+
* site's code still calls `client.list(…)`, which 8.12 removed (it throws
|
|
4
|
+
* at runtime, and still typechecks, so only this check finds it); prints
|
|
5
|
+
* every `.deco/blocks` scan too, without failing on it (see
|
|
6
|
+
* ./contentReads.ts). Run it from the skill's verify step, after the
|
|
7
|
+
* migration and before review.
|
|
8
|
+
*/
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import { parseArgs } from "node:util";
|
|
11
|
+
import { findContentReads } from "./contentReads";
|
|
12
|
+
|
|
13
|
+
const { values } = parseArgs({
|
|
14
|
+
args: process.argv.slice(2),
|
|
15
|
+
options: { root: { type: "string", default: "." } },
|
|
16
|
+
});
|
|
17
|
+
const root = path.resolve(values.root!);
|
|
18
|
+
const reads = findContentReads(root);
|
|
19
|
+
for (const read of reads) {
|
|
20
|
+
const label =
|
|
21
|
+
read.kind === "list" ? "error: client.list() throws" : "warning: scans .deco/blocks";
|
|
22
|
+
console.log(`${read.file}:${read.line}: ${label}: ${read.code}`);
|
|
23
|
+
}
|
|
24
|
+
const lists = reads.filter((read) => read.kind === "list").length;
|
|
25
|
+
if (lists > 0) {
|
|
26
|
+
console.log(
|
|
27
|
+
`\n${lists} client.list() call(s): route with client.routes() and client.redirects(), read client.entries(type) (names, paths, noIndex from the index) or client.resolve(name) (one block) instead.`,
|
|
28
|
+
);
|
|
29
|
+
process.exitCode = 1;
|
|
30
|
+
} else {
|
|
31
|
+
console.log(reads.length === 0 ? "No content reads to change." : "No client.list() calls.");
|
|
32
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads of the whole content, which v8 sites don't do (8.12 on): a site reads
|
|
3
|
+
* the index (`client.routes()`, `client.redirects()`, `client.entries(type?)`:
|
|
4
|
+
* names, types, paths, references and `noIndex`, never a body) and one named
|
|
5
|
+
* block at a time (`client.resolve(name)`). Since 8.12 `client.list(type)`
|
|
6
|
+
* throws; on a hosted release it fetched every block of the type
|
|
7
|
+
* (one request per block), and a build-time scan of `.deco/blocks` reads
|
|
8
|
+
* content the site no longer bundles.
|
|
9
|
+
*
|
|
10
|
+
* - `list`: a `.list(…)` call on a CMS client (`c`, `cms`, `client`,
|
|
11
|
+
* `…Client`, `cms.forRelease()`, `cms.forDraft(…)`, `cms.client(…)`,
|
|
12
|
+
* `currentClient()`): an error. `scripts/checkContentReads.ts` fails on one. `Client`
|
|
13
|
+
* keeps a deprecated `list` so old code compiles, so the typecheck does
|
|
14
|
+
* not catch one (a wrapper calling it neither): it throws at runtime.
|
|
15
|
+
* - `scan`: a directory read or glob of `.deco/blocks` (`readdir`,
|
|
16
|
+
* `readdirSync`, `glob`, `import.meta.glob`, …; `.deco/blocks.gen` is the
|
|
17
|
+
* content module, not a scan): reported, since a native app may bundle the
|
|
18
|
+
* JSON on purpose (reference/native-apps.md).
|
|
19
|
+
*
|
|
20
|
+
* The fix for both: `entries(type)` for what the index knows (a sitemap is
|
|
21
|
+
* the `page` entries' paths without `:param` or `*` and without `noIndex`),
|
|
22
|
+
* or one `resolve(name)` for one block's body (a map keyed by path becomes
|
|
23
|
+
* one saved block per path, found through `entries()`).
|
|
24
|
+
*/
|
|
25
|
+
import fs from "node:fs";
|
|
26
|
+
import path from "node:path";
|
|
27
|
+
import ts from "typescript";
|
|
28
|
+
import { parse } from "./compat";
|
|
29
|
+
import type { Report } from "./report";
|
|
30
|
+
|
|
31
|
+
export interface ContentRead {
|
|
32
|
+
/** Relative to the root, with `/`. */
|
|
33
|
+
file: string;
|
|
34
|
+
/** 1-based. */
|
|
35
|
+
line: number;
|
|
36
|
+
kind: "list" | "scan";
|
|
37
|
+
/** The call, as written (first line). */
|
|
38
|
+
code: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Where a site keeps code: the folders scanned, under the root. */
|
|
42
|
+
const CODE_DIRS = ["src", "app", "server", "lib", "scripts"];
|
|
43
|
+
const SOURCE = /\.(tsx?|mts|cts|jsx?|mjs|cjs)$/;
|
|
44
|
+
const SKIPPED = new Set(["node_modules", "dist", "build", ".next", ".output", ".deco-migrate"]);
|
|
45
|
+
|
|
46
|
+
/** A receiver that is a CMS client by its name or by the call that made it. */
|
|
47
|
+
const CLIENT_RECEIVER =
|
|
48
|
+
/(?:^|[.\s(])(?:c|cms|client|[A-Za-z_$][\w$]*Client)$|\b(?:for(?:Release|Draft)|client|currentClient)\([^)]*\)$/;
|
|
49
|
+
/** A directory read or glob. */
|
|
50
|
+
const SCAN_CALL = /(?:^|\.)(?:readdir|readdirSync|opendir|opendirSync|glob|globSync|sync)$/;
|
|
51
|
+
/** `.deco/blocks`, the folder itself or a file in it (not `.deco/blocks.gen`). */
|
|
52
|
+
const BLOCKS_DIR = /\.deco\/blocks(?:$|\/|[^.\w])/;
|
|
53
|
+
|
|
54
|
+
function sourcesUnder(dir: string): string[] {
|
|
55
|
+
if (!fs.existsSync(dir)) return [];
|
|
56
|
+
const out: string[] = [];
|
|
57
|
+
for (const d of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
58
|
+
if (SKIPPED.has(d.name)) continue;
|
|
59
|
+
const full = path.join(dir, d.name);
|
|
60
|
+
if (d.isDirectory()) out.push(...sourcesUnder(full));
|
|
61
|
+
else if (d.isFile() && SOURCE.test(d.name) && !d.name.endsWith(".d.ts")) out.push(full);
|
|
62
|
+
}
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** The text of a string literal or a template (its literal parts). */
|
|
67
|
+
function literalText(node: ts.Node): string | undefined {
|
|
68
|
+
if (ts.isStringLiteralLike(node)) return node.text;
|
|
69
|
+
if (ts.isTemplateExpression(node)) {
|
|
70
|
+
return node.head.text + node.templateSpans.map((s) => s.literal.text).join("");
|
|
71
|
+
}
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Whether any argument (or a string inside it, as in `path.join(…)`) names `.deco/blocks`. */
|
|
76
|
+
function namesBlocksDir(args: readonly ts.Node[]): boolean {
|
|
77
|
+
let found = false;
|
|
78
|
+
const visit = (node: ts.Node): void => {
|
|
79
|
+
if (found) return;
|
|
80
|
+
const text = literalText(node);
|
|
81
|
+
if (text !== undefined && BLOCKS_DIR.test(text)) {
|
|
82
|
+
found = true;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
ts.forEachChild(node, visit);
|
|
86
|
+
};
|
|
87
|
+
for (const arg of args) visit(arg);
|
|
88
|
+
return found;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** The receiver as written, without parentheses, `await`, `!` or spaces: `(await client())` is `client()`. */
|
|
92
|
+
function receiverText(node: ts.Expression, source: ts.SourceFile): string {
|
|
93
|
+
let inner: ts.Expression = node;
|
|
94
|
+
while (
|
|
95
|
+
ts.isParenthesizedExpression(inner) ||
|
|
96
|
+
ts.isAwaitExpression(inner) ||
|
|
97
|
+
ts.isNonNullExpression(inner)
|
|
98
|
+
) {
|
|
99
|
+
inner = inner.expression;
|
|
100
|
+
}
|
|
101
|
+
return inner.getText(source).replace(/\s+/g, "");
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Every `list` call on a CMS client and every scan of `.deco/blocks` in the site's code. */
|
|
105
|
+
export function findContentReads(root: string): ContentRead[] {
|
|
106
|
+
const files = CODE_DIRS.flatMap((dir) => sourcesUnder(path.join(root, dir))).sort();
|
|
107
|
+
const found: ContentRead[] = [];
|
|
108
|
+
for (const file of files) {
|
|
109
|
+
const text = fs.readFileSync(file, "utf8");
|
|
110
|
+
if (!text.includes(".list") && !text.includes(".deco/blocks")) continue;
|
|
111
|
+
const source = parse(file, text);
|
|
112
|
+
const at = (node: ts.Node, kind: ContentRead["kind"]) => {
|
|
113
|
+
const { line } = source.getLineAndCharacterOfPosition(node.getStart(source));
|
|
114
|
+
found.push({
|
|
115
|
+
file: path.relative(root, file).split(path.sep).join("/"),
|
|
116
|
+
line: line + 1,
|
|
117
|
+
kind,
|
|
118
|
+
code: node.getText(source).split("\n")[0]!,
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
const visit = (node: ts.Node): void => {
|
|
122
|
+
if (ts.isCallExpression(node)) {
|
|
123
|
+
const callee = node.expression;
|
|
124
|
+
if (
|
|
125
|
+
ts.isPropertyAccessExpression(callee) &&
|
|
126
|
+
callee.name.text === "list" &&
|
|
127
|
+
CLIENT_RECEIVER.test(receiverText(callee.expression, source))
|
|
128
|
+
) {
|
|
129
|
+
at(node, "list");
|
|
130
|
+
} else if (SCAN_CALL.test(callee.getText(source)) && namesBlocksDir(node.arguments)) {
|
|
131
|
+
at(node, "scan");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
ts.forEachChild(node, visit);
|
|
135
|
+
};
|
|
136
|
+
visit(source);
|
|
137
|
+
}
|
|
138
|
+
return found;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const LIST_FIX =
|
|
142
|
+
"client.list() throws (removed in 8.12): route with client.routes() and client.redirects(); client.entries(type) gives names, paths and noIndex from the index (a sitemap: page paths without :param or * and without noIndex), and client.resolve(name) reads one block; a map keyed by path becomes one saved block per path";
|
|
143
|
+
const SCAN_FIX =
|
|
144
|
+
"reads every saved block at build time: content comes from the CMS now (hosted releases leave .deco/blocks behind), so read client.entries(type) for paths and noIndex, or resolve one named block; keep it only for a native app that bundles the JSON (reference/native-apps.md)";
|
|
145
|
+
|
|
146
|
+
/** The migration's report lines: one per `list` call and per scan, as work left. */
|
|
147
|
+
export function reportContentReads(root: string, report: Report): ContentRead[] {
|
|
148
|
+
const reads = findContentReads(root);
|
|
149
|
+
for (const read of reads) {
|
|
150
|
+
report.manual.push({
|
|
151
|
+
step: "imports",
|
|
152
|
+
subject: `${read.file}:${read.line}`,
|
|
153
|
+
message: `${read.code}: ${read.kind === "list" ? LIST_FIX : SCAN_FIX}`,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return reads;
|
|
157
|
+
}
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
* `createDecoWorkerEntry` configured (the script writes no worker entry);
|
|
27
27
|
* 6. imports: the codemod over `src/` (v7 helpers to `@decocms/compat-v7`,
|
|
28
28
|
* `ctx.device` from the loader's request, `src/imageUrl.ts` on TanStack);
|
|
29
|
+
* then every `client.list(…)` call and `.deco/blocks` scan reported
|
|
30
|
+
* (`client.entries()` or one `resolve(name)` instead; ./contentReads.ts);
|
|
29
31
|
* 7. scripts: `deco schema && deco content` before dev and build, and
|
|
30
32
|
* `deco schema --check` in the site's CI after the install step.
|
|
31
33
|
*
|
|
@@ -43,6 +45,7 @@ import { writeBlockMap } from "./blockMap";
|
|
|
43
45
|
import { addSchemaCheck } from "./ciSchemaCheck";
|
|
44
46
|
import { listSources, rewriteDeviceReads } from "./compat";
|
|
45
47
|
import { moveContent } from "./content";
|
|
48
|
+
import { reportContentReads } from "./contentReads";
|
|
46
49
|
import { reportTestsAndDates } from "./experiments";
|
|
47
50
|
import { siteFramework, V8_RANGE } from "./framework";
|
|
48
51
|
import { rewriteImports } from "./imports";
|
|
@@ -170,6 +173,7 @@ export async function migrate(options: MigrateOptions): Promise<Report> {
|
|
|
170
173
|
reportWorkerEntry(root, report);
|
|
171
174
|
}
|
|
172
175
|
rewriteImports(root, report, vendored);
|
|
176
|
+
reportContentReads(root, report);
|
|
173
177
|
addScripts(root, report);
|
|
174
178
|
addSchemaCheck(root, report);
|
|
175
179
|
return report;
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
"footer",
|
|
6
6
|
"footer-a",
|
|
7
7
|
"header",
|
|
8
|
+
"hidden-seo",
|
|
8
9
|
"home",
|
|
10
|
+
"noindex-inline",
|
|
11
|
+
"noindex-saved",
|
|
9
12
|
"plain",
|
|
10
13
|
"redirects",
|
|
11
14
|
"variants"
|
|
@@ -209,6 +212,83 @@
|
|
|
209
212
|
}
|
|
210
213
|
}
|
|
211
214
|
}
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"name": "hidden-seo",
|
|
218
|
+
"body": {
|
|
219
|
+
"__resolveType": "website/sections/Seo/SeoV2.tsx",
|
|
220
|
+
"title": "Staging",
|
|
221
|
+
"noIndexing": true
|
|
222
|
+
},
|
|
223
|
+
"version": "TweCqXol6NaqfznIdZHWGA",
|
|
224
|
+
"meta": {
|
|
225
|
+
"type": "website/sections/Seo/SeoV2.tsx"
|
|
226
|
+
},
|
|
227
|
+
"entry": {
|
|
228
|
+
"version": "TweCqXol6NaqfznIdZHWGA",
|
|
229
|
+
"meta": {
|
|
230
|
+
"type": "website/sections/Seo/SeoV2.tsx"
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"name": "noindex-inline",
|
|
236
|
+
"body": {
|
|
237
|
+
"__resolveType": "website/pages/Page.tsx",
|
|
238
|
+
"path": "/staging",
|
|
239
|
+
"seo": {
|
|
240
|
+
"__resolveType": "website/sections/Seo/SeoV2.tsx",
|
|
241
|
+
"noIndexing": true
|
|
242
|
+
},
|
|
243
|
+
"sections": [
|
|
244
|
+
{
|
|
245
|
+
"__resolveType": "header"
|
|
246
|
+
}
|
|
247
|
+
]
|
|
248
|
+
},
|
|
249
|
+
"version": "9dPY85a3_dAGqgn9HyBymg",
|
|
250
|
+
"meta": {
|
|
251
|
+
"type": "website/pages/Page.tsx",
|
|
252
|
+
"path": "/staging",
|
|
253
|
+
"refs": ["header"],
|
|
254
|
+
"noIndex": true
|
|
255
|
+
},
|
|
256
|
+
"entry": {
|
|
257
|
+
"version": "9dPY85a3_dAGqgn9HyBymg",
|
|
258
|
+
"meta": {
|
|
259
|
+
"type": "website/pages/Page.tsx",
|
|
260
|
+
"path": "/staging",
|
|
261
|
+
"refs": ["header"],
|
|
262
|
+
"noIndex": true
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"name": "noindex-saved",
|
|
268
|
+
"body": {
|
|
269
|
+
"__resolveType": "page",
|
|
270
|
+
"path": "/landing",
|
|
271
|
+
"seo": {
|
|
272
|
+
"__resolveType": "hidden-seo"
|
|
273
|
+
},
|
|
274
|
+
"sections": []
|
|
275
|
+
},
|
|
276
|
+
"version": "sOB07_jkmJqe7Mr5Raj6rg",
|
|
277
|
+
"meta": {
|
|
278
|
+
"type": "page",
|
|
279
|
+
"path": "/landing",
|
|
280
|
+
"refs": ["hidden-seo"],
|
|
281
|
+
"noIndex": true
|
|
282
|
+
},
|
|
283
|
+
"entry": {
|
|
284
|
+
"version": "sOB07_jkmJqe7Mr5Raj6rg",
|
|
285
|
+
"meta": {
|
|
286
|
+
"type": "page",
|
|
287
|
+
"path": "/landing",
|
|
288
|
+
"refs": ["hidden-seo"],
|
|
289
|
+
"noIndex": true
|
|
290
|
+
}
|
|
291
|
+
}
|
|
212
292
|
}
|
|
213
293
|
]
|
|
214
294
|
}
|
package/src/protocol/index.ts
CHANGED
|
@@ -19,7 +19,10 @@
|
|
|
19
19
|
* the page's bootstrap is `StudioChannel` in `@decocms/blocks/preview`.
|
|
20
20
|
*
|
|
21
21
|
* `blockMeta`/`indexEntry` compute a hosted revision index's entries (the
|
|
22
|
-
* SDK's own browser-safe module, shared with Studio and the CLI)
|
|
22
|
+
* SDK's own browser-safe module, shared with Studio and the CLI);
|
|
23
|
+
* `META_VERSION` is the `metaVersion` an index they computed carries, and
|
|
24
|
+
* `seoNoIndex`/`pageNoIndex` are the `noIndex` rule, a page's saved SEO block
|
|
25
|
+
* resolved through `bodyOf`.
|
|
23
26
|
*
|
|
24
27
|
* The SDK's runtime never imports the protocol, so it never reaches an app
|
|
25
28
|
* bundle. The canonical hash it re-exports is the SDK's own dependency-free
|
|
@@ -30,9 +33,13 @@
|
|
|
30
33
|
export {
|
|
31
34
|
type BlockIndex,
|
|
32
35
|
type BlockMeta,
|
|
36
|
+
type BodyOf,
|
|
33
37
|
blockMeta,
|
|
34
38
|
type IndexEntry,
|
|
35
39
|
indexEntry,
|
|
40
|
+
META_VERSION,
|
|
41
|
+
pageNoIndex,
|
|
42
|
+
seoNoIndex,
|
|
36
43
|
} from "../v8/blockMeta.ts";
|
|
37
44
|
export { isRevisionId, REVISION_ID_RE } from "../v8/revisionId.ts";
|
|
38
45
|
export {
|