@black-magic/create-craft-site
v0.1.11
Published
Interactive CLI to scaffold a CraftCMS project with DDEV
Keywords
Readme
@black-magic/create-craft-site
Interactive CLI to scaffold a CraftCMS project with DDEV.
Requirements
- DDEV v1.23+
- Node.js 18+
Usage
npm create craft-site@latest
# or
npx @black-magic/create-craft-siteWith a config file (zero-prompt)
npx @black-magic/create-craft-site --config=./craft-site.config.jsonWhat it does
New project flow:
- Creates the project directory
- Runs
ddev config(PHP 8.4, MySQL 8.0, docrootpublic_html) - Patches
.ddev/config.yaml— adds Vite port exposure andupload_dirs - Installs the
tyler36/ddev-vscode-devcontainerDDEV add-on ddev restart- Downloads CraftCMS via Composer (non-interactive mode)
- Moves
web/→public_html/and removesweb/ - Runs
ddev craft installnon-interactively - Vite setup (optional, default yes):
- Downloads
wearealloy/craft-site-scaffoldingand copies files - Merges
.env.examplevars and.gitignoreentries ddev composer require nystudio107/craft-viteddev craft plugin/install vitenpm install --save-dev vite typescript tailwindcss @tailwindcss/vite prettier+ plugins
- Downloads
Existing project flow:
git cloneinto the target directory- Reads PHP/DB versions from
.ddev/config.yaml - Patches config + installs add-on +
ddev restart ddev composer install- Optional DB restore
- Optional Vite setup (same as above)
Config file
Provide a craft-site.config.json (or .yaml / .yml) to skip all prompts:
{
"docroot": "public_html",
"phpVersion": "8.4",
"dbVersion": "mysql:8.0",
"siteName": "My Site",
"adminEmail": "[email protected]",
"adminUsername": "admin",
"adminPassword": "secret",
"language": "en",
"setupVite": true
}Or pass an explicit path:
npx @black-magic/create-craft-site --config=./path/to/config.jsonCLI flags
| Flag | Description |
| --------------------- | -------------------------------------- |
| --config=<path> | Path to a config file |
| --php-version=<ver> | Override PHP version (e.g. 8.3) |
| --db-version=<ver> | Override DB version (e.g. mysql:8.0) |
Development
pnpm install
pnpm build # compile to dist/
pnpm dev # watch mode
pnpm typecheck # tsc --noEmit
pnpm lint # eslintRun locally:
node dist/index.js
node dist/index.js --config=./craft-site.config.jsonDocumentation
- Plans — implementation plans and architecture notes
- Craft quickstart — manual DDEV + Craft reference
