Add PWA support with install banner and app icons
All checks were successful
Build And Push Image / docker (push) Successful in 2m56s
All checks were successful
Build And Push Image / docker (push) Successful in 2m56s
- Configure @vite-pwa/nuxt module with manifest and service worker - Add PWA install banner component to login page - Include app icons (192x192, 512x512) and favicon assets - Update admin dashboard layout and remove backup section - Add PWA-related API endpoints and utility scripts
This commit is contained in:
64
scripts/generate-pwa-icons.cjs
Normal file
64
scripts/generate-pwa-icons.cjs
Normal file
@@ -0,0 +1,64 @@
|
||||
const sharp = require('sharp');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
async function generatePWAIcons() {
|
||||
const inputFile = path.join(__dirname, '../public/MONACOUSA-Flags_376x376.png');
|
||||
const publicDir = path.join(__dirname, '../public');
|
||||
|
||||
console.log('🎨 Generating PWA icons from MonacoUSA logo...');
|
||||
|
||||
try {
|
||||
// Generate 192x192 icon
|
||||
await sharp(inputFile)
|
||||
.resize(192, 192, {
|
||||
fit: 'contain',
|
||||
background: { r: 255, g: 255, b: 255, alpha: 0 }
|
||||
})
|
||||
.png()
|
||||
.toFile(path.join(publicDir, 'icon-192x192.png'));
|
||||
|
||||
console.log('✅ Generated icon-192x192.png');
|
||||
|
||||
// Generate 512x512 icon
|
||||
await sharp(inputFile)
|
||||
.resize(512, 512, {
|
||||
fit: 'contain',
|
||||
background: { r: 255, g: 255, b: 255, alpha: 0 }
|
||||
})
|
||||
.png()
|
||||
.toFile(path.join(publicDir, 'icon-512x512.png'));
|
||||
|
||||
console.log('✅ Generated icon-512x512.png');
|
||||
|
||||
// Generate Apple touch icon (180x180)
|
||||
await sharp(inputFile)
|
||||
.resize(180, 180, {
|
||||
fit: 'contain',
|
||||
background: { r: 255, g: 255, b: 255, alpha: 1 }
|
||||
})
|
||||
.png()
|
||||
.toFile(path.join(publicDir, 'apple-touch-icon.png'));
|
||||
|
||||
console.log('✅ Generated apple-touch-icon.png');
|
||||
|
||||
// Generate favicon (32x32)
|
||||
await sharp(inputFile)
|
||||
.resize(32, 32, {
|
||||
fit: 'contain',
|
||||
background: { r: 255, g: 255, b: 255, alpha: 0 }
|
||||
})
|
||||
.png()
|
||||
.toFile(path.join(publicDir, 'favicon-32x32.png'));
|
||||
|
||||
console.log('✅ Generated favicon-32x32.png');
|
||||
|
||||
console.log('🎉 All PWA icons generated successfully!');
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Error generating PWA icons:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
generatePWAIcons();
|
||||
Reference in New Issue
Block a user