@407dev/cli 0.1.0 → 0.1.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@407dev/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"tsup": "^8.4.0",
|
|
41
41
|
"typescript": "^5.7.3",
|
|
42
42
|
"vitest": "3.0.7",
|
|
43
|
-
"@407dev/
|
|
44
|
-
"@407dev/
|
|
43
|
+
"@407dev/api-client": "0.0.1",
|
|
44
|
+
"@407dev/config": "0.0.1"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "tsup",
|
|
@@ -92,11 +92,17 @@ export const blog = defineCollection({
|
|
|
92
92
|
Listing page:
|
|
93
93
|
```astro
|
|
94
94
|
---
|
|
95
|
-
import { getEntries } from '@407dev/cms-astro';
|
|
95
|
+
import { f, getEntries } from '@407dev/cms-astro';
|
|
96
96
|
import { blog } from '../../cms/collections';
|
|
97
97
|
const posts = getEntries(blog); // published only in production; includes drafts/scheduled in preview
|
|
98
98
|
---
|
|
99
|
-
{
|
|
99
|
+
<ul {...f.collectionAttrs(blog)}>
|
|
100
|
+
{posts.map((p) => (
|
|
101
|
+
<li {...f.entryScope(blog, p.slug).attrs()}>
|
|
102
|
+
<a href={`/blog/${p.slug}`}>{p.content.title}</a>
|
|
103
|
+
</li>
|
|
104
|
+
))}
|
|
105
|
+
</ul>
|
|
100
106
|
```
|
|
101
107
|
Detail page (`src/pages/blog/[slug].astro`):
|
|
102
108
|
```astro
|
|
@@ -63,6 +63,10 @@ const alt = typeof image === 'object' && image ? (image.alt ?? '') : '';
|
|
|
63
63
|
- **Seed-once semantics:** `cms push` inserts seed entries once only when the collection has never been seeded (`collections.seeded_at IS NULL`) and has zero entries. Once seeded, `seeded_at` is recorded and the dashboard owns all content. Seeds are never re-applied, even if an editor deletes every item, and seeds are never a render-time fallback.
|
|
64
64
|
- **Seeding is not publishing:** seeded entries land as `published` in the draft tables, but the live site only ever serves the last published `site_versions` snapshot. A rebuild or redeploy re-reads that old snapshot — it never publishes. Deploy tokens can't publish either, so ask the user to publish from the dashboard. `cms push` warns with `Unpublished: ...` on every push while any collection has published content missing from the live bundle, not just the push that seeded it.
|
|
65
65
|
|
|
66
|
+
## Collection attributes (canvas editing)
|
|
67
|
+
- `f.collectionAttrs(collection)` (or `cmsCollectionAttr(key)`): returns `{ 'data-cms-collection': key }`. Put on listing wrappers (e.g. `<ul {...f.collectionAttrs(blog)}>`) so clicking the listing in the visual canvas opens the collection editor modal.
|
|
68
|
+
- `f.entryScope(collection, slug).attrs()` (or `cmsEntryAttr(key, slug)`): returns `{ 'data-cms-collection': key, 'data-cms-entry': slug }`. Put on each item wrapper so clicking opens that specific entry directly.
|
|
69
|
+
|
|
66
70
|
## Diagnostics
|
|
67
71
|
| `cms check` message | Fix |
|
|
68
72
|
| --- | --- |
|
|
@@ -87,12 +87,16 @@ In the dev server:
|
|
|
87
87
|
## 7. CI and deploy
|
|
88
88
|
- The user creates a **deploy token** for the site in the dashboard. It's shown once and starts with `cms_dt_`. Store it as the CI secret `CMS_AUTH_TOKEN`. It only authorizes manifest pushes and migrations for that site.
|
|
89
89
|
- The pipeline order is `pnpm exec cms check` → `pnpm exec cms push --yes` → `pnpm astro build`. Use `--yes` only in CI, where orphan prompts can't be answered. Review orphans locally first.
|
|
90
|
-
- Cloudflare Pages
|
|
91
|
-
-
|
|
92
|
-
-
|
|
90
|
+
- Cloudflare Pages configuration:
|
|
91
|
+
- Compatibility: SSR preview builds require the `nodejs_compat` flag and a compatibility date ≥ `2025-04-01`.
|
|
92
|
+
- Environment variables:
|
|
93
|
+
- Production: `CMS_SITE_ID`, `CMS_CONTENT_URL`.
|
|
94
|
+
- Preview deployment: `CMS_SITE_ID`, `CMS_CONTENT_URL`, `CMS_PREVIEW_BUILD=1`. (Site hosts hold zero preview secrets; content-worker verifies preview tokens directly).
|
|
93
95
|
- The Pages project name and branch are set on the site in the dashboard. Publishing in the CMS triggers the rebuild, so no webhook setup is needed in the repo.
|
|
94
96
|
|
|
95
97
|
## Gotchas
|
|
96
|
-
-
|
|
98
|
+
- Builds fail on unreachable content URLs or bundle fetch failures: `astro build` rethrows with the URL and HTTP status to prevent deploying empty or broken pages; a 404 (site has no published version yet) only warns so first builds and preview-twin builds succeed. In `astro dev`, bundle fetch failures still fail gracefully. Check `CMS_CONTENT_URL` and `CMS_SITE_ID` if the build fails.
|
|
99
|
+
- Never commit `.cms/` or `.dev.vars` / `.env` to git. Ensure both `.env` and `.cms/` are in `.gitignore`.
|
|
100
|
+
- SSR preview builds on Cloudflare Pages require `nodejs_compat` and compatibility date ≥ `2025-04-01` for `node:async_hooks` preview context isolation.
|
|
97
101
|
- `cms push` skips unchanged manifests using `.cms/state.json`. `--force` pushes anyway.
|
|
98
102
|
- Preview responses must stay `Cache-Control: no-store` and `noindex`, which the integration's middleware already handles. Don't add caching middleware in front of `/_preview/*`.
|