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.
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
:
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
:
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:
--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:
--help
Type:
boolean
Prints help text.
--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
:
--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
:
--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
:
--version
Type:
boolean
Prints the create
package 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
:
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
: