@vulcantech/blog 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/README.md +7 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,22 +10,13 @@ Server-side blog fetch layer for VulcanTech consumer sites. Reads published post
|
|
|
10
10
|
|
|
11
11
|
Wire blog into a consumer site (Next.js App Router):
|
|
12
12
|
|
|
13
|
-
**1. Add the dependency
|
|
14
|
-
```
|
|
15
|
-
|
|
13
|
+
**1. Add the dependency**:
|
|
14
|
+
```bash
|
|
15
|
+
npm install @vulcantech/blog
|
|
16
16
|
```
|
|
17
|
+
(Inside the VulcanTech monorepo, use the workspace wiring in `MONOREPO.md` instead.)
|
|
17
18
|
|
|
18
|
-
**2.
|
|
19
|
-
```js
|
|
20
|
-
transpilePackages: ["@vulcantech/blog", /* ... */],
|
|
21
|
-
webpack: (config) => {
|
|
22
|
-
config.resolve.alias["@vulcantech/blog"] = path.join(__dirname, "../../packages/blog");
|
|
23
|
-
return config;
|
|
24
|
-
},
|
|
25
|
-
turbopack: {
|
|
26
|
-
resolveAlias: { "@vulcantech/blog": "./../../packages/blog/src/index.ts" },
|
|
27
|
-
},
|
|
28
|
-
```
|
|
19
|
+
**2. Set the env** — see [Required env](#required-env) below.
|
|
29
20
|
|
|
30
21
|
**3. (Optional) thin re-export** `src/lib/cms/blog.ts` to preserve `@/lib/cms/blog` import paths:
|
|
31
22
|
```ts
|
|
@@ -71,8 +62,8 @@ Wiring a scoped route (e.g. documentation) takes three pieces:
|
|
|
71
62
|
|
|
72
63
|
**1. A scope predicate — keep `/blog` clean.** `fetchBlogPosts()` returns every
|
|
73
64
|
published post regardless of prefix, so the blog list/related-posts must filter,
|
|
74
|
-
or scoped posts leak onto `/blog`. Centralize the predicate
|
|
75
|
-
|
|
65
|
+
or scoped posts leak onto `/blog`. Centralize the predicate in one module (e.g.
|
|
66
|
+
`src/lib/cms/postScope.ts`) instead of scattering `!== "legal"` checks:
|
|
76
67
|
|
|
77
68
|
```ts
|
|
78
69
|
export const BLOG_ROUTE_PREFIX = "blog";
|
|
@@ -102,12 +93,6 @@ if (!post || post.routePrefix !== "documentation") notFound();
|
|
|
102
93
|
tags on edit, so scoped pages revalidate with the blog as long as they use this
|
|
103
94
|
package's fetchers (which attach those tags).
|
|
104
95
|
|
|
105
|
-
Live examples: `apps/dry-ice-pro-auto/src/app/legal/` (prefix `"legal"`, with the
|
|
106
|
-
`postScope.ts` predicate keeping `/blog` scoped) and the CMS's own
|
|
107
|
-
`apps/vulcantech-cms/src/app/(theme)/documentation/` (prefix `"documentation"` —
|
|
108
|
-
note the CMS reads its own Firestore via Admin SDK in `src/lib/blog/posts.ts`
|
|
109
|
-
instead of this package, but the scoping workflow is identical).
|
|
110
|
-
|
|
111
96
|
### Required env
|
|
112
97
|
`VULCANTECH_PROJECT_ID`, `VULCANTECH_API_KEY` (required) · `VULCANTECH_CMS_URL` (optional, default `https://cms.vulcantech.io`) · `VULCANTECH_BLOG_NO_CACHE` (optional, `1`/`true` to bypass ISR while debugging).
|
|
113
98
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulcantech/blog",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Server-side blog fetch layer for VulcanTech consumer sites — ISR-tagged reads from the CMS, with signed draft-preview support. Shared so each site doesn't duplicate the fetch code.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"source": "./src/index.ts",
|