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.
npx create typescript-app@beta
pnpx create typescript-app@beta
yarn dlx create typescript-app@beta
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
:
npx create typescript-app@beta
pnpx create typescript-app@beta
yarn dlx create typescript-app@beta
┌ ✨ create ✨││ Welcome to create: a delightful repository templating engine.││ Learn more about create on:│ https://create.bingo││ Running with mode --initialize 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
:
npx create typescript-app@beta
pnpx create typescript-app@beta
yarn dlx create typescript-app@beta
┌ ✨ create ✨││ Welcome to create: a delightful repository templating engine.││ Learn more about create on:│ https://create.bingo││ Running with mode --migrate 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:
npx create typescript-app@beta --directory my-fancy-project
pnpx create typescript-app@beta --directory my-fancy-project
yarn dlx create typescript-app@beta --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-
- Use this if you’d like to specify a package name that doesn’t begin with
- A relative path to import from: such as
npx create --from ./path/to/repository
For example, using an org-scoped package:
npx create --from @joshuakgoldberg/my-fancy-template
pnpx create --from @joshuakgoldberg/my-fancy-template
yarn dlx create --from @joshuakgoldberg/my-fancy-template
--help
Type:
boolean
Prints help text.
npx create --help
pnpx create --help
yarn dlx 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
:
npx create typescript-app@beta --mode initialize
pnpx create typescript-app@beta --mode initialize
yarn dlx create typescript-app@beta --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
:
npx create typescript-app@beta --offline
pnpx create typescript-app@beta --offline
yarn dlx create typescript-app@beta --offline
--preset
Type:
string
Which Preset to use from the template.
If not provided, create
will prompt the user to select one.
For example, specifying the common preset for create-typescript-app
:
npx create typescript-app@beta --preset common
pnpx create typescript-app@beta --preset common
yarn dlx create typescript-app@beta --preset common
--version
Type:
boolean
Prints the create
package version.
npx create --version
pnpx create --version
yarn dlx 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
:
npx create typescript-app@beta --title 'My New App'
pnpx create typescript-app@beta --title 'My New App'
yarn dlx create typescript-app@beta --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@beta --exclude-vitest