Enable full PWA install experience in all web modes

- Add PWAInstallPrompt component for custom install UI and event handling
- Register PWAInstallPrompt in App.vue for global visibility
- Enable PWA features and install prompt in dev, test, and prod (vite.config.web.mts)
- Update service worker registration to work in all environments
- Update docs/build-web-script-integration.md with PWA install guidance and visual cues
- Add scripts/build-web.sh for unified web build/dev workflow

PWA is now installable and testable in all web environments, with clear user prompts and desktop support.
This commit is contained in:
Matthew Raymer
2025-07-11 04:41:38 +00:00
parent 8b95cc8d2b
commit 26f303bae9
12 changed files with 4443 additions and 22 deletions

View File

@@ -2,13 +2,9 @@
import { register } from "register-service-worker";
// Only register service worker if:
// 1. PWA is explicitly enabled
// 2. In production mode
if (
process.env.VITE_PWA_ENABLED === "true" &&
process.env.NODE_ENV === "production"
) {
// Register service worker if PWA is enabled
// Enable in all environments for consistent testing and functionality
if (process.env.VITE_PWA_ENABLED === "true") {
register(`${process.env.BASE_URL}sw.js`, {
ready() {
console.log("Service worker is active.");
@@ -36,10 +32,6 @@ if (
});
} else {
console.log(
`Service worker registration skipped - ${
process.env.VITE_PWA_ENABLED !== "true"
? "PWA not enabled"
: "not in production mode"
}`,
`Service worker registration skipped - PWA not enabled (VITE_PWA_ENABLED=${process.env.VITE_PWA_ENABLED})`,
);
}