ui: @cordisjs/core instead of cordis

This commit is contained in:
undefined committed 2024-06-08 17:38:39 +08:00
1 parent d94d364abe
commit c05accf343
6 files changed
+12 -14

No files matched your search

+5 -2
View File
@@ -6,7 +6,6 @@ import log from 'fancy-log';
import fs from 'fs-extra';
import { globbySync } from 'globby';
import gulp from 'gulp';
import { sum } from 'lodash';
import path from 'path';
import webpack, { Stats } from 'webpack';
import WebpackDevServer from 'webpack-dev-server';
@@ -68,16 +67,20 @@ async function runWebpack({
stats[key] = data.size;
}
const statsPath = root('__bundleInfo');
let oldTotal = 0;
let newTotal = 0;
if (fs.existsSync(statsPath)) {
log('Compare to last production bundle:');
const oldStats = JSON.parse(await fs.readFile(statsPath, 'utf-8')) as Record<string, number>;
for (const key in stats) oldStats[key] ||= 0;
const entries: [filename: string, orig: number, curr: number][] = [];
for (const [key, value] of Object.entries(oldStats)) {
oldTotal += value;
newTotal += stats[key] || 0;
if (Math.abs((stats[key] || 0) - value) > 25) entries.push([key, value, stats[key] || 0]);
}
const sorted = entries.sort((i) => i[1] - i[2]);
sorted.push(['Total', sum(sorted.map((i) => i[1])), sum(sorted.map((i) => i[2]))]);
sorted.push(['Total', oldTotal, newTotal]);
for (const entry of sorted) {
const [name, orig, curr] = entry;
const diff = 100 * (curr - orig) / orig;