@cmssy/cli 15.0.0 → 16.1.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.
@@ -1,3 +1,4 @@
1
+ import { draftMode } from "next/headers";
1
2
  import { createCmssyPage, CmssyLayoutSlot } from "@cmssy/next/server";
2
3
  import type { CmssyRegion } from "@cmssy/next";
3
4
  import { cmssy, type layout } from "@/cmssy.config";
@@ -14,14 +15,20 @@ type PageProps = {
14
15
  export const revalidate = 3600;
15
16
  export const dynamicParams = true;
16
17
 
18
+ const cache = { revalidate };
19
+
17
20
  export function generateStaticParams() {
18
21
  return publishedPaths();
19
22
  }
20
23
 
21
- const CmssyPage = createCmssyPage(cmssy, blocks, { editor: CmssyEditor });
24
+ const CmssyPage = createCmssyPage(cmssy, blocks, {
25
+ editor: CmssyEditor,
26
+ cache,
27
+ });
22
28
 
23
29
  export default async function Page(props: PageProps) {
24
30
  const { path } = await props.params;
31
+ const { isEnabled: preview } = await draftMode();
25
32
  const slot = (region: CmssyRegion<typeof layout>) => (
26
33
  <CmssyLayoutSlot
27
34
  config={cmssy}
@@ -29,7 +36,9 @@ export default async function Page(props: PageProps) {
29
36
  region={region}
30
37
  path={path ?? []}
31
38
  editMode={false}
39
+ preview={preview}
32
40
  editable={EditableLayout}
41
+ cache={cache}
33
42
  />
34
43
  );
35
44
 
@@ -0,0 +1,5 @@
1
+ import { createCmssyRevalidateRoute } from "@cmssy/next/server";
2
+
3
+ export const POST = createCmssyRevalidateRoute({
4
+ secret: process.env.CMSSY_WEBHOOK_SECRET,
5
+ });
@@ -5,3 +5,5 @@ CMSSY_ORG_SLUG=
5
5
  CMSSY_WORKSPACE_SLUG=
6
6
  # Draft/preview secret, generated per workspace (Settings -> Headless)
7
7
  CMSSY_DRAFT_SECRET=
8
+ # Signing secret of the content.changed webhook pointed at /api/revalidate (Settings -> Webhooks)
9
+ CMSSY_WEBHOOK_SECRET=
package/dist/index.js CHANGED
@@ -258,6 +258,10 @@ var FRAMEWORKS = [
258
258
  {
259
259
  path: "app/api/draft/route.ts",
260
260
  purpose: "draft preview without the editor - enters draft mode for a verified secret"
261
+ },
262
+ {
263
+ path: "app/api/revalidate/route.ts",
264
+ purpose: "the content.changed webhook lands here and expires the cmssy-content data cache, so a publish shows up now instead of after revalidate seconds"
261
265
  }
262
266
  ],
263
267
  warnings: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/cli",
3
- "version": "15.0.0",
3
+ "version": "16.1.0",
4
4
  "description": "The cmssy CLI: `cmssy init` wires cmssy into an existing Next.js, Astro or React Router app; `cmssy link` connects it to a workspace and verifies the editor wiring.",
5
5
  "keywords": [
6
6
  "cmssy",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "dependencies": {
30
30
  "esbuild": "^0.27.7",
31
- "@cmssy/core": "15.0.0"
31
+ "@cmssy/core": "16.1.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^20.0.0",