// Génère icon-192.png et icon-512.png depuis icon.svg
import sharp from 'sharp';
import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';
import { dirname, resolve } from 'path';

const __dirname = dirname(fileURLToPath(import.meta.url));
const svgPath   = resolve(__dirname, '../public/icon.svg');
const svg       = readFileSync(svgPath);

for (const size of [192, 512]) {
  await sharp(svg)
    .resize(size, size)
    .png()
    .toFile(resolve(__dirname, `../public/icon-${size}.png`));
  console.log(`icon-${size}.png generated`);
}
