1
1
mirror of https://github.com/primer/css.git synced 2024-12-26 15:43:59 +03:00

Don't show bundles that haven't changed

This commit is contained in:
Jon Rohan 2021-04-10 13:53:25 -07:00
parent acafb30f14
commit eb7ba12cae
No known key found for this signature in database
GPG Key ID: B0BBE304A9A0AECB

View File

@ -65,16 +65,24 @@ const posNeg = v => (v > 0 ? '+ ' : v < 0 ? '- ' : '')
for (const name of Object.keys(currentBundles)) {
const current = currentBundles[name]
const latest = latestBundles[name]
data.push([
current.name,
current.stats.selectors.total,
const delta = [
current.stats.selectors.total - latest.stats.selectors.total,
current.stats.gzipSize,
current.stats.gzipSize - latest.stats.gzipSize,
current.stats.size,
current.stats.size - latest.stats.size,
current.path
])
current.stats.size - latest.stats.size
].reduce((a, b) => a + b, 0)
if (delta !== 0) {
data.push([
current.name,
current.stats.selectors.total,
current.stats.selectors.total - latest.stats.selectors.total,
current.stats.gzipSize,
current.stats.gzipSize - latest.stats.gzipSize,
current.stats.size,
current.stats.size - latest.stats.size
])
}
}
// Sort the data
@ -92,8 +100,8 @@ const posNeg = v => (v > 0 ? '+ ' : v < 0 ? '- ' : '')
// Adding header
data = [
['name', 'selectors', '±', 'gzip size', '±', 'raw size', '±', 'path'],
[':-', '-:', '-:', '-:', '-:', '-:', '-:', ':-']
['name', 'selectors', '±', 'gzip size', '±', 'raw size', '±'],
[':-', '-:', '-:', '-:', '-:', '-:', '-:']
].concat(data)
console.log(table(data, tableOptions))