@@ -49,7 +49,7 @@ nested docs), and custom React admin components — these drive the gap report.
4949
5050Outside this repo, start from a TanStack Start app and run
5151` npx tanstack-cms init ` (from ` @tanstack/cms-cli ` ): it creates
52- ` src/cms.definition.ts ` and ` src/cms.config.ts ` , adds ` tanstackCms() ` and ` cmsVirtualRoutes( )` to
52+ ` src/cms.definition.ts ` and ` src/cms.config.ts ` , adds ` tanstackCms() ` and ` createRoutes(definition )` to
5353` vite.config.ts ` , imports the config from ` src/router.tsx ` , and ignores
5454` .data/ ` . In this repo, copy the shape of [ ` examples/blog ` ] ( ../../../examples/blog ) :
5555
@@ -63,11 +63,12 @@ Outside this repo, start from a TanStack Start app and run
6363 ` test:types ` (` tsc --noEmit ` ), ` test:lib ` (` vitest run ` ), ` cms `
6464 (` tanstack-cms ` ), ` migrate:data ` . Pick a free dev port.
6565- ` vite.config.ts ` — as in ` examples/blog ` :
66- ` plugins: [tanstackCms(), tailwindcss(), tanstackStart({ router: { virtualRouteConfig: cmsVirtualRoutes() } }), nitro(), viteReact()] `
67- with ` tanstackCms ` from ` @tanstack/cms-ui-react/vite ` and ` cmsVirtualRoutes `
68- from ` @tanstack/cms-ui-react/virtual-routes ` . Payload serves its admin at
69- ` /admin ` ; keep that URL with ` cmsVirtualRoutes({ adminBasePath: '/admin' }) `
70- plus ` defineCmsDefinition({ admin: { basePath: '/admin' } }) ` .
66+ ` plugins: [tanstackCms(), tailwindcss(), tanstackStart({ router: { virtualRouteConfig: createRoutes(definition) } }), nitro(), viteReact()] `
67+ with ` tanstackCms ` from ` @tanstack/cms-ui-react/vite ` , ` createRoutes ` from
68+ ` @tanstack/cms-ui-react/virtual-routes ` , and ` definition ` from
69+ ` ./src/cms.definition ` . Payload serves its admin at ` /admin ` ; keep that URL
70+ with ` defineCmsDefinition({ admin: { basePath: '/admin' } }) ` , which
71+ ` createRoutes ` mounts the admin under (set it once, in the definition).
7172- ` vitest.config.ts ` — a plain ` defineConfig({ test: { environment: 'node', include: ['src/**/*.test.ts'] } }) `
7273 from ` vitest/config ` , so tests don't load the Start/Nitro plugins.
7374- ` tsconfig.json ` — ` { "extends": "../../tsconfig.base.json", "include": ["src/**/*.ts","src/**/*.tsx"] } ` .
@@ -80,7 +81,7 @@ Outside this repo, start from a TanStack Start app and run
8081Write ` cms.definition.ts ` calling ` defineCmsDefinition({ collections, admin }) ` ,
8182importing only from ` @tanstack/cms-core/definition ` (` defineCollection ` ,
8283` redirectsCollection ` , …): Vite config and client code load this file, and
83- ` pnpm test:definitions ` fails if it reaches React, Start, or server code.
84+ ` pnpm test:definitions ` fails if it reaches React, Start, server code, or the ` @tanstack/cms-core ` root .
8485Then write ` cms.config.ts ` calling
8586` defineCms(definition, { blockTypes, auth, seed, collections, … }) ` and
8687register the definition's type
0 commit comments