Execution
Template CLIs will automatically detect which execution mode it is being run in:
- Setup: Creating a new repository from a template
- Transition: Updating an existing repository to a new version of a template
See --mode
for a CLI flag to explicitly tell Bingo a mode to run in.
Setup Mode
Creates a new repository from a template. This mode will be used by default if the current directory is empty.
When running a Bingo template in setup mode, it will:
- Create a new repository on GitHub
- If the template defines an
about.repository
, the repository will include a generated from notice pointing to that template repository
- If the template defines an
- Run the template to generate a list of files, network requests, and shell commands
- Add that new repository as the
origin
remote - Apply the template’s creations to the repository
- Force-push a single commit with the new repository contents to that origin
For example, to generate a new repository using create-typescript-app
:
npx create-typescript-app@beta
pnpx create-typescript-app@beta
yarn dlx create-typescript-app@beta
┌ ✨ create-typescript-app@2.0.0 ✨││ Learn more on: https://github.com/JoshuaKGoldberg/create-typescript-app││ Running with mode --setup for a new repository.
You can force running in setup mode in a non-empty directory with --mode setup
:
npx create-typescript-app@beta --mode setup
pnpx create-typescript-app@beta --mode setup
yarn dlx create-typescript-app@beta --mode setup
Transition Mode
Updates an existing repository to a new version of a template.
This mode will be used by default if the current directory is a Git repository and/or contains a create-example.config.*
configuration file.
When running a Bingo template in transition mode, it will:
- Check if the repository is freshly cloned from the template’s GitHub template repository
- If it is, remove all local files and Git history
- Run the template to generate a list of files, network requests, and shell commands
- If this was a fresh template repository clone, create and push an initial commit
- Apply the template’s creations to the repository
For example, to update an existing repository to the latest create-typescript-app
:
npx create-typescript-app@beta
pnpx create-typescript-app@beta
yarn dlx create-typescript-app@beta
┌ ✨ create-typescript-app@2.0.0 ✨││ Learn more on: https://github.com/JoshuaKGoldberg/create-typescript-app││ Running with mode --transition for an existing repository.
You can force running in transition mode in a non-Git directory with --mode transition
:
npx create-typescript-app@beta --mode transition
pnpx create-typescript-app@beta --mode transition
yarn dlx create-typescript-app@beta --mode transition
Transition mode can be used even if the repository wasn’t built with the template being transitioned to. Templates can include specific logic to migrate existing repositories onto their tooling.