@vulcantech/cms 0.1.0 → 0.2.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 +128 -33
- package/dist/analytics.d.mts +7 -0
- package/dist/analytics.d.ts +7 -0
- package/dist/index.d.mts +0 -2
- package/dist/index.d.ts +0 -2
- package/package.json +20 -16
- package/src/analytics/route.ts +14 -1
- package/src/analytics/tags.ts +13 -1
- package/src/analytics.ts +10 -1
- package/src/banners.ts +11 -1
- package/src/blog.ts +11 -1
- package/src/collections.ts +11 -1
- package/src/forms.ts +13 -1
- package/src/index.ts +10 -0
- package/src/seo-files.ts +11 -1
package/README.md
CHANGED
|
@@ -1,23 +1,34 @@
|
|
|
1
1
|
# @vulcantech/cms
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
One dependency for every VulcanTech CMS integration — blog, collections, forms, banners, analytics, and SEO files — with `radix-ui`-style imports.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
| `@vulcantech/cms/forms` | `@vulcantech/forms` | client |
|
|
11
|
-
| `@vulcantech/cms/banners` | `@vulcantech/banners` | client |
|
|
12
|
-
| `@vulcantech/cms/analytics` | `@vulcantech/analytics` | client |
|
|
13
|
-
| `@vulcantech/cms/analytics/tags` | `@vulcantech/analytics/tags` | server |
|
|
14
|
-
| `@vulcantech/cms/analytics/route` | `@vulcantech/analytics/route` | server |
|
|
5
|
+
```bash
|
|
6
|
+
npm install @vulcantech/cms
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Ships ESM + CJS + type declarations. This package is a **pure re-export layer**: the six integration packages are regular dependencies and stay external in the build, so nothing is bundled twice and each is also installable standalone (`@vulcantech/blog`, `@vulcantech/forms`, …) if you only need one.
|
|
15
10
|
|
|
16
|
-
|
|
11
|
+
> **Where the real docs are.** This README covers what the umbrella adds: the entry-point map, the shared env contract, and the failure-mode convention. The **data contract for each integration — field shapes, filters, render rules — lives in the wrapped package's README**, linked in the table below. Read that one before writing render code.
|
|
17
12
|
|
|
18
|
-
##
|
|
13
|
+
## Entry points
|
|
19
14
|
|
|
20
|
-
|
|
15
|
+
Nine entry points: one namespaced root and eight subpaths. Every subpath is a thin `export *` of the package it wraps, so the named exports, types, and behavior are identical to importing that package directly.
|
|
16
|
+
|
|
17
|
+
| Entry point | Wraps | Runtime | What it gives you | Full docs |
|
|
18
|
+
| --- | --- | --- | --- | --- |
|
|
19
|
+
| `@vulcantech/cms` | all six | server | `Blog` / `Collections` / `Forms` / `Banners` / `Analytics` / `SeoFiles` namespaces | — |
|
|
20
|
+
| `@vulcantech/cms/blog` | `@vulcantech/blog` | server | `fetchBlogPosts`, `fetchBlogPostBySlug`, `resolvePreviewToken`, the draft-preview `GET`, `sanitizeHtml`, tag helpers, `CMSBlogPost` | [README](https://www.npmjs.com/package/@vulcantech/blog) |
|
|
21
|
+
| `@vulcantech/cms/collections` | `@vulcantech/collections` | server | `fetchCollectionItems`, `fetchCollectionItemBySlug`, `fetchCollections`, `sanitizeHtml`, tag helpers, `PortfolioItemData` | [README](https://www.npmjs.com/package/@vulcantech/collections) |
|
|
22
|
+
| `@vulcantech/cms/seo-files` | `@vulcantech/seo-files` | server | `createSeoFileRoute`, `fetchSeoFiles`, `tagsForSeoFiles`, `SeoFilesPayload` | [README](https://www.npmjs.com/package/@vulcantech/seo-files) |
|
|
23
|
+
| `@vulcantech/cms/forms` | `@vulcantech/forms` | client | `DynamicForm`, `FormDefinition`, `buildYupSchema`, `buildInitialValues`, transform/crypto helpers | [README](https://www.npmjs.com/package/@vulcantech/forms) |
|
|
24
|
+
| `@vulcantech/cms/banners` | `@vulcantech/banners` | client | `CMSBanners`, `BannerBar`, `BannerData` | [README](https://www.npmjs.com/package/@vulcantech/banners) |
|
|
25
|
+
| `@vulcantech/cms/analytics` | `@vulcantech/analytics` | client | `AnalyticsTracker`, `trackEvent`, `trackFormSubmit`, … | [README](https://www.npmjs.com/package/@vulcantech/analytics) |
|
|
26
|
+
| `@vulcantech/cms/analytics/tags` | `@vulcantech/analytics/tags` | server | `CMSTags` (async server component), `fetchTrackingTags`, `TrackingTags` | ↑ same |
|
|
27
|
+
| `@vulcantech/cms/analytics/route` | `@vulcantech/analytics/route` | server | `POST` / `OPTIONS` — the `/api/a` ingest proxy | ↑ same |
|
|
28
|
+
|
|
29
|
+
### Namespaced root
|
|
30
|
+
|
|
31
|
+
For server components, layouts, and route handlers:
|
|
21
32
|
|
|
22
33
|
```tsx
|
|
23
34
|
import { Blog, Collections } from "@vulcantech/cms";
|
|
@@ -26,42 +37,126 @@ const posts = await Blog.fetchBlogPosts();
|
|
|
26
37
|
const html = Blog.sanitizeHtml(post.content); // Collections.sanitizeHtml stays distinct
|
|
27
38
|
```
|
|
28
39
|
|
|
29
|
-
|
|
40
|
+
The six namespaces are exactly `Analytics`, `Banners`, `Blog`, `Collections`, `Forms`, `SeoFiles` (note the casing of `SeoFiles`).
|
|
41
|
+
|
|
42
|
+
**The root maps only the six package roots.** `CMSTags` and the analytics `POST`/`OPTIONS` handlers live on `@vulcantech/analytics`'s own subpaths, so they are *not* reachable as `Analytics.CMSTags` — import them from `@vulcantech/cms/analytics/tags` and `@vulcantech/cms/analytics/route`.
|
|
43
|
+
|
|
44
|
+
### Subpaths
|
|
45
|
+
|
|
46
|
+
Direct named imports, and the required form inside `"use client"` files:
|
|
30
47
|
|
|
31
48
|
```tsx
|
|
32
49
|
import { DynamicForm } from "@vulcantech/cms/forms";
|
|
33
50
|
import { CMSBanners } from "@vulcantech/cms/banners";
|
|
34
51
|
```
|
|
35
52
|
|
|
36
|
-
|
|
53
|
+
Route files re-export as usual:
|
|
37
54
|
|
|
38
55
|
```ts
|
|
56
|
+
// app/api/a/route.ts
|
|
39
57
|
export { POST, OPTIONS } from "@vulcantech/cms/analytics/route";
|
|
58
|
+
|
|
59
|
+
// app/api/preview/route.ts (blog draft preview)
|
|
60
|
+
export { GET } from "@vulcantech/cms/blog";
|
|
40
61
|
```
|
|
41
62
|
|
|
42
|
-
|
|
63
|
+
### Server vs client
|
|
43
64
|
|
|
44
|
-
|
|
65
|
+
The root barrel imports every package, including the server-side fetch layers (blog, collections, and the blog preview route import `next/headers` / `next/server`). **Import the root only from server components, layouts, and route handlers.** From a `"use client"` file, import the subpath you need so server modules stay out of the client graph.
|
|
45
66
|
|
|
46
|
-
|
|
47
|
-
npm install @vulcantech/cms
|
|
48
|
-
```
|
|
67
|
+
The three `client` rows above are `"use client"` component packages — they are safe to render from a server component, but their exports are client-side.
|
|
49
68
|
|
|
50
|
-
|
|
69
|
+
## Environment contract
|
|
51
70
|
|
|
52
|
-
|
|
71
|
+
All CMS-reading modules resolve config from `process.env` **at call time** (not at import time), so a missing var degrades at request scope rather than at build.
|
|
53
72
|
|
|
54
|
-
|
|
73
|
+
| Var | Required | Read by | Notes |
|
|
74
|
+
| --- | --- | --- | --- |
|
|
75
|
+
| `VULCANTECH_PROJECT_ID` | yes | blog, collections, seo-files, analytics/tags, analytics/route | Your CMS project id |
|
|
76
|
+
| `VULCANTECH_API_KEY` | yes | same as above | Server-only — **never** prefix with `NEXT_PUBLIC_` |
|
|
77
|
+
| `VULCANTECH_CMS_URL` | no | same as above | CMS origin; defaults to `https://cms.vulcantech.io` |
|
|
78
|
+
| `VULCANTECH_BLOG_NO_CACHE` | no | blog only | `1` / `true` bypasses ISR on every blog fetch (debugging) |
|
|
79
|
+
| `NEXT_PUBLIC_GA_ID` | no | analytics/tags | Per-field fallback when the CMS omits `ga4Id` |
|
|
80
|
+
| `NEXT_PUBLIC_GOOGLE_ADS_ID` | no | analytics/tags | Fallback for `googleAdsId` |
|
|
81
|
+
| `NEXT_PUBLIC_META_PIXEL_ID` | no | analytics/tags | Fallback for `metaPixelId` |
|
|
55
82
|
|
|
56
|
-
|
|
57
|
-
2. **next.config** — add `"@vulcantech/cms"` to `transpilePackages`, and alias its subpaths to `packages/cms/src/*` the same way the app already aliases the leaf packages — `dist/` is gitignored, so inside Docker builds only `src/` exists (the banners-extraction gotcha).
|
|
58
|
-
3. **tsconfig `paths`** — keep/add the source mappings for the underlying packages you use, plus `"@vulcantech/cms": ["../../packages/cms/src/index.ts"]` and `"@vulcantech/cms/*": ["../../packages/cms/src/*"]`; see `smoke/tsconfig.json` here for the leaf-package set.
|
|
59
|
-
4. **Dockerfile** — `COPY packages/cms` in the deps stage, next to the other `packages/*` COPY lines (same frozen-lockfile gotcha as the banners extraction).
|
|
83
|
+
**`@vulcantech/cms/forms` and `@vulcantech/cms/banners` read no environment variables at all** — they are pure renderers. The env vars their READMEs list are consumed by the server fetcher *your app* writes (see [Fetching](#fetching-what-is-included-and-what-you-write) below); `VULCANTECH_FORMS_NO_CACHE` in particular is an app-side convention, not a package feature.
|
|
60
84
|
|
|
61
|
-
|
|
85
|
+
### API-key scopes
|
|
62
86
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
87
|
+
One key per site, scoped in the CMS dashboard (Settings → API keys). Grant only what you use — an unscoped request gets a 403 and the caller degrades to its empty/fallback path.
|
|
88
|
+
|
|
89
|
+
| Scope | Needed by |
|
|
90
|
+
| --- | --- |
|
|
91
|
+
| `blog:read` | `@vulcantech/cms/blog` |
|
|
92
|
+
| `portfolio:read` | `@vulcantech/cms/collections` |
|
|
93
|
+
| `seo-files:read` | `@vulcantech/cms/seo-files` |
|
|
94
|
+
| `analytics:read` | `@vulcantech/cms/analytics/tags` (`CMSTags`) |
|
|
95
|
+
| `analytics:write` | `@vulcantech/cms/analytics/route` (event ingest) |
|
|
96
|
+
| `forms:read` | your app's form-definition fetcher |
|
|
97
|
+
| `banners:read` | your app's banner fetcher |
|
|
98
|
+
| `contact:write` | your app's form-submission proxy to the CMS `/api/contact` |
|
|
99
|
+
|
|
100
|
+
## Failure-mode convention
|
|
101
|
+
|
|
102
|
+
**Every CMS read in this package fails soft: it logs a `console.warn` and returns an empty/`null`/fallback value instead of throwing.** A CMS outage, a missing env var, a 404, or a revoked scope degrades the page, it never crashes the render. So do not wrap these calls in `try`/`catch` and do not build error UI around them — that branch can never fire. Handle the *empty* case instead: render an empty state on a list, and call `notFound()` on a `null` single item.
|
|
103
|
+
|
|
104
|
+
Verified per module:
|
|
105
|
+
|
|
106
|
+
| Module | On failure | Throws? |
|
|
107
|
+
| --- | --- | --- |
|
|
108
|
+
| `blog` — `fetchBlogPosts` / `fetchBlogPostBySlug` | `[]` / `null` + warning | No, except the JSON-parse caveat below |
|
|
109
|
+
| `blog` — `GET` (preview route) | 400 on missing params; redirect to the public URL on an invalid token | No |
|
|
110
|
+
| `collections` — all three fetchers | `[]` / `null` + warning | No, except the JSON-parse caveat below |
|
|
111
|
+
| `seo-files` — `fetchSeoFiles` | `null` + warning | No |
|
|
112
|
+
| `seo-files` — `createSeoFileRoute().GET` | serves the app's `fallback` string | No |
|
|
113
|
+
| `analytics/tags` — `fetchTrackingTags` / `CMSTags` | `null` (renders nothing) | No |
|
|
114
|
+
| `analytics/route` — `POST` | `503` unconfigured, `400` bad body, `204` when the CMS send fails | No |
|
|
115
|
+
| `forms` — `DynamicForm` | catches its own submit errors → error state + `onError(err)` | No (nothing reaches an error boundary) |
|
|
116
|
+
| `banners` — `CMSBanners` / `BannerBar` | n/a — presentational only, no I/O | No |
|
|
117
|
+
|
|
118
|
+
**The one exception.** In `blog` and `collections`, the response-body parse (`res.json()`) sits outside the `try` that guards the request. A `2xx` response whose body is not JSON — a proxy or CDN returning an HTML error page under a 200 — rejects rather than degrading. Transport failures, non-2xx statuses, 404s, and unconfigured env are all handled. `seo-files` and `analytics/tags` guard the parse too and have no such gap.
|
|
119
|
+
|
|
120
|
+
## Fetching: what is included, and what you write
|
|
121
|
+
|
|
122
|
+
Not every integration ships its own fetch layer — this trips up planning, so check here first.
|
|
123
|
+
|
|
124
|
+
**Fetch included** — call the exported function and you are done:
|
|
125
|
+
`blog`, `collections`, `seo-files`, `analytics/tags`, `analytics/route`.
|
|
126
|
+
|
|
127
|
+
**You write the fetcher** — the package ships only the renderer, and your app owns the ISR-cached fetch against the CMS API:
|
|
128
|
+
- **`forms`** → fetch `GET {CMS_URL}/api/forms` into `src/lib/cms/forms.ts`, pass the `FormDefinition` to `<DynamicForm>`.
|
|
129
|
+
- **`banners`** → fetch `GET {CMS_URL}/api/banners` into `src/lib/cms/banners.ts`, pass `BannerData[]` to `<CMSBanners>`.
|
|
130
|
+
|
|
131
|
+
Both leaf READMEs carry a copy-paste implementation. Keep them fail-open (`return []` / `null` on error) to match the convention above.
|
|
132
|
+
|
|
133
|
+
## ISR revalidation
|
|
134
|
+
|
|
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
|
+
|
|
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.
|
|
147
|
+
|
|
148
|
+
## Gotchas
|
|
149
|
+
|
|
150
|
+
- **Tailwind sources for forms.** The form renderer's utility classes live in `@vulcantech/forms`, not in this package's `dist` (the six packages stay external). Point Tailwind at the leaf package even when you only installed the umbrella — Tailwind v4: `@source "../node_modules/@vulcantech/forms/dist";`. Without it, forms render unstyled.
|
|
151
|
+
- **`sanitizeHtml` is not one function.** Blog and collections each export their own; the namespaced root keeps them distinct (`Blog.sanitizeHtml` vs `Collections.sanitizeHtml`). Both fetch layers already sanitize what they return, so you only need these for CMS HTML obtained some other way.
|
|
152
|
+
- **Blog and collections content is sanitized HTML, not markdown.** Render with `dangerouslySetInnerHTML`; a markdown renderer will mangle it. See the blog README for the full field contract.
|
|
153
|
+
- **`robots.ts` conflicts with `robots.txt/route.ts`.** When adopting `seo-files`, delete any Next Metadata `src/app/robots.ts` or the build fails.
|
|
154
|
+
|
|
155
|
+
## Notes
|
|
156
|
+
|
|
157
|
+
- The root export uses namespaces rather than a flat barrel because sibling packages intentionally share export names (e.g. `Blog.sanitizeHtml` / `Collections.sanitizeHtml`).
|
|
158
|
+
- The six integration packages are declared as normal dependencies and marked external in the build, so deduping and version resolution behave as usual — installing the umbrella alongside a leaf package does not duplicate it.
|
|
159
|
+
|
|
160
|
+
## Contributing
|
|
66
161
|
|
|
67
|
-
|
|
162
|
+
Developed in the VulcanTech monorepo. Workspace-specific setup (source aliasing, Docker builds, publishing) lives in `MONOREPO.md` there.
|
package/dist/analytics.d.mts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
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/analytics.d.ts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
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
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulcantech/cms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.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",
|
|
@@ -12,55 +12,55 @@
|
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"import": "./dist/index.mjs",
|
|
14
14
|
"require": "./dist/index.js",
|
|
15
|
-
"default": "./
|
|
15
|
+
"default": "./dist/index.mjs"
|
|
16
16
|
},
|
|
17
17
|
"./blog": {
|
|
18
18
|
"types": "./dist/blog.d.ts",
|
|
19
19
|
"import": "./dist/blog.mjs",
|
|
20
20
|
"require": "./dist/blog.js",
|
|
21
|
-
"default": "./
|
|
21
|
+
"default": "./dist/blog.mjs"
|
|
22
22
|
},
|
|
23
23
|
"./collections": {
|
|
24
24
|
"types": "./dist/collections.d.ts",
|
|
25
25
|
"import": "./dist/collections.mjs",
|
|
26
26
|
"require": "./dist/collections.js",
|
|
27
|
-
"default": "./
|
|
27
|
+
"default": "./dist/collections.mjs"
|
|
28
28
|
},
|
|
29
29
|
"./forms": {
|
|
30
30
|
"types": "./dist/forms.d.ts",
|
|
31
31
|
"import": "./dist/forms.mjs",
|
|
32
32
|
"require": "./dist/forms.js",
|
|
33
|
-
"default": "./
|
|
33
|
+
"default": "./dist/forms.mjs"
|
|
34
34
|
},
|
|
35
35
|
"./banners": {
|
|
36
36
|
"types": "./dist/banners.d.ts",
|
|
37
37
|
"import": "./dist/banners.mjs",
|
|
38
38
|
"require": "./dist/banners.js",
|
|
39
|
-
"default": "./
|
|
39
|
+
"default": "./dist/banners.mjs"
|
|
40
40
|
},
|
|
41
41
|
"./analytics": {
|
|
42
42
|
"types": "./dist/analytics.d.ts",
|
|
43
43
|
"import": "./dist/analytics.mjs",
|
|
44
44
|
"require": "./dist/analytics.js",
|
|
45
|
-
"default": "./
|
|
45
|
+
"default": "./dist/analytics.mjs"
|
|
46
46
|
},
|
|
47
47
|
"./analytics/tags": {
|
|
48
48
|
"types": "./dist/analytics/tags.d.ts",
|
|
49
49
|
"import": "./dist/analytics/tags.mjs",
|
|
50
50
|
"require": "./dist/analytics/tags.js",
|
|
51
|
-
"default": "./
|
|
51
|
+
"default": "./dist/analytics/tags.mjs"
|
|
52
52
|
},
|
|
53
53
|
"./analytics/route": {
|
|
54
54
|
"types": "./dist/analytics/route.d.ts",
|
|
55
55
|
"import": "./dist/analytics/route.mjs",
|
|
56
56
|
"require": "./dist/analytics/route.js",
|
|
57
|
-
"default": "./
|
|
57
|
+
"default": "./dist/analytics/route.mjs"
|
|
58
58
|
},
|
|
59
59
|
"./seo-files": {
|
|
60
60
|
"types": "./dist/seo-files.d.ts",
|
|
61
61
|
"import": "./dist/seo-files.mjs",
|
|
62
62
|
"require": "./dist/seo-files.js",
|
|
63
|
-
"default": "./
|
|
63
|
+
"default": "./dist/seo-files.mjs"
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"files": [
|
|
@@ -79,16 +79,20 @@
|
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@vulcantech/analytics": "^0.1.
|
|
83
|
-
"@vulcantech/banners": "^0.1.
|
|
84
|
-
"@vulcantech/blog": "^0.1
|
|
85
|
-
"@vulcantech/collections": "^0.
|
|
86
|
-
"@vulcantech/forms": "^0.
|
|
87
|
-
"@vulcantech/seo-files": "^0.1.
|
|
82
|
+
"@vulcantech/analytics": "^0.1.2",
|
|
83
|
+
"@vulcantech/banners": "^0.1.2",
|
|
84
|
+
"@vulcantech/blog": "^0.2.1",
|
|
85
|
+
"@vulcantech/collections": "^0.2.0",
|
|
86
|
+
"@vulcantech/forms": "^0.2.0",
|
|
87
|
+
"@vulcantech/seo-files": "^0.1.2"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"tsconfig": "*",
|
|
91
91
|
"tsup": "^8.5.1",
|
|
92
92
|
"typescript": "^5.9.3"
|
|
93
|
+
},
|
|
94
|
+
"repository": {
|
|
95
|
+
"type": "git",
|
|
96
|
+
"url": "git+https://github.com/vulcantech/vulcantech.git"
|
|
93
97
|
}
|
|
94
98
|
}
|
package/src/analytics/route.ts
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* `@vulcantech/cms/analytics/route` — direct named re-exports of
|
|
3
|
+
* `@vulcantech/analytics/route`.
|
|
4
|
+
*
|
|
5
|
+
* // app/api/a/route.ts
|
|
6
|
+
* export { POST, OPTIONS } from "@vulcantech/cms/analytics/route";
|
|
7
|
+
*
|
|
8
|
+
* SERVER: the App Router proxy that forwards tracker events to the CMS from
|
|
9
|
+
* the site's own domain. Reads VULCANTECH_PROJECT_ID / VULCANTECH_API_KEY
|
|
10
|
+
* (scope `analytics:write`). Never throws — 503 when unconfigured, 400 on a
|
|
11
|
+
* bad body, 204 otherwise (including when the CMS send fails).
|
|
12
|
+
*
|
|
13
|
+
* Not reachable from the root barrel's `Analytics` namespace; use this subpath.
|
|
14
|
+
*/
|
|
2
15
|
export * from "@vulcantech/analytics/route";
|
package/src/analytics/tags.ts
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* `@vulcantech/cms/analytics/tags` — direct named re-exports of
|
|
3
|
+
* `@vulcantech/analytics/tags`.
|
|
4
|
+
*
|
|
5
|
+
* import { CMSTags } from "@vulcantech/cms/analytics/tags";
|
|
6
|
+
*
|
|
7
|
+
* SERVER: `CMSTags` is an async server component that injects the project's
|
|
8
|
+
* GA4 / Google Ads / Meta Pixel tags. Reads VULCANTECH_PROJECT_ID /
|
|
9
|
+
* VULCANTECH_API_KEY (scope `analytics:read`), with per-field NEXT_PUBLIC_*
|
|
10
|
+
* fallbacks. Never throws — renders `null` when nothing is configured.
|
|
11
|
+
*
|
|
12
|
+
* Not reachable from the root barrel's `Analytics` namespace; use this subpath.
|
|
13
|
+
*/
|
|
2
14
|
export * from "@vulcantech/analytics/tags";
|
package/src/analytics.ts
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* `@vulcantech/cms/analytics` — direct named re-exports of
|
|
3
|
+
* `@vulcantech/analytics`.
|
|
4
|
+
*
|
|
5
|
+
* import { AnalyticsTracker, trackEvent } from "@vulcantech/cms/analytics";
|
|
6
|
+
*
|
|
7
|
+
* CLIENT: the first-party tracker component and its imperative track helpers.
|
|
8
|
+
* The server-side halves live on their own subpaths — `../analytics/tags`
|
|
9
|
+
* (CMSTags) and `../analytics/route` (the ingest proxy).
|
|
10
|
+
*/
|
|
2
11
|
export * from "@vulcantech/analytics";
|
package/src/banners.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* `@vulcantech/cms/banners` — direct named re-exports of
|
|
3
|
+
* `@vulcantech/banners`.
|
|
4
|
+
*
|
|
5
|
+
* import { CMSBanners } from "@vulcantech/cms/banners";
|
|
6
|
+
*
|
|
7
|
+
* CLIENT: `"use client"` presentational components, no I/O and no env vars.
|
|
8
|
+
* Your app fetches `BannerData[]` from the CMS `/api/banners` (scope
|
|
9
|
+
* `banners:read`) and passes it in — see the @vulcantech/banners README for a
|
|
10
|
+
* copy-paste fetcher.
|
|
11
|
+
*/
|
|
2
12
|
export * from "@vulcantech/banners";
|
package/src/blog.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* `@vulcantech/cms/blog` — direct named re-exports of `@vulcantech/blog`.
|
|
3
|
+
*
|
|
4
|
+
* import { fetchBlogPosts } from "@vulcantech/cms/blog";
|
|
5
|
+
*
|
|
6
|
+
* SERVER-ONLY: reads VULCANTECH_PROJECT_ID / VULCANTECH_API_KEY (scope
|
|
7
|
+
* `blog:read`) and imports next/headers — import from server components and
|
|
8
|
+
* route handlers only. The fetchers fail soft (`[]` / `null` + a warning)
|
|
9
|
+
* rather than throwing. Post shape and render rules: the @vulcantech/blog
|
|
10
|
+
* README.
|
|
11
|
+
*/
|
|
2
12
|
export * from "@vulcantech/blog";
|
package/src/collections.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* `@vulcantech/cms/collections` — direct named re-exports of
|
|
3
|
+
* `@vulcantech/collections`.
|
|
4
|
+
*
|
|
5
|
+
* import { fetchCollectionItems } from "@vulcantech/cms/collections";
|
|
6
|
+
*
|
|
7
|
+
* SERVER-ONLY: reads VULCANTECH_PROJECT_ID / VULCANTECH_API_KEY (scope
|
|
8
|
+
* `portfolio:read`). The fetchers fail soft (`[]` / `null` + a warning)
|
|
9
|
+
* rather than throwing. Item shape and `displayMode` rules: the
|
|
10
|
+
* @vulcantech/collections README.
|
|
11
|
+
*/
|
|
2
12
|
export * from "@vulcantech/collections";
|
package/src/forms.ts
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* `@vulcantech/cms/forms` — direct named re-exports of `@vulcantech/forms`.
|
|
3
|
+
*
|
|
4
|
+
* import { DynamicForm } from "@vulcantech/cms/forms";
|
|
5
|
+
*
|
|
6
|
+
* CLIENT: `"use client"` renderer components. This package reads no env vars
|
|
7
|
+
* and ships no fetch layer — your app fetches the `FormDefinition` from the
|
|
8
|
+
* CMS `/api/forms` (scope `forms:read`) and passes it in. `DynamicForm`
|
|
9
|
+
* catches its own submit errors and surfaces them via `onError`.
|
|
10
|
+
*
|
|
11
|
+
* Tailwind must scan `@vulcantech/forms/dist` (not this package's dist) or
|
|
12
|
+
* the renderer's classes are never generated. See the @vulcantech/forms README.
|
|
13
|
+
*/
|
|
2
14
|
export * from "@vulcantech/forms";
|
package/src/index.ts
CHANGED
|
@@ -15,6 +15,16 @@
|
|
|
15
15
|
* layouts. From "use client" components, import the subpath you need
|
|
16
16
|
* instead — e.g. `@vulcantech/cms/forms` — so server modules stay out
|
|
17
17
|
* of the client graph.
|
|
18
|
+
*
|
|
19
|
+
* The root maps only the six package ROOTS. `@vulcantech/analytics`'s own
|
|
20
|
+
* subpaths are not folded into the `Analytics` namespace, so `CMSTags` and
|
|
21
|
+
* the ingest `POST`/`OPTIONS` are reachable only via
|
|
22
|
+
* `@vulcantech/cms/analytics/tags` and `@vulcantech/cms/analytics/route`.
|
|
23
|
+
*
|
|
24
|
+
* Shared config for every CMS-reading module: VULCANTECH_PROJECT_ID and
|
|
25
|
+
* VULCANTECH_API_KEY (required), VULCANTECH_CMS_URL (optional). The fetch
|
|
26
|
+
* layers fail soft — a CMS outage or missing env logs a warning and returns
|
|
27
|
+
* an empty/null/fallback value rather than throwing. See README.md.
|
|
18
28
|
*/
|
|
19
29
|
export * as Analytics from "@vulcantech/analytics";
|
|
20
30
|
export * as Banners from "@vulcantech/banners";
|
package/src/seo-files.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* `@vulcantech/cms/seo-files` — direct named re-exports of
|
|
3
|
+
* `@vulcantech/seo-files`.
|
|
4
|
+
*
|
|
5
|
+
* export const { GET } = createSeoFileRoute({ type: "robots", fallback });
|
|
6
|
+
*
|
|
7
|
+
* SERVER-ONLY: reads VULCANTECH_PROJECT_ID / VULCANTECH_API_KEY (scope
|
|
8
|
+
* `seo-files:read`). Never throws — an unreachable or empty CMS serves the
|
|
9
|
+
* app-supplied `fallback` string instead. Fallback semantics: the
|
|
10
|
+
* @vulcantech/seo-files README.
|
|
11
|
+
*/
|
|
2
12
|
export * from "@vulcantech/seo-files";
|