const sharp = require('sharp'); const fs = require('fs').promises; const path = require('path'); // Icon-Größen für PWA const sizes = [48, 72, 96, 128, 144, 152, 192, 384, 512]; async function generateIcons() { const svgPath = path.join(__dirname, 'frontend/assets/icons/taskmate-logo.svg'); const outputDir = path.join(__dirname, 'frontend/assets/icons'); try { // SVG einlesen const svgBuffer = await fs.readFile(svgPath); // Icons in verschiedenen Größen generieren for (const size of sizes) { const outputPath = path.join(outputDir, `icon-${size}x${size}.png`); await sharp(svgBuffer) .resize(size, size) .png() .toFile(outputPath); console.log(`✓ Erstellt: icon-${size}x${size}.png`); } // Zusätzliche Icons für Shortcuts // Add Task Icon const addTaskSvg = ` `; await sharp(Buffer.from(addTaskSvg)) .png() .toFile(path.join(outputDir, 'add-task-96x96.png')); console.log('✓ Erstellt: add-task-96x96.png'); // Calendar Icon const calendarSvg = ` `; await sharp(Buffer.from(calendarSvg)) .png() .toFile(path.join(outputDir, 'calendar-96x96.png')); console.log('✓ Erstellt: calendar-96x96.png'); // Favicon erstellen (mehrere Größen in einer ICO-Datei) await sharp(svgBuffer) .resize(32, 32) .png() .toFile(path.join(outputDir, 'favicon-32x32.png')); console.log('✓ Erstellt: favicon-32x32.png'); await sharp(svgBuffer) .resize(16, 16) .png() .toFile(path.join(outputDir, 'favicon-16x16.png')); console.log('✓ Erstellt: favicon-16x16.png'); // Apple Touch Icon await sharp(svgBuffer) .resize(180, 180) .png() .toFile(path.join(outputDir, 'apple-touch-icon.png')); console.log('✓ Erstellt: apple-touch-icon.png'); console.log('\n✅ Alle Icons wurden erfolgreich generiert!'); } catch (error) { console.error('Fehler beim Generieren der Icons:', error); } } // Script ausführen generateIcons();