create-stewie
v0.8.0
Published
Project scaffolding CLI for the Stewie framework
Maintainers
Readme
create-stewie
❗ Work in progress.
Stewie is under active development and not yet stable. APIs may change between releases. Not recommended for production use yet.
Project scaffolding CLI for Stewie. Generates a fully configured starter project with one command.
Part of the Stewie framework.
Usage
pnpm create stewie my-app
cd my-app
pnpm install
pnpm devThe CLI prompts for:
- Project name
- Mode —
static(client-only, fetches from external APIs) orssr(server-rendered) - SSR runtime (if SSR mode) —
nodeorbun - Include router — adds
@stewie-js/routerand example routes
What gets generated
All modes include:
package.jsonwith the correct@stewie-js/*dependenciesvite.config.tswith the@stewie-js/viteplugintsconfig.jsontargeting ES2022src/app.tsx— root component with a working exampleindex.html— HTML shell
SSR mode also includes:
src/server.ts— server entry using the appropriate adaptersrc/client.tsx— client hydration entryvite.config.ts— configured with SSR build environmentsstartscript for running the production server
Prerequisites
The generated vitest.config.ts sets environment: 'happy-dom'. You need to install happy-dom separately as a dev dependency in the generated project before running tests:
pnpm add -D happy-domNon-interactive CLI flags
All prompts can be answered via flags for scripted or CI use:
pnpm create stewie my-app --mode=ssr --runtime=node --router
pnpm create stewie my-app --mode=static| Flag | Values | Description |
|---|---|---|
| --mode | static, ssr | Project mode |
| --runtime | node, bun | SSR runtime (only used with --mode=ssr) |
| --router | boolean flag | Include @stewie-js/router and example routes |
Programmatic API
import { scaffoldProject, generateFiles } from 'create-stewie'
const files = generateFiles({
projectName: 'my-app',
mode: 'ssr',
ssrRuntime: 'node',
includeRouter: true,
})
await scaffoldProject('./my-app', files)