重构 seed 为 WC2026 72 场小组赛与 48 强优胜盘;新增 production 模式仅保留 admin 与赛事示例;提供 prod-init-db 全量重置脚本;管理端 i18n 分包与赛事归档能力。 Co-authored-by: Cursor <cursoragent@cursor.com>
33 lines
956 B
JavaScript
33 lines
956 B
JavaScript
import fs from 'fs';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
import { gzipSync } from 'zlib';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const dist = path.join(__dirname, '../dist/assets');
|
|
|
|
if (!fs.existsSync(dist)) {
|
|
console.error('dist/assets not found — run pnpm build first');
|
|
process.exit(1);
|
|
}
|
|
|
|
const files = fs
|
|
.readdirSync(dist)
|
|
.filter((f) => f.endsWith('.js'))
|
|
.map((f) => {
|
|
const buf = fs.readFileSync(path.join(dist, f));
|
|
return {
|
|
file: f,
|
|
raw: buf.length,
|
|
gzip: gzipSync(buf).length,
|
|
};
|
|
})
|
|
.sort((a, b) => b.gzip - a.gzip);
|
|
|
|
console.log('Admin bundle chunk sizes (gzip):');
|
|
for (const row of files) {
|
|
console.log(`${(row.gzip / 1024).toFixed(1)} KB gzip ${(row.raw / 1024).toFixed(1)} KB raw ${row.file}`);
|
|
}
|
|
const totalGzip = files.reduce((s, r) => s + r.gzip, 0);
|
|
console.log(`\nTotal JS (all chunks): ${(totalGzip / 1024).toFixed(1)} KB gzip`);
|