Skip to content

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:

  1. 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
  2. Run the template to generate a list of files, network requests, and shell commands
  3. Add that new repository as the origin remote
  4. Apply the template’s creations to the repository
  5. Force-push a single commit with the new repository contents to that origin

For example, to generate a new repository using create-typescript-app:

Terminal window
npx 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:

Terminal window
npx 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:

  1. Check if the repository is freshly cloned from the template’s GitHub template repository
    • If it is, remove all local files and Git history
  2. 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
  3. Apply the template’s creations to the repository

For example, to update an existing repository to the latest create-typescript-app:

Terminal window
npx 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:

Terminal window
npx 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.

Made with 💝 in Boston by Josh Goldberg.