const sharp = require('sharp'); const fs = require('fs'); const path = require('path'); const svgBuffer = fs.readFileSync(path.join(__dirname, 'public/icon-192.svg')); // icon-192.png sharp(svgBuffer) .resize(192, 192) .png() .toFile('public/icon-192.png') .then(() => console.log('Created icon-192.png')); // icon-512.png sharp(svgBuffer) .resize(512, 512) .png() .toFile('public/icon-512.png') .then(() => console.log('Created icon-512.png')); // apple-touch-icon.png (180x180) sharp(svgBuffer) .resize(180, 180) .png() .toFile('public/apple-touch-icon.png') .then(() => console.log('Created apple-touch-icon.png')); // icon-maskable.png (512x512 with padding for safe area) sharp(svgBuffer) .resize(384, 384) // 75% of 512 for safe area .extend({ top: 64, bottom: 64, left: 64, right: 64, background: { r: 27, g: 26, b: 85, alpha: 1 } // #1B1A55 }) .png() .toFile('public/icon-maskable.png') .then(() => console.log('Created icon-maskable.png'));