LifeMate — Personal, Family & Learning Companion

feat/weekly-planner-android
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
mjs 36 lines 1.69 KB
Raw
1 // Reuses the Android vector; requires local Playwright and Chromium tooling.
2 import {createRequire} from 'node:module';
3 import {readFile} from 'node:fs/promises';
4 import {execFileSync} from 'node:child_process';
5 import {fileURLToPath} from 'node:url';
6 import {dirname, join} from 'node:path';
7
8 const root = dirname(dirname(fileURLToPath(import.meta.url)));
9 execFileSync('python3', [join(root, 'tool/export_brand_icons.py')], {stdio:'inherit'});
10 const {chromium} = createRequire(import.meta.url)('playwright');
11 const browser = await chromium.launch({executablePath:process.env.CHROMIUM_PATH || '/usr/bin/chromium', headless:true});
12 try {
13 const page = await browser.newPage();
14 for (const [name, svgName, sizes] of [
15 ['Icon', 'lifeguide.svg', [192,512]],
16 ['Icon-maskable', 'lifeguide-maskable.svg', [192,512]],
17 ['favicon', 'lifeguide.svg', [32]],
18 ]) {
19 const source = (await readFile(join(root,'web/icons',svgName),'utf8'))
20 .replace(/<\?xml[^>]*\?>/, '');
21 for (const size of sizes) {
22 await page.setViewportSize({width:size,height:size});
23 await page.setContent('<style>html,body{margin:0;padding:0}</style>' + source);
24 await page.locator('svg').evaluate((element, pixels) => {
25 element.setAttribute('width', String(pixels));
26 element.setAttribute('height', String(pixels));
27 element.style.display = 'block';
28 },size);
29 const output = name === 'favicon' ? join(root,'web/favicon.png') : join(root,'web/icons',`${name}-${size}.png`);
30 await page.locator('svg').screenshot({path:output,omitBackground:true});
31 }
32 }
33 } finally {
34 await browser.close();
35 }
36 console.log('PWA icons and favicon rasterized from matching Android-vector SVG sources.');