Skip to content

fix(pwa): make the app installable and surface the install/update prompt - #25

Merged
DLinacre merged 2 commits into
mainfrom
arena/205abdf3-pokeguru
Nov 14, 2026
Merged

DLinacre merged 2 commits into
mainfrom
arena/205abdf3-pokeguru

Conversation

@DLinacre

Copy link
Copy Markdown
Owner

Why

The live app reports "no installable PWA available" and the install prompt never shows. Three separate causes:

  1. Stale GitHub Pages mirror. gh-pages is an August build with no manifest.webmanifest and no sw.js — the Pages SPA fallback served index.html for both paths, so anyone opening dlinacre.github.io/PokeGuru got a non-installable app. package.json homepage and the README still pointed there.
  2. Manifest scope mismatch on the Pages build. The static manifest hard-coded id: "/" while the Pages deployment lives under /PokeGuru/ — id outside scope is not installable.
  3. Lost beforeinstallprompt. The event fires once; it was only listened for after React mounted, so it could be missed entirely and the in-app install invitation could never appear.

What changed

  • Manifest is now emitted per build target from src/pwa/manifest-template.json, so id, start_url, scope, icons and shortcuts always sit inside the deployment base (/ for Vercel, /PokeGuru/ for Pages).
  • New public/pwa-capture.js, a plain external <head> script (CSP-safe) that captures beforeinstallprompt/appinstalled before React loads, stashes the event and re-broadcasts it. InstallPrompt consumes the stashed event as well as live ones.
  • package.json homepage → https://pokeguru.vercel.app; README leads with the live Vercel app and describes Pages as a secondary mirror; version bumped to 1.7.2.
  • public/.nojekyll so a Pages deploy publishes _* assets.
  • CI now asserts dist/pwa-capture.js exists and that the built manifest's id/start_url/scope agree; new tests pin manifest installability for both bases and the pre-mount capture path.

Verification

  • npm run lint, npm run typecheck, npm test → 24 files / 197 tests passing.
  • Vercel build: manifest id/start_url/scope = /, icons + shortcuts absolute under /.
  • Pages build: manifest id/start_url/scope = /PokeGuru/, SW BASE = /PokeGuru/, capture script at /PokeGuru/pwa-capture.js.

Arena Agent and others added 2 commits November 14, 2026 20:18
…manifest scope

- Emit manifest.webmanifest per build target so id/start_url/scope/icons
  stay inside the deployment base (GitHub Pages /PokeGuru/ build was
  non-installable because id was "/").
- Add public/pwa-capture.js, a plain <head> script that captures
  beforeinstallprompt/appinstalled before React mounts and re-broadcasts
  them; InstallPrompt now consumes the stashed event.
- Point package.json homepage at https://pokeguru.vercel.app, bump 1.7.2.
- Document the fixes in RELEASE_NOTES, extend CI build checks and tests.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Node cannot require() a .webmanifest extension, so the manifest
installability assertion crashed for the wrong reason. Read the file and
also assert every icon URL sits inside the manifest scope.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@DLinacre
DLinacre merged commit 89c5729 into main Nov 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant