mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
chore(web): new lint setup (#30020)
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
This commit is contained in:
@ -15,40 +15,41 @@ const sizes = [
|
||||
{ size: 128, name: 'icon-128x128.png' },
|
||||
{ size: 144, name: 'icon-144x144.png' },
|
||||
{ size: 152, name: 'icon-152x152.png' },
|
||||
];
|
||||
]
|
||||
|
||||
const inputPath = path.join(__dirname, '../public/icon.svg');
|
||||
const outputDir = path.join(__dirname, '../public');
|
||||
const inputPath = path.join(__dirname, '../public/icon.svg')
|
||||
const outputDir = path.join(__dirname, '../public')
|
||||
|
||||
// Generate icons
|
||||
async function generateIcons() {
|
||||
try {
|
||||
console.log('Generating PWA icons...');
|
||||
|
||||
console.log('Generating PWA icons...')
|
||||
|
||||
for (const { size, name } of sizes) {
|
||||
const outputPath = path.join(outputDir, name);
|
||||
|
||||
const outputPath = path.join(outputDir, name)
|
||||
|
||||
await sharp(inputPath)
|
||||
.resize(size, size)
|
||||
.png()
|
||||
.toFile(outputPath);
|
||||
|
||||
console.log(`✓ Generated ${name} (${size}x${size})`);
|
||||
.toFile(outputPath)
|
||||
|
||||
console.log(`✓ Generated ${name} (${size}x${size})`)
|
||||
}
|
||||
|
||||
|
||||
// Generate apple-touch-icon
|
||||
await sharp(inputPath)
|
||||
.resize(180, 180)
|
||||
.png()
|
||||
.toFile(path.join(outputDir, 'apple-touch-icon.png'));
|
||||
|
||||
console.log('✓ Generated apple-touch-icon.png (180x180)');
|
||||
|
||||
console.log('\n✅ All icons generated successfully!');
|
||||
} catch (error) {
|
||||
console.error('Error generating icons:', error);
|
||||
process.exit(1);
|
||||
.toFile(path.join(outputDir, 'apple-touch-icon.png'))
|
||||
|
||||
console.log('✓ Generated apple-touch-icon.png (180x180)')
|
||||
|
||||
console.log('\n✅ All icons generated successfully!')
|
||||
}
|
||||
catch (error) {
|
||||
console.error('Error generating icons:', error)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
generateIcons();
|
||||
generateIcons()
|
||||
|
||||
Reference in New Issue
Block a user