feat(generators): ui byte-identical snapshot + dispatch entry + e2e test
- Adds ui.snapshot.json (28 entries) computed from packages/core-ui - Wires CORE_PACKAGE_GENERATORS["ui"]: guard + emitTemplateTree + addToTranspilePackages + printUiNextSteps (web-tanstack/storybook wiring is printed, not generated — resists templating) - Adds "ui" to the core-package generator choices list - Adds core-package-ui.e2e.test.ts (byte-identical reconstruction) — passes in 14.6 s Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -654,6 +654,18 @@ import noRealtimeHandlerReexport from "./rules/no-realtime-handler-reexport.js";
|
||||
},
|
||||
printTrpcNextSteps,
|
||||
],
|
||||
ui: () => [
|
||||
() => {
|
||||
assertOptionalPackageNotPresent("core-ui");
|
||||
return "Guard passed — packages/core-ui does not exist yet.";
|
||||
},
|
||||
...emitTemplateTree("core-package/ui", "packages/core-ui"),
|
||||
() => {
|
||||
addToTranspilePackages("apps/web-next/next.config.mjs", "@repo/core-ui");
|
||||
return "Added @repo/core-ui to transpilePackages.";
|
||||
},
|
||||
printUiNextSteps,
|
||||
],
|
||||
};
|
||||
|
||||
plop.setGenerator("core-package", {
|
||||
@@ -663,7 +675,7 @@ import noRealtimeHandlerReexport from "./rules/no-realtime-handler-reexport.js";
|
||||
type: "list",
|
||||
name: "name",
|
||||
message: "Which optional core package?",
|
||||
choices: ["realtime", "events", "trpc"],
|
||||
choices: ["realtime", "events", "trpc", "ui"],
|
||||
},
|
||||
],
|
||||
actions: (answers) => {
|
||||
@@ -1187,6 +1199,37 @@ function printTrpcNextSteps(): string {
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
function printUiNextSteps(): string {
|
||||
return [
|
||||
"─────────────────────────────────────────────────────────────",
|
||||
"@repo/core-ui scaffolded.",
|
||||
"",
|
||||
"Next steps (manual wiring — not generated):",
|
||||
"",
|
||||
" 1. pnpm install # link the new workspace package",
|
||||
"",
|
||||
" 2. apps/web-next/package.json:",
|
||||
' - add "@repo/core-ui": "workspace:*" to dependencies',
|
||||
"",
|
||||
" 3. apps/storybook/.storybook/main.ts:",
|
||||
' - add "../../../packages/core-ui/src/**/*.stories.@(ts|tsx)" to the stories array',
|
||||
"",
|
||||
" 4. apps/storybook/.storybook/preview.ts:",
|
||||
' - add: import "@repo/core-ui/styles/globals.css";',
|
||||
"",
|
||||
" 5. apps/storybook/package.json:",
|
||||
' - add "@repo/core-ui": "workspace:*" to dependencies',
|
||||
"",
|
||||
" 6. apps/web-tanstack/package.json:",
|
||||
' - add "@repo/core-ui": "workspace:*" to dependencies',
|
||||
" - when TanStack Start gains a real vite.config.ts, add @repo/core-ui",
|
||||
" to optimizeDeps.include",
|
||||
"",
|
||||
" 7. pnpm typecheck && pnpm lint && pnpm test",
|
||||
"─────────────────────────────────────────────────────────────",
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
function printEventsNextSteps(): string {
|
||||
return [
|
||||
"─────────────────────────────────────────────────────────────",
|
||||
|
||||
Reference in New Issue
Block a user