feat(generators): add core-package entry + dispatch table (empty)
Registers pnpm turbo gen core-package with an empty choices list and a dispatch table that throws for unknown names. Adds vitest config + test script to turbo/generators and adds it to the pnpm workspace so tests run via pnpm --filter @repo/turbo-generators test. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -491,6 +491,38 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Turbo generator: `core-package`
|
||||
*
|
||||
* Scaffolds an optional core package back into a slimmed template. Each
|
||||
* name maps to a verbatim snapshot of the package captured at generator-add
|
||||
* time. Phases 3-6 each register one entry in CORE_PACKAGE_GENERATORS.
|
||||
*/
|
||||
const CORE_PACKAGE_GENERATORS: Record<string, () => PlopTypes.ActionType[]> =
|
||||
{
|
||||
// Phases 3-6 each insert one entry here.
|
||||
};
|
||||
|
||||
plop.setGenerator("core-package", {
|
||||
description: "Scaffold an optional core package (realtime, events, trpc, ui)",
|
||||
prompts: [
|
||||
{
|
||||
type: "list",
|
||||
name: "name",
|
||||
message: "Which optional core package?",
|
||||
choices: [],
|
||||
},
|
||||
],
|
||||
actions: (answers) => {
|
||||
const a = answers as { name: string };
|
||||
const handler = CORE_PACKAGE_GENERATORS[a.name];
|
||||
if (!handler) {
|
||||
throw new Error(`No generator for core-package '${a.name}'`);
|
||||
}
|
||||
return handler();
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Turbo generator: `job`
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user