Skip to content

Instantly share code, notes, and snippets.

@senadir
Created May 30, 2020 18:38
Show Gist options
  • Save senadir/a80e66e884c4b724f7eac8d1eb47f480 to your computer and use it in GitHub Desktop.
Save senadir/a80e66e884c4b724f7eac8d1eb47f480 to your computer and use it in GitHub Desktop.
// 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));
@senadir
Copy link
Author

senadir commented May 30, 2020

2.5.size-gzip.json and 2.6.size-gzip.json are exported using this command npm run explore build/*-frontend.js -- --gzip --json > 2.6.size-gzip.json on each branch
blocks-2.5-all.json was using this command npm run explore ./build/*.js -- --gzip --json > blocks-2.6-all.json on each branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment