Files
KomediruzeckiandGitHub 10d6521e32 feat(pwa): offer to install the app, from a kit that can leave this repo (#420)
The service worker has been live in production all along — sw.js is served, the
manifest is linked, the app is installable in principle. There has simply never
been anywhere to press. Chrome's own mini-infobar is the only thing that ever
offered it, and it is easy to miss and easier to dismiss forever.

Ported from mercurypitch rather than invented, and put in packages/pwa-kit with
no imports from the app that uses it, so lifting it into its own repository
later is a filter-repo and a publish. solid-js is a peer dependency; the tests
live with the kit and run under the frontend's vitest, so CI covers them today
and they move unchanged when the package does.

The listener has to be installed before first render: beforeinstallprompt fires
early, is never replayed, and the event object is the only handle on the native
sheet. Miss it and the app can never offer installation at all.

What the component does NOT do is the point. It renders nothing unless one of
three questions says yes, so there is no Install button on desktop Firefox, none
inside an already-installed window, and on iOS — where no page can trigger an
install — a Share-menu instruction instead of a button that would do nothing.
iPadOS calls itself a Mac, so that check falls back to touch points, and iOS
Chrome is excluded because it is WebKit underneath but still cannot add to the
home screen.

Manifest gains an id. Without one the identity comes from start_url, so changing
that later reads as a different app and offers a second install beside the
first. public/manifest.json is deleted: nothing has linked it since VitePWA
started generating the real one, and its short_name disagreed with it.

The service-worker half — registration, the update prompt, and the caching rules
that caused the reload loop — is the risky part and is deliberately not in here.
2026-08-23 22:47:53 +02:00

15 lines
312 B
JSON

{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"jsx": "preserve",
"strict": true,
"verbatimModuleSyntax": true,
"skipLibCheck": true,
"noEmit": true
},
"include": ["src", "test"]
}