Set up a workspace starter

Standalone starters (or plugin-based starters) can be used without any special setup.

To set up an env-dependent starter, follow the steps below:

  1. Install the starter in the workspace that maintains the env (which will be used to register it):
$bit
Copiedcopy
  1. Set the generator in the relevant env:
/* @filename: my-env.bit-env.ts */

import { StarterList } from '@teambit/generator';
/* import the starter */
import { ReactWorkspaceStarter } from '@teambit/react.generator.react-starters';

export class MyEnv{
    starters() {
        return StarterList.from([ReactWorkspaceStarter.from({})]);
    }
}
CopiedCopy
  1. Export the env and the starter.

Change your starter configuration

  • name: the generator's name
  • description: the generators description
  • hidden: display the generator only when running bit templates --show-all
  • env: set the generated components with this env (component id)
starters() {
    return StarterList.from([
      ReactEnvWorkspaceStarter.from({
        name: 'my-custom-name',
        description: 'My custom starter description',
      }),
    ]);
  }
CopiedCopy