/**
 * Regenerate PWA icons from public/logo.png (run after logo change).
 *   node scripts/gen-pwa-icons.mjs
 */
import sharp from 'sharp';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';

const __dirname = dirname(fileURLToPath(import.meta.url));
const pub = join(__dirname, '..', 'public');
const src = join(pub, 'logo.png');

await sharp(src)
  .resize(192, 192, { fit: 'cover', position: 'center' })
  .png()
  .toFile(join(pub, 'pwa-192x192.png'));

await sharp(src)
  .resize(512, 512, { fit: 'cover', position: 'center' })
  .png()
  .toFile(join(pub, 'pwa-512x512.png'));

console.log('Wrote public/pwa-192x192.png, public/pwa-512x512.png');
