CLI (sublime)
@sublime-ui/devkit is the sublime command line. It scaffolds code, generates
the cross-platform artifacts, and drives builds for every target (web, desktop,
mobile).
Installed by @sublime-ui/devkit (bin sublime, alias sui). Run any command
with npx sublime <command> or npx @sublime-ui/devkit <command>.
A day in the life
The handful of commands a Sublime UI developer actually runs day to day:
# ── Start a session ──────────────────────────────────────────────
npm run dev:web # web app with hot reload (Vite)
# ── After editing navigation (storybook.*.ts) ────────────────────
npm run build:nav # recompile typed navigation
# …or leave it running:
npx sublime build:nav --watch
# ── Add code ─────────────────────────────────────────────────────
npx sublime make:model Post --fields "title:string, body:string"
npx sublime make:component Card
# ── Check the other targets ──────────────────────────────────────
npm run dev:desktop # Electron shell (renders the web UI)
npm run dev:mobile # Android debug build (run `sublime doctor` first)
# ── Before committing ────────────────────────────────────────────
npm run typecheck # if your app defines it; or: npx tsc --noEmit
Rule of thumb: the dev servers (
dev:web,dev:desktop) recompile navigation on everystorybook.web.ts/storybook.native.tschange, and everybuild:*compiles it up front — so generated routes and types stay in sync without runningbuild:navby hand.
Copy-paste commands
Each command in its own block — use the copy icon to grab just that one.
Create a project
npm create @sublime-ui/app@latest my-app
Scaffold a new app (prompts for name + targets), then installs everything.
Develop (hot reload)
npm run dev:web
Web app with hot reload (Vite) — navigation recompiles on every storybook change.
npm run dev:desktop
Electron shell with HMR — renders the same web UI.
npm run dev:mobile
Android debug build (run sublime doctor first).
Build for release
npm run build:web
Production web bundle → dist/web/.
npm run build:desktop
Desktop installers → dist/desktop/.
npm run build:mobile
Standalone offline Android APK → dist/mobile/.
npm run build:nav
Compile the storybooks into typed navigation.
Generate code
npx sublime make:model Post --fields "title:string, body:string"
Generate a Model (+ registerModel) and update the models barrel.
npx sublime make:component Card
Generate a cross-platform component (types + web + native + index).
npx sublime theme:init
Scaffold design tokens (tokens.json + a typed tokens.ts).
Navigation
npx sublime build:nav --watch
Recompile typed navigation on every storybook change.
Mobile toolchain
npx sublime doctor
Check the Android toolchain (Node, JDK 17, SDK, NDK, CMake).
npx sublime setup
Provision the full Android toolchain into ~/.sublime (fully automatic).
npx sublime run
Install + launch the built APK on a device or emulator.
Create a project
| Command | What it does |
|---|---|
npm create @sublime-ui/app@latest my-app | Scaffold a new app — prompts for name + targets (web / mobile / desktop), then installs everything. |
npx @sublime-ui/devkit init my-app | Same scaffolder, if you already have the CLI. |
Useful flags: --targets web,desktop · --name my-app · --no-install ·
--no-git · --force (write into a non-empty dir) · -y / --yes (accept
defaults, no prompts).
Project scripts
These live in a scaffolded app's package.json — run them with npm run <name>.
Only the scripts for the targets you selected are present.
| Script | Runs | Target |
|---|---|---|
npm run dev:web | sublime dev:web | Web dev server (hot reload + live nav) |
npm run build:web | sublime build:nav && vite build | Web production bundle |
npm run dev:mobile | sublime build --debug | Android debug build (needs Metro) |
npm run build:mobile | sublime build | Standalone Android APK (offline) |
npm run dev:desktop | sublime dev:desktop | Electron shell with HMR + live nav |
npm run build:desktop | sublime build:desktop | Desktop apps (Win/macOS/Linux) |
npm run build:nav | sublime build:nav | Compile storybooks → typed navigation |
All three targets follow the same shape: dev:<target> to run,
build:<target> to package.
The navigation layer is generated (and git-ignored), so you almost never run
build:nav by hand: dev:web and dev:desktop compile it on startup and
keep watching the storybooks — recompiling on every change — while every
build:* (including sublime build for mobile) compiles it once up front.
Where your builds go
Every build:* command writes its final artifact into a single dist/ folder
at the project root — one subfolder per platform, so all your release outputs live
in one place:
| Command | Destination | Contents |
|---|---|---|
npm run build:web | dist/web/ | Static site — index.html + hashed assets/ |
npm run build:desktop | dist/desktop/ | Portable apps — .zip (Win/macOS), .deb, .rpm (Linux) |
npm run build:mobile | dist/mobile/ | The signed .apk (or .aab when you pass --aab) |
dist/ is git-ignored. Desktop and mobile produce intermediate native build trees
along the way (desktop/out, desktop/.webpack, android/) — those stay in place,
but the finished artifacts are copied into dist/ for you, so you only ever need to
look in one folder.
Command reference
Scaffolding & code generation
| Command | What it does |
|---|---|
sublime init [dir] | Scaffold a new app (same as npm create @sublime-ui/app). |
sublime make:model <Name> [--fields "a:string,b:number"] [--resource /path] [--force] | Generate a Model (+ registerModel) and update the models barrel. |
sublime make:component <Name> [--mobile-only] [--force] | Generate a cross-platform component (types + web + native + index). |
sublime theme:init [--force] | Scaffold design tokens (tokens.json + a typed tokens.ts). |
Navigation
| Command | What it does |
|---|---|
sublime build:nav [--watch] [--force] [--project <path>] | Compile storybook.web.ts / storybook.native.ts into navigation.tsx, navigation.native.tsx, a typed route map (routes.d.ts), and an index barrel. --watch rebuilds on change. These four files are git-ignored build artifacts; dev:web / dev:desktop / build run this for you, so you rarely call it directly. |
Web (Vite)
| Command | What it does |
|---|---|
sublime dev:web [--project <path>] | Run the Vite dev server, compiling navigation first and recompiling it on every storybook change. |
Desktop (Electron Forge)
| Command | What it does |
|---|---|
sublime dev:desktop [--project <path>] | Run the Electron shell in development (Forge start + HMR), with live navigation recompilation. Aliased as desktop:dev. |
sublime build:desktop [--project <path>] | Build the desktop app (Forge make) → dist/desktop/. Aliased as desktop:build. |
Mobile (offline Android)
| Command | What it does |
|---|---|
sublime doctor | Check the Android toolchain (Node, JDK 17, SDK, NDK, CMake) — a ✓/✗ table. Managed pieces show a (managed) source. |
sublime setup | Provision the full Android toolchain into ~/.sublime — fully automatic on Windows, macOS, and Ubuntu (see below). |
sublime build [--release|--debug] [--aab] [--project <path>] | Compile navigation, then build a standalone Android APK fully offline → dist/mobile/. --release (default) embeds the JS bundle; --debug needs Metro; --aab makes a Play Store bundle. |
sublime run [--device <id>] [--project <path>] | Install and launch the built APK on a device/emulator. |
Environment setup (sublime setup)
sublime setup installs the full Android toolchain into ~/.sublime
(jdk-17/ and android-sdk/) on Windows, macOS, and Linux. It needs no admin
rights and changes no environment variables — sublime doctor and sublime build find the managed toolchain automatically. Re-running setup is safe; it
resumes from the first missing piece.
It provisions JDK 17, the Android cmdline-tools (with licenses accepted),
platform-tools, the android-35 platform, build-tools;35.0.0, NDK
27.1.12297006, and CMake 3.22.1 — showing a download progress bar and numbered
phases as it goes. sublime doctor then reports each managed piece with a
(managed) source, and sublime build produces an APK (or sublime build --aab an AAB) with no further configuration.
See also
- Scaffold a New App — the full first-app walkthrough.
- Running your app — per-platform run details.
- Common Errors & Fixes — when a command misbehaves.
- Building for mobile — offline Android builds in depth.
- Packaging the desktop app — Electron Forge installers in depth.