@sleekcms/sync 1.4.0 → 1.4.2
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/AGENT.md +22 -1
- package/dist/watcher.js +1 -1
- package/package.json +1 -1
package/dist/AGENT.md
CHANGED
|
@@ -57,6 +57,7 @@ Examples:
|
|
|
57
57
|
/content/entries/<key+>.json Content for a collection entry (array of objects; <key>+ matches the model filename)
|
|
58
58
|
|
|
59
59
|
/content/images.json Site-level reusable images (handle → shortcut)
|
|
60
|
+
/content/videos.json Site-level videos (handle → embed_url) — READ-ONLY, populated by UI uploads
|
|
60
61
|
```
|
|
61
62
|
|
|
62
63
|
> **Tailwind**: Creating `/css/tailwind.css` enables Tailwind. It is compiled and injected automatically — do NOT add it via `link()`.
|
|
@@ -268,7 +269,7 @@ Model fields declare both the editor type and the shape expected in content JSON
|
|
|
268
269
|
| `datetime` | ISO 8601 string |
|
|
269
270
|
| `time` | `"HH:mm"` string |
|
|
270
271
|
| `image` | Either a resolved `{ "url": "...", "alt": "..." }` object, **or** a shortcut string `"<source>:<search>"` (e.g., `"pexels:doctor"`, `"url:https://picsum.photos/200.jpg"`, `"cms:logo"`). Supported sources: `unsplash`, `pexels`, `pixabay`, `iconify`, `url`, `cms` (reuses an image declared in `/images.json` by handle). Append `\|<alt text>` to set the image's alt, e.g. `"pexels:doctor\|Smiling doctor with stethoscope"`. On save, the sync engine resolves the shortcut/link to a full image object automatically. |
|
|
271
|
-
| `video` | Object of shape `{ "source": "BUNNY", "video_id": "...", "embed_url": "...", "title": "..." }`. **Do not write or invent this value.** Video uploads are user-driven in the CMS UI — the user uploads to Bunny.net and the sync engine stores the resolved object. In templates, always render videos with the `embed()` helper (e.g. `<%- embed(item.intro_video, { size: '1280x720' }) %>`), never by hand-rolling an iframe. |
|
|
272
|
+
| `video` | Object of shape `{ "source": "BUNNY", "video_id": "...", "embed_url": "...", "title": "..." }`. **Do not write or invent this value.** Video uploads are user-driven in the CMS UI — the user uploads to Bunny.net and the sync engine stores the resolved object. In templates, always render videos with the `embed()` helper (e.g. `<%- embed(item.intro_video, { size: '1280x720' }) %>`), never by hand-rolling an iframe. The site's available video handles are exposed read-only at `/content/videos.json` (`handle → embed_url`) — look them up in templates with `getVideo('<handle>')`. |
|
|
272
273
|
| `file` | Object of shape `{ "name": "...", "url": "...", "size": 0, "type": "...", "ext": "..." }` describing a downloadable document (PDF, CSV, DOC/DOCX, XLS/XLSX, PPT/PPTX, TSV, TXT — max 10 MB). **Do not write or invent this value.** File uploads are user-driven in the CMS UI — the user attaches the file via the editor and the sync engine stores the resolved object. In templates, render a link with `item.file.url` (download URL on `files.sleekcms.com`) and `item.file.name` (display name), e.g. `<a href="<%= item.brochure.url %>" download><%= item.brochure.name %></a>`. |
|
|
273
274
|
| `json` | Object or array |
|
|
274
275
|
| `sheet` | Array of arrays |
|
|
@@ -404,6 +405,23 @@ For images used in more than one place (logos, recurring icons, hero art), decla
|
|
|
404
405
|
|
|
405
406
|
Then reference any of them from any content `image` field with `"cms:<handle>"` (e.g., `"cms:logo"`). The sync engine resolves it to the full image object on save. Templates can also fetch the resolved object directly via `getImage('<handle>')`.
|
|
406
407
|
|
|
408
|
+
### Site videos (`/videos.json`) — READ-ONLY
|
|
409
|
+
|
|
410
|
+
`/content/videos.json` is a flat map of `handle → embed_url` describing every video the user has uploaded to this site via the CMS UI (Bunny.net):
|
|
411
|
+
|
|
412
|
+
```json
|
|
413
|
+
{
|
|
414
|
+
"intro": "https://iframe.mediadelivery.net/embed/<lib>/<guid>",
|
|
415
|
+
"testimonial-jane": "https://iframe.mediadelivery.net/embed/<lib>/<guid>"
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
**Do not edit `/content/videos.json`.** It is regenerated from the user's uploads — local edits will not sync and will be overwritten on the next pull. Use it only to discover which video handles are available, then fetch the resolved video object inside templates with `getVideo('<handle>')` and render it via `embed()`:
|
|
420
|
+
|
|
421
|
+
```ejs
|
|
422
|
+
<%- embed(getVideo('intro'), { size: '1280x720' }) %>
|
|
423
|
+
```
|
|
424
|
+
|
|
407
425
|
---
|
|
408
426
|
|
|
409
427
|
## EJS Templates
|
|
@@ -444,6 +462,7 @@ Page records include: `item._path`, `item._slug` (collections), `item._meta.upda
|
|
|
444
462
|
| `getEntry(handle)` | Object \| Array | Entry by handle. Single → object, collection → array |
|
|
445
463
|
| `getSlugs(path)` | string[] | Slugs under a collection path |
|
|
446
464
|
| `getImage(name)` | Object \| undefined | Site-level image by handle |
|
|
465
|
+
| `getVideo(name)` | Object \| undefined | Site-level video by handle (handles listed in `/content/videos.json`, read-only) |
|
|
447
466
|
| `getOptions(name)` | Array \| undefined | Option set as `[{ label, value }]` |
|
|
448
467
|
| `getContent(query?)` | Any | Full content payload, or filter with JMESPath |
|
|
449
468
|
| `path(page)` | String | URL path of a page object |
|
|
@@ -710,3 +729,5 @@ Template:
|
|
|
710
729
|
16. **Collection pages whose model qualifies as "markdown content" — page model, collection (key ends with `+`), exactly one top-level `markdown` field, no `richtext` or `stack` anywhere — are stored as `.md` files with JSON frontmatter at `content/pages/<key+>/<slug>.md` (not `.json`).** All non-markdown fields go into the JSON frontmatter object between the `---` markers; the single `markdown` field's value is the body. When creating or editing such a record, prefer `.md`; the server also accepts `.json` for the same model. Inside the `.md` file, frontmatter may be written as JSON (canonical), JSON5 (trailing commas, `//` or `/* */` comments, unquoted keys), or YAML — all three are parsed correctly on save. Pulls always re-emit JSON as the canonical form.
|
|
711
730
|
17. Always create RSS feed for blogs and link them in meta so it is discoverable. Use "rss.xml" as the key.
|
|
712
731
|
18. Make the sites extremely SEO friendly and sharing friendly.
|
|
732
|
+
19. When naming files for models, use - (dash) as word separator. Don't use _ (underscore) as it is mapped to / (slash) in path
|
|
733
|
+
|
package/dist/watcher.js
CHANGED
|
@@ -18,7 +18,7 @@ exports.stopWatching = stopWatching;
|
|
|
18
18
|
const path_1 = __importDefault(require("path"));
|
|
19
19
|
const chokidar_1 = __importDefault(require("chokidar"));
|
|
20
20
|
const DEBOUNCE_DELAY = 5000;
|
|
21
|
-
const IDLE_TIMEOUT_MS =
|
|
21
|
+
const IDLE_TIMEOUT_MS = 60 * 60 * 1000;
|
|
22
22
|
// Poll on a short interval and compare wall-clock time so the timeout still
|
|
23
23
|
// fires correctly after the system has been asleep (Node's setTimeout runs on
|
|
24
24
|
// a monotonic clock that pauses during sleep).
|