mirror of
https://github.com/primer/css.git
synced 2024-09-20 05:07:11 +03:00
Fixing bundle report size for bundle that doesn't exist
This commit is contained in:
parent
852da9d5e3
commit
53e78d1e64
@ -69,24 +69,41 @@ const posNeg = v => (v > 0 ? '+ ' : v < 0 ? '- ' : '')
|
|||||||
|
|
||||||
// Build the rows
|
// Build the rows
|
||||||
for (const name of Object.keys(currentBundles)) {
|
for (const name of Object.keys(currentBundles)) {
|
||||||
const current = currentBundles[name]
|
const {
|
||||||
const latest = latestBundles[name]
|
stats: {
|
||||||
|
selectors: {
|
||||||
|
total: current_selectors_total
|
||||||
|
},
|
||||||
|
gzipSize: current_gzip_size,
|
||||||
|
size: current_size
|
||||||
|
}
|
||||||
|
} = currentBundles[name] || { stats: { selectors: { total: 0 }, gzipSize: 0, size: 0 } }
|
||||||
|
|
||||||
|
const {
|
||||||
|
stats: {
|
||||||
|
selectors: {
|
||||||
|
total: latest_selectors_total
|
||||||
|
},
|
||||||
|
gzipSize: latest_gzip_size,
|
||||||
|
size: latest_size
|
||||||
|
}
|
||||||
|
} = latestBundles[name] || { stats: { selectors: { total: 0 }, gzipSize: 0, size: 0 } }
|
||||||
|
|
||||||
const delta = [
|
const delta = [
|
||||||
current.stats.selectors.total - latest.stats.selectors.total,
|
current_selectors_total - latest_selectors_total,
|
||||||
current.stats.gzipSize - latest.stats.gzipSize,
|
current_gzip_size - latest_gzip_size,
|
||||||
current.stats.size - latest.stats.size
|
current_size - latest_size
|
||||||
].reduce((a, b) => a + b, 0)
|
].reduce((a, b) => a + b, 0)
|
||||||
|
|
||||||
if (delta !== 0) {
|
if (delta !== 0) {
|
||||||
data.push([
|
data.push([
|
||||||
current.name,
|
name,
|
||||||
current.stats.selectors.total,
|
current_selectors_total,
|
||||||
current.stats.selectors.total - latest.stats.selectors.total,
|
current_selectors_total - latest_selectors_total,
|
||||||
current.stats.gzipSize,
|
current_gzip_size,
|
||||||
current.stats.gzipSize - latest.stats.gzipSize,
|
current_gzip_size - latest_gzip_size,
|
||||||
current.stats.size,
|
current_size,
|
||||||
current.stats.size - latest.stats.size
|
current_size - latest_size
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user