Back to Turborepo

generate

apps/docs/content/docs/reference/generate.mdx

2.9.152.2 KB
Original Source

Extend your Turborepo with new apps and packages.

bash
turbo generate

For more information and practical use cases for writing custom generators, visit the "Generating code" guide.

<Callout type="info"> `turbo gen` is an alias for `turbo generate`. Additionally, `run` is the default command so `turbo gen` is equivalent to `turbo generate run`. </Callout>

run [generator-name]

Run custom generators defined in your repository.

bash
turbo gen run [generator-name]

Flag options

--args

Answers to pass directly to the generator's prompts.

--config <path>

Generator configuration file.

Default: turbo/generators/config.js

--root <path>

The root of your repository

Default: directory with root turbo.json

workspace

Create a new workspace.

bash
turbo gen workspace [options]

Flag options

--name <name>

The name for the new workspace to be used in the package.json name key. The name key is the unique identifier for the package in your repository.

--empty

Creates an empty workspace. Defaults to true.

--copy <name>/<url>

Name of local workspace within your monorepo or a fully qualified GitHub URL with any branch and/or subdirectory.

--destination <path>

Where the new workspace should be created.

--type <app/package>

The type of workspace to create (app or package).

--root <path>

The root of your repository. Defaults to the directory of the root turbo.json.

--show-all-dependencies

Prevent filtering dependencies by workspace type when selecting dependencies to add.

--example-path <path>, -p <path>

In a rare case, your GitHub URL might contain a branch name with a slash (e.g. bug/fix-1) and the path to the example (e.g. foo/bar). In this case, you must specify the path to the example separately.