Repository navigation
Expand file tree
/
Copy pathcms.config.ts
More file actions
74 lines (70 loc) · 2.33 KB
/
Copy pathcms.config.ts
File metadata and controls
74 lines (70 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* The runtime half of the WordPress → TanStack CMS port: the block palette, AI
* adapters, migrated seed documents, and theme. The content model is in
* ./cms.definition.ts.
*/
import { defineBlock, defineCms } from '@tanstack/cms-core'
import { createPgliteStorage } from '@tanstack/cms-store-postgres/pglite'
import { seedDocuments } from './seed-data'
import { definition } from './cms.definition'
// WordPress bodies become Markdown, so the page palette needs only the
// `richText` block (the UI renderer already handles it).
const blockTypes = [
defineBlock({
type: 'richText',
label: 'Rich text',
fields: [{ name: 'markdown', label: 'Text (markdown)', type: 'markdown' }],
}),
]
/**
* AI models: Claude for text, Gemini ("Nano Banana") for images, each enabled
* by its API key. Loaded with `import()` on the server only, so the provider
* SDKs stay out of the browser bundle. Swap in any `@tanstack/ai` adapter.
*/
const ai = {
textAdapter: async () => {
if (!process.env.ANTHROPIC_API_KEY) return null
const { anthropicText } = await import('@tanstack/ai-anthropic')
return anthropicText('claude-sonnet-4-6')
},
imageAdapter: async () => {
if (!process.env.GEMINI_API_KEY && !process.env.GOOGLE_API_KEY) return null
const { geminiImage } = await import('@tanstack/ai-gemini')
return geminiImage('gemini-3.1-flash-image')
},
}
export const cms = defineCms(definition, {
storage: createPgliteStorage,
blockTypes,
ai,
seed: { documents: seedDocuments },
// Skin the public site like a classic WordPress (Twenty Twenty-One) blog:
// cream background, serif headings, muted-brown links, WP footer line.
theme: {
name: 'The Garden Path',
tagline: 'Notes from a small backyard garden',
variant: 'blog',
footer: '© The Garden Path. Proudly powered by WordPress.',
tokens: {
bg: '#f8f4ec',
surface: '#ffffff',
fg: '#28303d',
heading: '#1a1a1a',
muted: '#727272',
border: '#ddd9cf',
accent: '#6b4423',
'accent-fg': '#ffffff',
'accent-soft': '#efe7da',
'header-bg': '#f8f4ec',
'font-heading': 'Georgia, "Times New Roman", serif',
'page-width': '70rem',
'content-width': '42rem',
radius: '0.25rem',
},
},
})
declare module '@tanstack/cms-core' {
interface Register {
cms: typeof definition
}
}