Alt description missing in image
Beta: Plugins coming soon!
Code Generators
Alt description missing in image

Codegen with Turbo Generators

Using generators programmatically

Bypassing prompts in the terminal

Any generator in the project can be called from the terminal with pre-filled answers to the prompts. This will bypass the question being asked.

npx turbo gen <generator-name> --args <answer-1> <answer-2> <answer_3> ...

This also works with some of the npm scripts predefined in the project, but you’ll need to pass the -- argument to separate the npm script arguments from the npm command line arguments, e.g.:

npm run add:schema -- --args <workspacePath> <name> <description>

Take note that the order of the arguments is important.

Pass them in the order they are defined as prompts in the generator / asked without providing them.

If you pass too little arguments, the generator will simply ask you to answer the rest of the questions.

You can also pass _ instead of an answer to an argument to still have that specific question asked, e.g:

npx turbo gen <generator-name> --args <answer-1> _ <answer_3> ...
npm run add:schema -- --args 'packages/@app-core' _ 'Some New Schema'
 
>>> ? What is the name of the schema?