@davoodmehraban89 / LifeMate / commits / 0a835d9
Fork 0

LifeMate — Personal, Family & Learning Companion

feat(cloudflare): pinned Flutter Pages QA builder

davoodmehraban89 committed Oct 15, 2026 at 07:44 UTC 0a835d9f0c79a2b7ea2a81e26adcaa99a1ea7427
1 file changed +42
scripts/build-cloudflare-pages-qa.sh new
+42
@@ -0,0 +1,42 @@
1 +#!/usr/bin/env bash
2 +# LifeGuide v0.7.1 QA PWA -> Cloudflare Pages. This DOES NOT deploy the backend.
3 +set -Eeuo pipefail
4 +cd "$(dirname "$0")/.."
5 +export CI=true
6 +FLUTTER_VERSION="3.47.6"
7 +FLUTTER_ROOT="${HOME}/.lifeguide-qa-flutter"
8 +if [[ ! -x "${FLUTTER_ROOT}/bin/flutter" ]]; then
9 + git clone --quiet --depth 1 --branch "${FLUTTER_VERSION}" https://github.com/flutter/flutter.git "${FLUTTER_ROOT}"
10 +fi
11 +export PATH="${FLUTTER_ROOT}/bin:${PATH}"
12 +flutter config --no-analytics >/dev/null
13 +flutter precache --web
14 +cd apps/lifemate
15 +flutter pub get
16 +node tool/test_web_bootstrap.mjs
17 +node --test tool/test_offline_worker.mjs
18 +flutter build web --release --no-web-resources-cdn --pwa-strategy=none
19 +node tool/self_host_web.mjs build/web
20 +node tool/test_web_bootstrap.mjs
21 +test -s build/web/index.html
22 +test -s build/web/main.dart.js
23 +test -s build/web/config.json
24 +# The existing PWA expects a same-origin /api; until a verified QA API exists
25 +# the Pages Function responds 503 JSON, never an HTML fallback or Railway.
26 +node -e "const x=require('./build/web/config.json');if(x.apiBaseUrl!=='/api'||x.apiFallbackUrls.length)process.exit(1)"
27 +cat > build/web/_headers <<'HEADERS'
28 +/*
29 + X-Content-Type-Options: nosniff
30 + Referrer-Policy: strict-origin-when-cross-origin
31 + X-Frame-Options: DENY
32 + Permissions-Policy: camera=(), microphone=(), geolocation=()
33 +/config.json
34 + Cache-Control: no-store
35 +/main.dart.js
36 + Cache-Control: no-cache
37 +/flutter_bootstrap.js
38 + Cache-Control: no-cache
39 +/manifest.json
40 + Cache-Control: no-cache
41 +HEADERS
42 +printf 'LifeGuide QA PWA static build complete. API remains disabled until verified.\n'