@vulcantech/cms 0.2.0 → 0.3.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/README.md CHANGED
@@ -76,6 +76,7 @@ All CMS-reading modules resolve config from `process.env` **at call time** (not
76
76
  | `VULCANTECH_API_KEY` | yes | same as above | Server-only — **never** prefix with `NEXT_PUBLIC_` |
77
77
  | `VULCANTECH_CMS_URL` | no | same as above | CMS origin; defaults to `https://cms.vulcantech.io` |
78
78
  | `VULCANTECH_BLOG_NO_CACHE` | no | blog only | `1` / `true` bypasses ISR on every blog fetch (debugging) |
79
+ | `VULCANTECH_REVALIDATE_SECRET` | no* | your `api/revalidate` route | Shared secret the CMS sends on every ISR purge. *Required for instant invalidation — see [ISR revalidation](#isr-revalidation) |
79
80
  | `NEXT_PUBLIC_GA_ID` | no | analytics/tags | Per-field fallback when the CMS omits `ga4Id` |
80
81
  | `NEXT_PUBLIC_GOOGLE_ADS_ID` | no | analytics/tags | Fallback for `googleAdsId` |
81
82
  | `NEXT_PUBLIC_META_PIXEL_ID` | no | analytics/tags | Fallback for `metaPixelId` |
@@ -132,18 +133,32 @@ Both leaf READMEs carry a copy-paste implementation. Keep them fail-open (`retur
132
133
 
133
134
  ## ISR revalidation
134
135
 
135
- Every CMS-reading fetch is tagged so the CMS can purge it the moment content changes. Add `src/app/api/revalidate/route.ts` to the consumer site once, and register the site under the project's webhook consumers in the CMS.
136
+ Every CMS-reading fetch is tagged so the CMS can purge it the moment content changes. Without the wiring below **edits are not lost, just slow**: each fetch simply waits out its revalidate window (60s for blog, tracking tags, and the app-side forms/banners fetchers; 3600s for SEO files). With it, the CMS pushes a purge to your site the instant content is saved.
136
137
 
137
- | Integration | Tags purged |
138
- | --- | --- |
139
- | blog | `blog:{projectId}`, `blog:{projectId}:{slug}` |
140
- | collections | `portfolio:{projectId}`, `collection:{projectId}:{slug}`, `item:{projectId}:{slug}` |
141
- | seo-files | `seo-files:{projectId}` (plus the `/robots.txt` and `/llms.txt` paths) |
142
- | analytics/tags | `tracking-tags:{projectId}` |
143
- | forms (app-side) | `forms:{projectId}`, `form:{projectId}:{formId}` |
144
- | banners (app-side) | `banners:{projectId}` |
145
-
146
- Default revalidate windows: 60s for blog, collections, and tracking tags; 3600s for SEO files.
138
+ This is one piece of wiring per site, shared by every integration. Do it once, even if you only use the blog:
139
+
140
+ **1. Add the secret** — set `VULCANTECH_REVALIDATE_SECRET` in the consumer site's env to any long random string.
141
+
142
+ **2. Add the webhook route** `src/app/api/revalidate/route.ts`. No package exports one; copy `apps/castlerents/src/app/api/revalidate/route.ts` (the reference implementation). The contract the CMS speaks:
143
+
144
+ - `POST`, JSON body `{ projectId, tags: string[], paths?: string[], slug?, formId? }`.
145
+ - Header `x-revalidate-secret` must equal `VULCANTECH_REVALIDATE_SECRET`; answer `401` otherwise, `503` if the env var is unset, `400` if neither `tags` nor `paths` is given.
146
+ - Call `revalidateTag(tag, "default")` for every tag and `revalidatePath(path)` for every path, then respond `{ revalidated: true, tags, paths, at }`.
147
+
148
+ The CMS fires this fire-and-forget with a 5s timeout, so a slow or failing route never blocks a save.
149
+
150
+ **3. Register the site in the CMS** — Dashboard → **Settings → Form Consumers (ISR Revalidation)**. Add an entry with the site's full route URL (`https://example.com/api/revalidate`) and paste the same secret. Use the **Test** button on the entry to confirm a `200`.
151
+
152
+ > The section is named "Form Consumers" for historical reasons — forms were the first integration to revalidate — but it is the **single fan-out list for every dispatcher**: blog, forms, banners, SEO files, and tracking tags all POST to every entry. A blog-only site still has to register here.
153
+
154
+ | Integration | Tags purged | Paths purged |
155
+ | --- | --- | --- |
156
+ | blog | `blog:{projectId}`, `blog:{projectId}:{slug}` (and the previous slug on rename) | `/blog` |
157
+ | seo-files | `seo-files:{projectId}` | `/robots.txt`, `/llms.txt` |
158
+ | analytics/tags | `tracking-tags:{projectId}` | — |
159
+ | forms (app-side) | `forms:{projectId}`, `form:{projectId}:{formId}` | — |
160
+ | banners (app-side) | `banners:{projectId}` | — |
161
+ | collections | `portfolio:{projectId}`, `collection:{projectId}:{slug}`, `item:{projectId}:{slug}` | **no dispatcher** — fetches expire on the 60s window only |
147
162
 
148
163
  ## Gotchas
149
164
 
@@ -1,8 +1 @@
1
1
  export * from '@vulcantech/analytics';
2
- import '@vulcantech/analytics/route';
3
- import '@vulcantech/analytics/tags';
4
- import '@vulcantech/banners';
5
- import '@vulcantech/blog';
6
- import '@vulcantech/collections';
7
- import '@vulcantech/forms';
8
- import '@vulcantech/seo-files';
@@ -1,8 +1 @@
1
1
  export * from '@vulcantech/analytics';
2
- import '@vulcantech/analytics/route';
3
- import '@vulcantech/analytics/tags';
4
- import '@vulcantech/banners';
5
- import '@vulcantech/blog';
6
- import '@vulcantech/collections';
7
- import '@vulcantech/forms';
8
- import '@vulcantech/seo-files';
package/dist/index.d.mts CHANGED
@@ -10,3 +10,5 @@ import * as forms from '@vulcantech/forms';
10
10
  export { forms as Forms };
11
11
  import * as seoFiles from '@vulcantech/seo-files';
12
12
  export { seoFiles as SeoFiles };
13
+ import '@vulcantech/analytics/tags';
14
+ import '@vulcantech/analytics/route';
package/dist/index.d.ts CHANGED
@@ -10,3 +10,5 @@ import * as forms from '@vulcantech/forms';
10
10
  export { forms as Forms };
11
11
  import * as seoFiles from '@vulcantech/seo-files';
12
12
  export { seoFiles as SeoFiles };
13
+ import '@vulcantech/analytics/tags';
14
+ import '@vulcantech/analytics/route';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vulcantech/cms",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Umbrella entry point for the VulcanTech CMS integration packages — one dependency, radix-ui-style imports for blog, collections, forms, banners, analytics, and seo-files.",
5
5
  "license": "MIT",
6
6
  "source": "./src/index.ts",
@@ -80,11 +80,11 @@
80
80
  },
81
81
  "dependencies": {
82
82
  "@vulcantech/analytics": "^0.1.2",
83
- "@vulcantech/banners": "^0.1.2",
84
- "@vulcantech/blog": "^0.2.1",
83
+ "@vulcantech/banners": "^0.1.3",
84
+ "@vulcantech/blog": "^0.2.2",
85
85
  "@vulcantech/collections": "^0.2.0",
86
- "@vulcantech/forms": "^0.2.0",
87
- "@vulcantech/seo-files": "^0.1.2"
86
+ "@vulcantech/forms": "^0.3.0",
87
+ "@vulcantech/seo-files": "^0.1.3"
88
88
  },
89
89
  "devDependencies": {
90
90
  "tsconfig": "*",