feat(turbo): turbo gen feature generator (Phase 1, single-entity)
Adds `pnpm turbo gen feature` to scaffold a Lazar-conformant feature package matching the navigation reference shape: entity + Zod schema, single use case (`get<Entity>`), controller, mock + Payload-stub real repository (with span + capture), DI module/container/symbols, and tRPC router with full BAD_REQUEST/NOT_FOUND error mapping. The generated `bind-production.ts` and `bind-dev-seed.ts` compose the post-R44 `withSpan(tracer, opts, withCapture(logger, tags, factory(deps)))` sandwich at bind time. Verified by generating a sample `packages/example/` feature and running `pnpm --filter @repo/example lint typecheck test` — all three pass (9 test files, 25 tests). Cleaned up after verification so no example package is committed. Phase-1 limitations (documented in `docs/guides/scaffolding-a-feature.md` and printed by the generator on success): no Payload CMS templates, no React Query helpers, faker-driven factories left as stubs, single entity / single use case, and aggregator wiring (core-api/root, apps/web-next bindAll) is left as a manual checklist. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
16
turbo/generators/templates/feature/src/__seeds__/dev.ts.hbs
Normal file
16
turbo/generators/templates/feature/src/__seeds__/dev.ts.hbs
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { {{pascalCase entity}} } from "../entities/models/{{kebabCase entity}}.js";
|
||||
|
||||
/**
|
||||
* Realistic dev seed for `bindDevSeed{{pascalCase name}}`.
|
||||
*
|
||||
* Phase-1: returns a small hand-rolled Map. Replace with a faker-driven
|
||||
* `defineFactory` (see `packages/blog/src/__factories__/`) once the entity
|
||||
* shape stabilises.
|
||||
*/
|
||||
export function buildDev{{pascalCase entity}}Map(): Map<string, {{pascalCase entity}}> {
|
||||
return new Map<string, {{pascalCase entity}}>([
|
||||
["dev-1", { id: "dev-1", name: "Dev One" }],
|
||||
["dev-2", { id: "dev-2", name: "Dev Two" }],
|
||||
["dev-3", { id: "dev-3", name: "Dev Three" }],
|
||||
]);
|
||||
}
|
||||
Reference in New Issue
Block a user