Files
Giancarlo Buomprisco 7ebff31475 Next.js Supabase V3 (#463)
Version 3 of the kit:
- Radix UI replaced with Base UI (using the Shadcn UI patterns)
- next-intl replaces react-i18next
- enhanceAction deprecated; usage moved to next-safe-action
- main layout now wrapped with [locale] path segment
- Teams only mode
- Layout updates
- Zod v4
- Next.js 16.2
- Typescript 6
- All other dependencies updated
- Removed deprecated Edge CSRF
- Dynamic Github Action runner
2026-03-24 13:40:38 +08:00

61 lines
1.6 KiB
TypeScript

import type { PlopTypes } from '@turbo/gen';
import { execSync } from 'node:child_process';
export function createKeystaticAdminGenerator(plop: PlopTypes.NodePlopAPI) {
return plop.setGenerator('keystatic', {
description: 'Generate a the admin for Keystatic',
prompts: [],
actions: [
{
type: 'add',
path: 'apps/web/app/keystatic/layout.tsx',
templateFile: 'templates/keystatic/layout.tsx.hbs',
},
{
type: 'add',
path: 'apps/web/app/keystatic/[[...params]]/page.tsx',
templateFile: 'templates/keystatic/page.tsx.hbs',
},
{
type: 'add',
path: 'apps/web/app/api/keystatic/[...params]/route.ts',
templateFile: 'templates/keystatic/route.ts.hbs',
},
{
type: 'modify',
path: 'apps/web/package.json',
async transform(content) {
const pkg = JSON.parse(content);
const dep = `@keystatic/next`;
const version = await fetch(
`https://registry.npmjs.org/-/package/${dep}/dist-tags`,
)
.then((res) => res.json())
.then((json) => json.latest);
pkg.dependencies![dep] = `^${version}`;
pkg.dependencies!['@kit/keystatic'] = `workspace:*`;
return JSON.stringify(pkg, null, 2);
},
},
async () => {
/**
* Install deps and format everything
*/
execSync('pnpm manypkg fix', {
stdio: 'inherit',
});
execSync('pnpm i', {
stdio: 'inherit',
});
return `Keystatic admin generated!`;
},
],
});
}