fa
Some checks failed
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled

This commit is contained in:
2026-02-26 21:29:54 +08:00
commit 2c4549ad79
85 changed files with 14664 additions and 0 deletions

42
scripts/generate-icons.js Normal file
View File

@@ -0,0 +1,42 @@
const fs = require('fs');
const path = require('path');
// 检查是否安装了 sharp
try {
const sharp = require('sharp');
const inputFile = path.join(__dirname, '../public/icon.png');
const outputDir = path.join(__dirname, '../public');
const sizes = [
{ name: 'favicon-16x16.png', size: 16 },
{ name: 'favicon-32x32.png', size: 32 },
{ name: 'apple-touch-icon.png', size: 180 },
{ name: 'android-chrome-192x192.png', size: 192 },
{ name: 'android-chrome-512x512.png', size: 512 },
];
async function generateIcons() {
for (const { name, size } of sizes) {
await sharp(inputFile)
.resize(size, size, {
fit: 'contain',
background: { r: 255, g: 255, b: 255, alpha: 0 }
})
.png()
.toFile(path.join(outputDir, name));
console.log(`✓ 生成 ${name}`);
}
console.log('✅ 所有图标生成完成!');
}
generateIcons().catch(err => {
console.error('❌ 生成图标失败:', err.message);
console.log('💡 请运行: npm install sharp --save-dev');
});
} catch (err) {
console.log('⚠️ 未安装 sharp 包');
console.log('💡 可选:运行 npm install sharp --save-dev 来生成不同尺寸的图标');
console.log('✓ 当前使用原始图片作为所有尺寸的图标');
}

View File

@@ -0,0 +1,36 @@
const fs = require('fs');
const path = require('path');
const DATA_FILE = path.join(process.cwd(), 'todos.json');
const generateMockData = () => {
const todos = [];
const now = Date.now();
const ONE_DAY = 24 * 60 * 60 * 1000;
// Generate data for the past 45 days
for (let i = 0; i < 45; i++) {
const date = now - i * ONE_DAY;
const count = Math.floor(Math.random() * 5) + 2; // 2-6 todos per day
for (let j = 0; j < count; j++) {
const isCompleted = Math.random() > 0.3;
const createdAt = date + Math.floor(Math.random() * ONE_DAY);
const completedAt = isCompleted ? createdAt + Math.floor(Math.random() * (ONE_DAY * 0.5)) : undefined;
todos.push({
id: `mock-${i}-${j}`,
text: `Mock Task ${i}-${j}`,
completed: isCompleted,
createdAt,
completedAt,
deleted: false
});
}
}
fs.writeFileSync(DATA_FILE, JSON.stringify(todos, null, 2));
console.log(`✅ Generated ${todos.length} mock todos in ${DATA_FILE}`);
};
generateMockData();