Create projects with official generators and declarative JSON presets.
English | 简体中文
Node.js and a package manager are required for official generators. Git is required for presets that clone a repository.
Run the interactive flow through npm's package runner:
npm create presetThe flow asks for a project directory, technology stack, and starter. The selected official CLI owns the remaining prompts and generated files.
For repeated use, install the package globally:
npm install --global create-preset
preset# List available starter IDs
preset --list
# Select a starter interactively
preset
# Create from a registered official or private preset
preset init my-app --from vite
# Create from a local or remote preset.json
preset init my-docs --from ./preset.json
preset init my-docs --from https://example.com/preset.json
# Choose the package manager used by an official generator
preset init my-app --from vue --package-manager pnpm
# Preview a generator or JSON preset without creating a project
preset init my-app --from vite --dry-run
preset init my-docs --from ./preset.json --dry-run
# Explicitly allow replacing an existing directory in a script
preset init my-app --from vite --yes
# Inspect or change the private preset manifest
preset config get
preset config set /path/to/private-presets.json
preset config remove
# Update a global installation
preset upgrade--from accepts an official generator ID, a private preset name, or a
.json config path or URL. The --package-manager option accepts npm,
yarn, pnpm, and bun. Without that option, Create Preset detects the
package manager from the current npm user agent and falls back to npm.
An unknown explicit --from value exits with an error; it never switches to
interactive selection. Run preset --list to see registered IDs.
--dry-run prints a JSON creation plan without cloning repositories, running
generators, resolving npm versions, or changing project files. Remote config
URLs are still fetched and validated. --yes skips only the confirmation for
replacing existing target files; official generators keep their own prompts.
Private presets are generated in a temporary directory before replacing the target. Original target files are backed up while an official generator runs and restored if it fails or exits without creating a project.
Official generators remain responsible for their own prompts, dependencies, and output. Create Preset currently exposes these IDs:
| Technology | IDs |
|---|---|
| Vue | vue, nuxt |
| React | next-app, react-router, expo-app |
| Vite | vite |
| Astro | astro |
| Svelte | svelte (SvelteKit) |
Direct selection is useful for scripts and documentation examples:
preset init demo --from next-app --package-manager npmPrivate presets add repository starters or declarative configs to the interactive catalog. Bind one manifest file globally:
preset config set /path/to/private-presets.json
preset init company-servicePrivate entries appear before built-in generators in the same technology stack, and custom technology IDs are supported. The manifest can use a simple array or a versioned object when a custom label or color is needed. See Private presets.
A project can publish a preset.json without maintaining another CLI. The
config describes a repository source and the transformations needed to turn a
starter into a new project:
preset init my-docs --from https://example.com/preset.jsonSupported operations include selecting a monorepo directory, excluding files,
writing files, replacing text, merging JSON, and resolving workspace:
dependencies. See Preset configs and the published
schema.
The CLI follows the system locale and includes English, Simplified Chinese,
Traditional Chinese, and Japanese. Set PRESET_LANG to override detection:
PRESET_LANG=ja-JP preset init demoSupported values are en-US, zh-CN, zh-HK, and ja-JP; common locale
variants map to the same four translations. After delegation, the official
generator controls its own locale.
Version 1 builds the official generator catalog into the binary. The remote
tech, official, and community lists are no longer downloaded.
The legacy --template option remains available only to print a migration
notice. Replace it with --from:
preset init old-demo --from vueThe preset proxy command and the config --tech, localTech, and mirror
settings were removed. Official generators use the selected package manager's
registry configuration. Private presets should point to a repo or config
source that is reachable from the execution environment.
- Getting started
- Private presets
- Preset configs
- Local verification
- Website development and deployment
Choose an issue form to report a bug, submit a showcase, suggest a feature, improve documentation, or ask a usage question. English and Chinese submissions are welcome.
MIT License © 2022 chengpeiquan