Reference
CLI reference
One command line drives every project type. It reads the same Blueprint your app does, so the commands available reflect the adapters you stacked, not a fixed list.
#Commands
| Command | Alias | What it does |
|---|---|---|
| stone serve | dev | Start the development server with hot reload. |
| stone build | prod | Produce the production build for your configured target. |
| stone preview | p | Serve the production build locally. |
| stone export | e | Emit the static output (SSG) to disk. |
| stone list | ls | List the routes and commands the Blueprint resolves. |
| stone init | i | Scaffold a new project into the current directory. |
| stone typings | t | Generate the .stone/ type declarations (add --watch). |
| stone cache-clear | cc | Clear the build cache. |
| stone <custom> | · | Run a handler exposed as a CLI command (node-cli-adapter). |
Names and aliases are interchangeable: stone dev is stone serve, stone prod is stone build. The list is not fixed. It grows with the adapters you stack, because each command is itself a handler the CLI adapter resolves from the Blueprint.
#Flags
| Flag | On | What it does |
|---|---|---|
--ssg | build, export | Force static generation, regardless of the configured rendering mode. |
--rendering, -r | serve, build | Pick the rendering mode for this run: csr, ssr or ssg. |
--lazy | build | Build lazily: emit only what the entry actually reaches. |
--imperative, -i | serve | Run against the imperative entry instead of the decorated one. |
--language, -lang | serve, build | Target language for the build (ts or js). |
--target, -t | preview | Which built target to preview. |
--starters, -s | init | Pick a starter template for the new project. |
--yes, -y / --force, -f | init | Skip prompts / overwrite an existing directory. |
--watch, -w | typings | Regenerate declarations on change. |
A flag is a shortcut over the Blueprint: --ssg is the same decision as stone.builder.rendering = 'ssg', taken for one run instead of written into config.
#Typical flow
npm create @stone-js@latest my-app # scaffold
cd my-app && npm install
npm run dev # stone dev
npm run build # stone build
npm run preview # stone preview#The codegen directory
The CLI generates a .stone/ directory during a build: the entry that discovers your modules, and the wiring for the chosen target. It is derived output, safe to delete, and regenerated on the next build. Do not edit it or commit it.