LifeMate — Personal, Family & Learning Companion

fix/lifeguide-pages-qa-base-preflight
chore/phase1-repository-cleanup deploy/stable-web-apk deployment-static design/mobile-accessibility-v2 design/mobile-navigation-review docs/child-education-access-decision docs/offline-data-rescue-options docs/owner-guide-and-delivery-plan docs/phase1-policy-options docs/public-review-live-2026-10-15 feat/aparat-learning-library feat/child-device-safety feat/child-identity-schema feat/flutter-mobile-navigation feat/learning-content-operations feat/local-signing-preflight feat/online-family-stage0 feat/personal-encrypted-recovery feat/private-planner-series-api feat/public-review-page feat/standalone-weekly-planner feat/weekly-planner-android final-feature-1/iran-family-school fix/auth-abuse-expiry-safety fix/auth-expiry-after-lock fix/backend-request-safety fix/lifeguide-bootstrap-naming-ci fix/lifeguide-pages-qa-base-preflight fix/lifeguide-qa-pages-env-deployment fix/local-task-persistence fix/managed-child-session-boundary fix/personal-jalali-dates fix/personal-notification-controls fix/personal-upgrade-delivery-guard fix/sms-approval-gates fix/study-duration-display infra/cloudflare-neon-migration infra/lifeguide-cloudflare-qa infra/lifeguide-github-pages-qa infra/lifeguide-supabase-qa main phase-1/foundation-completion phase-2/product-foundation-identity phase-3/planner-school-family-core phase-4/ai-learning-wellbeing phase-5/hardening-observability-release test/android-reminder-acceptance test/personal-notification-settings test/personal-recovery-acceptance test/role-entry-apk
sh 53 lines 2.35 KB
Raw
1 #!/usr/bin/env bash
2 # LifeGuide QA STATIC-ONLY Pages artifact. No login/API or family sync is hosted here.
3 # Default GitHub project Pages URL: /LifeMate/. Switch to / ONLY after GitHub
4 # accepts the isolated qa.lifeguide.ir custom hostname.
5 set -Eeuo pipefail
6 cd "$(dirname "$0")/.."
7
8 export LIFEGUIDE_PAGES_BASE_HREF="${LIFEGUIDE_PAGES_BASE_HREF:-/LifeMate/}"
9 case "$LIFEGUIDE_PAGES_BASE_HREF" in
10 /LifeMate/|/) ;;
11 *) echo "Unsupported LifeGuide Pages QA base href" >&2; exit 2 ;;
12 esac
13 export LIFEGUIDE_FLUTTER_BASE_HREF="$LIFEGUIDE_PAGES_BASE_HREF"
14
15 # Reuse pinned Flutter 3.47.6 self-hosting/asset checks, not a second build pipeline.
16 bash scripts/build-cloudflare-pages-qa.sh
17 out="apps/lifemate/build/web"
18
19 # Cloudflare-specific response header directives cannot secure GitHub Pages.
20 rm -f "$out/_headers"
21 touch "$out/.nojekyll"
22
23 node --input-type=module <<'NODE'
24 import { readFileSync, writeFileSync, existsSync } from 'node:fs';
25 const path = 'apps/lifemate/build/web/';
26 const base = process.env.LIFEGUIDE_PAGES_BASE_HREF;
27 const expectedApiBase = base === '/' ? '/api' : base + 'api';
28 const config = JSON.parse(readFileSync(path + 'config.json', 'utf8'));
29 if (config.apiBaseUrl !== '/api' ||
30 !Array.isArray(config.apiFallbackUrls) ||
31 config.apiFallbackUrls.length !== 0) {
32 throw new Error('QA config must start fail-closed with no external API fallback');
33 }
34 // Keep the unimplemented endpoint inside this app's path on github.io; do not
35 // accidentally target another project hosted under the same origin.
36 config.apiBaseUrl = expectedApiBase;
37 writeFileSync(path + 'config.json', JSON.stringify(config) + '\n');
38 const index = readFileSync(path + 'index.html', 'utf8');
39 if (!index.includes(`<base href="${base}">`) || !index.includes('LifeGuide')) {
40 throw new Error('Pages index base href does not match the selected hosting path');
41 }
42 for (const file of ['main.dart.js', 'flutter_bootstrap.js', 'lifeguide-sw.js',
43 'manifest.json', 'favicon.png', 'canvaskit']) {
44 if (!existsSync(path + file)) throw new Error('Missing QA web asset: ' + file);
45 }
46 const version = process.env.GITHUB_SHA?.slice(0,12) || 'local';
47 writeFileSync(path + 'site-check.txt',
48 'LifeGuide GitHub Pages QA STATIC_ONLY ' + version + ' BASE=' + base + '\n');
49 NODE
50
51 test -s "$out/main.dart.js"
52 test -s "$out/site-check.txt"
53 echo "LifeGuide Pages QA static artifact built for $LIFEGUIDE_PAGES_BASE_HREF (API unavailable)."