Create an app
create-lit-material-appCLI starter
Scaffolds a new app with lit-material, the router,
the store, and core's
theme context already wired together: a starting point that runs, not just a components library.
Usage
npm create lit-material-app my-app
cd my-app
npm install
npm run dev
(Omit my-app to scaffold into ./my-lit-material-app.)
What you get
my-app/
├─ index.html
├─ package.json
├─ tsconfig.json
└─ src/
├─ main.ts # imports tokens CSS + the app shell
├─ app-shell.ts # provides the theme context, defines routes, hosts the router outlet
├─ store.ts # one module-level store instance (a counter, to start)
├─ home-page.ts # a route reading both the store and the theme context
└─ about-page.ts # a second route, to show the router actually routing
A real, buildable Vite project depending on the actual published @lit-material/*
packages (not workspace:*: this isn't part of the lit-material monorepo, it's a
standalone app). Add more routes to app-shell.ts's routes array, more
reducer cases to store.ts, and more components with
npm install @lit-material/<component> as you grow it. See the
Building apps guide for @lit-material/task (data
fetching) and @lit-material/form (validation) wired into the same shape once you need
them.
Why written by hand instead of a scaffolding framework?
The same reasoning the router gives for writing its own path matching instead of depending on
@lit-labs/router. The actual need here (copy a template directory, substitute one
placeholder, print next steps) doesn't need commander/inquirer/a
templating engine. The CLI uses only modules built into Node (fs/path/url).