mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-19 07:21:22 +02:00
- Rename "Mana Matrix" to "Manalink" (bridge metaphor) - Add PWA manifest with app icons and shortcuts - Configure Service Worker with Workbox caching strategies - Add iOS/Android meta tags for installability - Create bridge-themed SVG favicon - Add icon generation script (sharp) PWA features: - Installable on iOS/Android homescreen - Offline caching (NetworkFirst for API, CacheFirst for assets) - App shortcuts for "New Chat" - Auto-updating Service Worker Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
50 lines
1.5 KiB
JavaScript
50 lines
1.5 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Generate PWA icons from SVG favicon
|
|
* Run: node scripts/generate-icons.mjs
|
|
* Requires: npm install -D sharp
|
|
*/
|
|
|
|
import { readFileSync, writeFileSync } from 'fs';
|
|
import { join, dirname } from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
const staticDir = join(__dirname, '..', 'static');
|
|
|
|
// Icon sizes to generate
|
|
const sizes = [
|
|
{ name: 'favicon.png', size: 32 },
|
|
{ name: 'pwa-192x192.png', size: 192 },
|
|
{ name: 'pwa-512x512.png', size: 512 },
|
|
{ name: 'apple-touch-icon.png', size: 180 },
|
|
];
|
|
|
|
async function generateIcons() {
|
|
try {
|
|
const sharp = (await import('sharp')).default;
|
|
const svgPath = join(staticDir, 'favicon.svg');
|
|
const svgBuffer = readFileSync(svgPath);
|
|
|
|
for (const { name, size } of sizes) {
|
|
const outputPath = join(staticDir, name);
|
|
await sharp(svgBuffer).resize(size, size).png().toFile(outputPath);
|
|
console.log(`Generated: ${name} (${size}x${size})`);
|
|
}
|
|
|
|
console.log('\nAll icons generated successfully!');
|
|
} catch (error) {
|
|
if (error.code === 'ERR_MODULE_NOT_FOUND') {
|
|
console.error('Sharp is not installed. Run: pnpm add -D sharp');
|
|
console.log('\nAlternatively, use an online tool to convert the SVG:');
|
|
console.log('1. Open static/favicon.svg in a browser');
|
|
console.log('2. Use https://realfavicongenerator.net/ to generate icons');
|
|
console.log('3. Replace the placeholder PNGs in static/');
|
|
} else {
|
|
console.error('Error generating icons:', error);
|
|
}
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
generateIcons();
|