Add Page
Scaffold a new frontend page with index.html|css and, unless you pass --no-script, index.ts under src/frontend/pages/<name>/.
Purpose
- Create a new routed page quickly with the expected files.
- Ensure the page follows conventions used by build and publish.
When To Use
- Adding a new top-level page in the app.
CLI
webstir add-page <name> --workspace <path> [--no-script]
Notes
- Frontend only: this command scaffolds files under
src/frontend/pages/and does not touch backend or shared code. - In an app with a server, document pages live here while form handlers, redirects, and auth stay in
src/backend/module.ts. - Internals: the CLI calls the canonical
@webstir-io/webstir-frontendscaffold helper so generated files stay in sync with the framework templates. --no-scriptscaffolds a JS-free page (noindex.tsand no module script tag); addindex.tslater withwebstir enable scripts <page>if the page needs JavaScript.- An app without pages has nowhere to put one: run
webstir enable frontendfirst. - Standard page source lives in
index.ts, but the HTML module script must referenceindex.js. Build and publish resolve that browser-safe name to the compiled or fingerprinted bundle; do not point HTML directly atindex.ts.
Inputs
<name>: one portable page-directory name, without path separators. Empty names,./.., control characters, and platform-reserved names or characters are rejected. If the page already exists, the workflow fails.--no-script: scaffold the page withoutindex.ts.
Steps
- Validate
<name>and resolvesrc/frontend/pages/<name>/. - Call the
@webstir-io/webstir-frontendhelper to create page files from the canonical scaffold. - Pick the standard page shape, or the JS-free shape with
--no-script.
Outputs
- New page folder and files under
src/frontend/pages/<name>/. - Standard pages contain
index.tsand<script type="module" src="index.js">. - Picked up automatically by
build,watch, andpublish.
Errors & Exit Codes
- Non-zero if the page exists, the name is invalid, or file IO fails.