const sharp = require('sharp'); const fs = require('fs'); const path = require('path'); const svgPath = path.join(__dirname, 'public/icon-192.svg'); if (!fs.existsSync(svgPath)) { console.error('SVG template not found at', svgPath); process.exit(1); } const svgBuffer = fs.readFileSync(svgPath); Promise.all([ sharp(svgBuffer).resize(192, 192).png().toFile(path.join(__dirname, 'public/icon-192.png')), sharp(svgBuffer).resize(512, 512).png().toFile(path.join(__dirname, 'public/icon-512.png')), sharp(svgBuffer).resize(180, 180).png().toFile(path.join(__dirname, 'public/apple-touch-icon.png')), sharp(svgBuffer).resize(384, 384).extend({ top: 64, bottom: 64, left: 64, right: 64, background: { r: 27, g: 26, b: 85, alpha: 1 } }).png().toFile(path.join(__dirname, 'public/icon-maskable.png')) ]).then(() => { console.log('Icons created successfully'); }).catch((err) => { console.error('Icon generation failed:', err); });