Codegen with Plop Generators
Our Starterkit goes beyond the setup by helping you skip boilerplate code through Plop-based generators:
Using generators programmatically
Passing args from the terminal
Any generator can be run with pre-filled answers. Use npm run gen for the interactive picker, or npm run add:<generator> for a specific generator:
Positional args (order matches the prompts; --args optional):
npm run add:schema -- --args <workspacePath> <schemaName> <schemaDescription>npm run add:schema -- packages/@green-stack-core MySchema "Description"Named args (use --key value; --args is optional):
npm run add:schema -- --workspacePath packages/@green-stack-core --schemaName MySchema --schemaDescription "Description"Checkbox/array prompts support space-separated values:
npm run add:workspace -- --workspaceStructure schemas resolvers componentsIf you pass too few arguments, the generator will prompt for the rest. Pass _ with --args to explicitly ask for a specific question:
npm run add:schema -- --args 'packages/@app-core' _ 'Some New Schema'
>>> ? What is the name of the schema?