Created
May 30, 2020 18:38
-
-
Save senadir/a80e66e884c4b724f7eac8d1eb47f480 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// only frontend block files | |
const b25 = require('./2.5.size-gzip.json').results; | |
const b26 = require('./2.6.size-gzip.json').results; | |
// all files. | |
const b25All = require('./blocks-2.5-all.json').results; | |
const b26All = require('./blocks-2.6-all.json').results; | |
const bytes = require('bytes'); | |
const tablemark = require('tablemark') | |
const frontEndBlocks = [] | |
b26.forEach(file => { | |
const s26 = file.totalBytes ?? 0 | |
const s25 = b25.find(files => files.bundleName === file.bundleName)?.totalBytes ?? 0 | |
frontEndBlocks.push({ | |
bundle: file.bundleName, | |
'release/2.5': bytes(s25), | |
'master': bytes(s26), | |
'diff': bytes(s26 - s25) | |
}); | |
}) | |
const allFiles = [] | |
b26All.forEach(file => { | |
const s26 = file.totalBytes ?? 0; | |
const s25 = b25All.find(files => files.bundleName === file.bundleName)?.totalBytes ?? 0 | |
allFiles.push({ | |
bundle: `\`${file.bundleName}\``, | |
'release/2.5': bytes(s25), | |
'master': bytes(s26), | |
'diff': s26 - s25 | |
}) | |
}) | |
const filteredAllFiles = allFiles | |
.filter(file => Math.abs(file.diff) > 1000 ) | |
.sort((a , b) => Math.abs(b.diff) - Math.abs(a.diff)) | |
.map(file => ({...file, diff: bytes(file.diff)})) | |
console.log(tablemark(frontEndBlocks)); | |
console.log(tablemark(filteredAllFiles)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
2.5.size-gzip.json
and2.6.size-gzip.json
are exported using this commandnpm run explore build/*-frontend.js -- --gzip --json > 2.6.size-gzip.json
on each branchblocks-2.5-all.json
was using this commandnpm run explore ./build/*.js -- --gzip --json > blocks-2.6-all.json
on each branch