CharaChorder Device Manager ("dotio"): SvelteKit 5 (runes, @sveltejs/adapter-static) SPA + PWA that also ships as a Tauri 1 desktop app. One codebase, two build targets; all app logic runs in the browser (no SvelteKit server code — routes are prerendered, fallback 404.html).
- NixOS/flake dev shell:
nix develop(direnvuse flakeis set up). It provides Node 22, pnpm, Rust, and the Python fonttools env. - Requires Node >= 22.14 and pnpm >= 10.7 (package.json engines). Install deps with
pnpm install.
pnpm dev— Vite dev server plus the typesafe-i18n watcher in parallel. Don't run barevite dev:src/i18nis generated code (base localeen); it must be generated/watched.pnpm build— generates i18n once (typesafe-i18n --no-watch), thenvite build.pnpm test—vitest run --coverage. Tests are colocated as*.spec.tsnext to their source insrc/lib(e.g.src/lib/versioning.spec.ts).- Single test file:
pnpm vitest run src/lib/serial/chord.spec.ts; single test:pnpm vitest run -t "name". - Tests run in jsdom;
$app/environmentis aliased totest/stubs/app-environment.ts, so tests can't rely on the real SvelteKit runtime.
- Single test file:
pnpm check—svelte-kit sync && svelte-check. Run after structural/import changes;.svelte-kittypes must exist.pnpm lint/pnpm format— Prettier only (svelte + css-order plugins). Stylelint config exists but has no script and is not run in CI.
src/lib/assets/icons.min.woff2is gitignored and generated: runpnpm minify-iconsbeforepnpm build(CI doesminify-icons→build). Needs Python fonttools/brotli (pip install -r requirements.txt); the flake provides it asfontMin.- Custom Vite plugins transform custom file types in-place — no on-disk codegen to look for:
*.grammar(Lezer, e.g.src/lib/chord-editor/chords.grammar) → generated parser viavite-plugin-lezer.ts.*.layout.yml(src/lib/assets/layouts/) → compiledCompiledLayoutTS viavite-plugin-layout.ts.- Regular YAML is importable via
vite-plugin-yaml, except*.layout.yml(handled by the layout plugin).
- Target split is keyed on the
TAURI_FAMILYenv var invite.config.ts: Tauri builds exclude the PWA plugin; PWA builds target chrome114/safari16 (Web Serial/USB APIs).
pnpm dev:tauri(tauri dev, which boots the web dev server viabeforeDevCommand);pnpm build:taurifor packaging. Needs the Rust toolchain + webkitgtk/gtk3 (in the flake).- Serial in Tauri goes through the Rust extension (
src/lib/serial/tauri-serial.ts), notnavigator.serial; web path usesnavigator.serial/navigator.usbdirectly (src/lib/serial/connection.ts).
- Don't edit versions in three files by hand:
pnpm version <x>(theversionscript,src/tools/version.js) syncssrc-tauri/tauri.conf.jsonandsrc-tauri/Cargo.tomlfrompackage.jsonandgit adds them. - Tags drive CI:
v*→ website build + rsync deploy (.github/workflows/build.yml);desktop-app-v*→ Tauri desktop release on all platforms (.github/workflows/publish.yml).
- Routes live in
src/routes/(app)/(config, ccos, editor, recipes, terminal, sandbox). Device/connection logic is insrc/lib/serial/; chord editing insrc/lib/chord-editor/; backup/compat (legacy format migrations) insrc/lib/backup/. - UX rules from CONTRIBUTING.md: opinionated (never two ways to do one thing), self-explanatory UI, no useless buttons. UI is Material 3.