Parent: F8 (PWA). Self-contained; no backend dependency.
Recipe
- Adopt
vite-plugin-pwa (in vite.config.ts) — it generates the manifest, registers the service worker, and handles Workbox precaching of the built shell. Config:
registerType: 'prompt' (NOT autoUpdate): an art tool must never swap code under an unsaved drawing session. Show a small "Update available — restart" toast wired to needRefresh from virtual:pwa-register.
- Precache: all built assets (default
globPatterns). navigateFallback: 'index.html' for offline SPA loads.
NetworkOnly / no runtime caching for any future API origin — add the rule now with a comment pointing at F2 (sync must never be served stale by the SW).
- Manifest: name "Pixel Forge",
display: 'standalone', theme/background colors from the app's dark UI, icons 192/512 + maskable (generate from the app logo into public/icons/; create a simple pixel-art icon if none exists).
- Install prompt UX: listen for
beforeinstallprompt, stash the event, surface a menu item "Install app" in pf-menu-bar.ts (hidden when already installed / event unavailable). No nagging banners.
- Update flow test plan (manual, document in the PR): deploy A → install → deploy B → toast appears → restart loads B; offline: devtools offline → reload → app loads and edits persist to IndexedDB.
- CI: build must fail loudly if SW generation breaks (
vite build already covers this once the plugin is in).
Acceptance
- Lighthouse PWA installability checks pass.
- Full offline session works: launch offline, draw, auto-save, reload offline, work is there.
- Updates require explicit user confirmation; no stale-forever cache and no mid-session code swap.
Parent: F8 (PWA). Self-contained; no backend dependency.
Recipe
vite-plugin-pwa(invite.config.ts) — it generates the manifest, registers the service worker, and handles Workbox precaching of the built shell. Config:registerType: 'prompt'(NOTautoUpdate): an art tool must never swap code under an unsaved drawing session. Show a small "Update available — restart" toast wired toneedRefreshfromvirtual:pwa-register.globPatterns).navigateFallback: 'index.html'for offline SPA loads.NetworkOnly/ no runtime caching for any future API origin — add the rule now with a comment pointing at F2 (sync must never be served stale by the SW).display: 'standalone', theme/background colors from the app's dark UI, icons 192/512 + maskable (generate from the app logo intopublic/icons/; create a simple pixel-art icon if none exists).beforeinstallprompt, stash the event, surface a menu item "Install app" inpf-menu-bar.ts(hidden when already installed / event unavailable). No nagging banners.vite buildalready covers this once the plugin is in).Acceptance