mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: @cordisjs/core instead of cordis
This commit is contained in:
6 files changed
+12
-14
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user