@se-studio/contentful-cms 1.0.10 → 1.0.12
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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/commands/screenshot.js +7 -7
- package/package.json +1 -1
- package/skills/cms-guidelines/README.md +1 -1
- package/skills/core/SKILL.md +3 -3
- package/skills/screenshots/SKILL.md +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @se-studio/contentful-cms Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Bulk version bump: patch for all packages
|
|
8
|
+
|
|
9
|
+
## 1.0.11
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Bulk version bump: patch for all packages
|
|
14
|
+
|
|
3
15
|
## 1.0.10
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -251,7 +251,7 @@ Capture a PNG of a component, collection, external component, person, or page. *
|
|
|
251
251
|
|
|
252
252
|
| Target | Command |
|
|
253
253
|
|--------|---------|
|
|
254
|
-
| Session ref (full-fidelity) | `cms-edit screenshot @c0` — all types (component, collection, externalComponent, person) via convert API and `/cms
|
|
254
|
+
| Session ref (full-fidelity) | `cms-edit screenshot @c0` — all types (component, collection, externalComponent, person) via convert API and `/cms/preview/render-json` |
|
|
255
255
|
| JSON file (no Contentful) | `cms-edit screenshot --json-file path/to/entry.json` — IBase* JSON; validates or screenshots without a session |
|
|
256
256
|
| By type (mock, no session) | `cms-edit screenshot --component HeroSimple`, `cms-edit screenshot --collection CardGrid` |
|
|
257
257
|
| Page | `cms-edit screenshot` (current page) or `cms-edit screenshot /pricing` |
|
|
@@ -14,9 +14,9 @@ const DEFAULT_VIEWPORT_WIDTH = 1280;
|
|
|
14
14
|
const DEFAULT_VIEWPORT_HEIGHT = 900;
|
|
15
15
|
const DEFAULT_BASE_URL = 'http://localhost:3000';
|
|
16
16
|
function isComponentOrCollectionUrl(url) {
|
|
17
|
-
return (url.includes('/cms
|
|
18
|
-
url.includes('/cms
|
|
19
|
-
url.includes('/cms
|
|
17
|
+
return (url.includes('/cms/showcase/render') ||
|
|
18
|
+
url.includes('/cms/preview/render') ||
|
|
19
|
+
url.includes('/cms/preview/render-json'));
|
|
20
20
|
}
|
|
21
21
|
/** Collect repeatable --param key=value into an array. */
|
|
22
22
|
function collectParam(value, prev) {
|
|
@@ -50,7 +50,7 @@ export function registerScreenshotCommand(program) {
|
|
|
50
50
|
' --collection CardGrid')
|
|
51
51
|
.option('--component <type>', 'Showcase a component by type name (no session needed)')
|
|
52
52
|
.option('--collection <type>', 'Showcase a collection by type name (no session needed)')
|
|
53
|
-
.option('--live', 'Fetch real Contentful data via /cms
|
|
53
|
+
.option('--live', 'Fetch real Contentful data via /cms/preview/render?id=... (requires preview token)')
|
|
54
54
|
.option('--out <path>', 'Output file path (default: ./screenshot-<type>-<timestamp>.png)')
|
|
55
55
|
.option('--full', 'Capture the full scrollable page (passed to agent-browser)')
|
|
56
56
|
.option('--embedded', 'Append &embedded=true to showcase URL (suppresses IframeHeightReporter)')
|
|
@@ -81,7 +81,7 @@ export function registerScreenshotCommand(program) {
|
|
|
81
81
|
const raw = fs.readFileSync(opts.jsonFile, 'utf-8');
|
|
82
82
|
const data = JSON.parse(raw);
|
|
83
83
|
const encoded = Buffer.from(raw, 'utf-8').toString('base64');
|
|
84
|
-
url = appendRequestParams(`${baseUrl}/cms
|
|
84
|
+
url = appendRequestParams(`${baseUrl}/cms/preview/render-json?data=${encoded}`, requestParams);
|
|
85
85
|
displayType = data?.type ?? 'json';
|
|
86
86
|
}
|
|
87
87
|
else if (opts.component || opts.collection) {
|
|
@@ -111,7 +111,7 @@ export function registerScreenshotCommand(program) {
|
|
|
111
111
|
throw new Error('Convert API returned no data.');
|
|
112
112
|
}
|
|
113
113
|
const encoded = Buffer.from(JSON.stringify(data), 'utf-8').toString('base64');
|
|
114
|
-
url = appendRequestParams(`${baseUrl}/cms
|
|
114
|
+
url = appendRequestParams(`${baseUrl}/cms/preview/render-json?data=${encoded}`, requestParams);
|
|
115
115
|
displayType = data?.type ?? entryId;
|
|
116
116
|
}
|
|
117
117
|
else if (target?.startsWith('/') || target?.startsWith('http')) {
|
|
@@ -254,7 +254,7 @@ function buildShowcaseUrl(baseUrl, type, mode, fields, embedded, clean, requestP
|
|
|
254
254
|
params.set(key, value);
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
return `${baseUrl}/cms
|
|
257
|
+
return `${baseUrl}/cms/showcase/render?${params.toString()}`;
|
|
258
258
|
}
|
|
259
259
|
/** Appends requestParams as query parameters to an arbitrary URL. */
|
|
260
260
|
function appendRequestParams(url, requestParams) {
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ Guidelines are short markdown fragments — one per CMS type — that describe h
|
|
|
17
17
|
```bash
|
|
18
18
|
pnpm --filter <appName> generate-showcase
|
|
19
19
|
```
|
|
20
|
-
This writes `src/
|
|
20
|
+
This writes `src/generated/showcase-examples.json`.
|
|
21
21
|
3. **Curate showcase mocks** — run the [curate-showcase-mocks skill](.cursor/skills/se-marketing-sites/curate-showcase-mocks/SKILL.md) to select the best examples into `showcase-mocks.json`. This makes the showcase (and screenshots) show realistic content.
|
|
22
22
|
4. **Generate field list** — parse TypeScript types to produce structured field metadata:
|
|
23
23
|
```bash
|
package/skills/core/SKILL.md
CHANGED
|
@@ -422,7 +422,7 @@ If omitted, defaults to `http://localhost:3000` with a warning.
|
|
|
422
422
|
|
|
423
423
|
### From session ref (full-fidelity)
|
|
424
424
|
|
|
425
|
-
`cms-edit screenshot @c0` uses the app's convert API and `/cms
|
|
425
|
+
`cms-edit screenshot @c0` uses the app's convert API and `/cms/preview/render-json` so **all** entry types render with real converted data: component, collection, externalComponent, person. No separate "mock vs live" for refs.
|
|
426
426
|
|
|
427
427
|
```bash
|
|
428
428
|
# Any entry type (component, collection, externalComponent, person)
|
|
@@ -445,7 +445,7 @@ cms-edit screenshot --json-file path/to/component.json
|
|
|
445
445
|
|
|
446
446
|
### By type (showcase mock, no session)
|
|
447
447
|
|
|
448
|
-
Uses `/cms
|
|
448
|
+
Uses `/cms/showcase/render` with mock data. Fast, no preview token.
|
|
449
449
|
|
|
450
450
|
```bash
|
|
451
451
|
cms-edit screenshot --component HeroSimple
|
|
@@ -469,7 +469,7 @@ cms-edit screenshot /about-us --full
|
|
|
469
469
|
| Flag | Description |
|
|
470
470
|
|------|-------------|
|
|
471
471
|
| `--json-file <path>` | Read IBase* JSON from file and screenshot via render-json (no Contentful) |
|
|
472
|
-
| `--live` | Legacy: use `/cms
|
|
472
|
+
| `--live` | Legacy: use `/cms/preview/render?id=...` for ref (optional; @ref is already full-fidelity) |
|
|
473
473
|
| `--out <path>` | Output file path (default: `./screenshot-<type>-<timestamp>.png`) |
|
|
474
474
|
| `--full` | Full-page capture (passed to `agent-browser screenshot --full`) |
|
|
475
475
|
| `--embedded` | Append `&embedded=true` to showcase URL (suppresses IframeHeightReporter) |
|
|
@@ -10,9 +10,9 @@ Use this skill when capturing **screenshots** of components, collections, pages,
|
|
|
10
10
|
|
|
11
11
|
## Commands
|
|
12
12
|
|
|
13
|
-
- **From session ref** (full-fidelity): `cms-edit screenshot @c0` — uses the convert API and `/cms
|
|
14
|
-
- **From JSON file** (no Contentful): `cms-edit screenshot --json-file path/to/entry.json` — reads an IBase* JSON (e.g. from `read @c0 --json` or an export), base64-encodes it, and opens `/cms
|
|
15
|
-
- **By type** (no session, mock): `cms-edit screenshot --component HeroSimple`, `cms-edit screenshot --collection CardGrid` — uses `/cms
|
|
13
|
+
- **From session ref** (full-fidelity): `cms-edit screenshot @c0` — uses the convert API and `/cms/preview/render-json` so **all** entry types render with real data: component, collection, externalComponent, person. Add `--full` for full-page capture (auto-applied for component/collection).
|
|
14
|
+
- **From JSON file** (no Contentful): `cms-edit screenshot --json-file path/to/entry.json` — reads an IBase* JSON (e.g. from `read @c0 --json` or an export), base64-encodes it, and opens `/cms/preview/render-json?data=...`. Use to validate or screenshot without a session or preview token.
|
|
15
|
+
- **By type** (no session, mock): `cms-edit screenshot --component HeroSimple`, `cms-edit screenshot --collection CardGrid` — uses `/cms/showcase/render` with mock data.
|
|
16
16
|
- **Page**: `cms-edit screenshot` (current open page) or `cms-edit screenshot /resources/publications/other/my-slug`
|
|
17
17
|
- **URL only** (no agent-browser needed): `cms-edit screenshot @c0 --url-only`
|
|
18
18
|
|
|
@@ -29,8 +29,8 @@ Check the site's URL structure (e.g. `/resources/publications/<type>/<slug>`) an
|
|
|
29
29
|
|
|
30
30
|
When using `--component <type>` or `--collection <type>` (no session), the default is **mock** (showcase). Use `--live` with a ref to prefer the legacy direct preview URL; for `@ref`, full-fidelity is already the default via convert → render-json.
|
|
31
31
|
|
|
32
|
-
- **Mock:** `/cms
|
|
33
|
-
- **Live** (with ref): `cms-edit screenshot @c0 --live` — uses `/cms
|
|
32
|
+
- **Mock:** `/cms/showcase/render` with mock data; fast, no preview token.
|
|
33
|
+
- **Live** (with ref): `cms-edit screenshot @c0 --live` — uses `/cms/preview/render?id=...`; equivalent for component/collection/externalComponent to the default @ref path.
|
|
34
34
|
|
|
35
35
|
## Checking your work
|
|
36
36
|
|