Skip to content

CLI

The create CLI is what you run to generate a new repository or migrate an existing one. It will interactively prompt you for any options it needs to run that can’t be inferred from disk.

Terminal window
npx create typescript-app

Modes

The create CLI will automatically detect which --mode it is being run in:

  • Initialization: Creating a new repository from a template
  • Migration: Updating an existing repositories to a new version of a template

Initialization Mode

Creates a new repository from a template. This mode will be used by default if the current directory is empty.

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

Terminal window
npx create typescript-app
┌ ✨ create ✨
│ Welcome to create: a delightful repository templating engine.
│ Learn more about create on:
│ https://create.bingo
│ Running with mode --create for a new repository using the template:
│ create-typescript-app
|

Migration 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.config.* configuration file.

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

Terminal window
npx create typescript-app
┌ ✨ create ✨
│ Welcome to create: a delightful repository templating engine.
│ Learn more about create on:
│ https://create.bingo
│ Running with mode --create for an existing repository using the template:
│ create-typescript-app
|

Flags

The first argument passed to create can be a shorthand --from](#-f----from) for an npm package default-exporting a Template. A shorthand name excludes the create- prefix to an npm package name that starts with create-.

--directory

Type: string

What local directory path to run under.

If not provided:

  • If the current directory is empty, defaults to it (.)
  • Otherwise, you’ll be prompted to input one

For example, creating a new repository in a subdirectory:

Terminal window
npx create typescript-app --directory my-fancy-project

--from

Type: string

An explicit package or path to import a template from.

This can be either:

  • A full npm package name, such as create-typescript-app
    • Use this if you’d like to specify a package name that doesn’t begin with create-
  • A relative path to import from: such as npx create --from ./path/to/repository

For example, using an org-scoped package:

Terminal window
npx create --from @joshuakgoldberg/my-fancy-template

--help

Type: boolean

Prints help text.

Terminal window
npx create --help

--mode

Type: string

Which mode to run in.

If not provided, it will be inferred based on whether create is being run in an existing repository.

For example, specifying creating a new repository with create-typescript-app:

Terminal window
npx create typescript-app --mode initialize

--offline

Type: boolean

Whether to run in an “offline” mode that skips network requests.

If provided, templates will be told not to make any network requests. That often means they will install from offline caches, skip creating a repository on GitHub, and skip sending GitHub API requests. The repository will roughly be a local-only creation.

For example, specifying creating a new repository offline with create-typescript-app:

Terminal window
npx create typescript-app --offline

--preset

Type: string

Which Preset to use from the template.

If not provided, and the template defines multiple presets, create will prompt the user to select one.

For example, specifying the common preset for create-typescript-app:

Terminal window
npx create typescript-app --preset common

--version

Type: boolean

Prints the create package version.

Terminal window
npx create --version

Template Options

The template being generated from may add in additional flags.

For example, if a template defines a title option, --title will be type string:

Terminal window
npx create typescript-app --title 'My New App'

Any required options that are not provided will be prompted for by the create CLI.

See the documentation for your specific template for additional flags.

Block Exclusions

Individual Blocks from a template may be excluded with --exclude-* flags, where * is the kebab-case name of the Block.

For example, if a Block is named Vitest, its exclusion flag would be --exclude-vitest:

npx create typescript-app --exclude-vitest
Made with 💝 in Boston by Josh Goldberg.