Workspace starters are pre-configured templates that you can use to scaffold a new workspace.
Use the `new` command to use a starter. For example:
Starters may include various items that can help you quickly create standardized projects. Some ideas for what starters may contain:
- Pre-configured
workspace.jsonc
. - Pre-configured dependencies.
- Imported or forked starter components.
And anything else you may need to get started quickly and consistently.
To create a workspace starter we recommend starting from forking one of the default starters:
Now you can modify and maintain your own starter.
To add to your custom dev environment, add an import
statement and register to the array of starters:
import { ReactWorkspaceStarter } from '@my-org/my-scope.templates.my-custom-starter'; export class MyReactEnv extends ReactEnv { starters() { return StarterList.from([ReactWorkspaceStarter.from({})]); } }
info
Make sure to run bit compile
after adding the new starters - you can run bit watch
to automatically compile on changes.
You can locally test your starters, before exporting, by running bit new
with the path to your starter location.
bit new my-template-name my-new-workspace-name --aspect the-env-that-registers-starter --load-from path/to/workspace-with-template-env
info
In order to test your starter, you will need to have added your custom environment to the generator config in the workspace.jsonc of the workspace linked to in the bit new
command.
{ "teambit.generator/generator": { "envs": ["my-org.my-scope/envs/my-react-env"] } }