now compares against the last run branch built on

This commit is contained in:
Dominic Gannaway
2017-04-04 15:14:11 +01:00
parent 625419c05b
commit 3ef295c1cf
3 changed files with 11 additions and 4 deletions
+1
View File
@@ -56,6 +56,7 @@
"fbjs-scripts": "^0.6.0",
"filesize": "^3.5.6",
"flow-bin": "^0.41.0",
"git-branch": "^0.3.0",
"glob": "^6.0.4",
"glob-stream": "^6.1.0",
"gzip-js": "~0.3.2",
+9 -3
View File
@@ -43,6 +43,7 @@ const {
} = require('./bundles');
const { propertyMangleWhitelist } = require('./mangle');
const sizes = require('./sizes-plugin');
const branch = require('git-branch');
const errorCodeOpts = {
errorMapFilePath: 'scripts/error-codes/codes.json',
@@ -388,7 +389,9 @@ function createNodePackage(bundleType, packageName, filename) {
}
function saveResults() {
const contents = {};
const contents = {
branch: branch.sync(),
};
results.forEach(({ filename, size, gzip }) => {
contents[filename] = {
@@ -404,7 +407,7 @@ function percentChange(prev, current) {
const change = Math.floor((current - prev) / prev * 100);
if (change > 0) {
return chalk.red.bold(change + ' %');
return chalk.red.bold(`+${change} %`);
} else if (change <= 0) {
return chalk.green.bold(change + ' %');
}
@@ -437,7 +440,10 @@ function printResults() {
percentChange(prevGzip, gzip),
]);
});
return table.toString();
return (
table.toString() +
`\n\nThe difference was compared to the last build on "${ chalk.green.bold(prevResults.branch) }" branch.\n`
);
}
function getPlugins(entry, babelOpts, paths, filename, bundleType, isRenderer, manglePropertiesOnProd) {
+1 -1
View File
@@ -1 +1 @@
{"React-prod.js":{"filename":"React-prod.js","gzip":14394,"size":56438},"ReactDOMStack-prod.js":{"filename":"ReactDOMStack-prod.js","gzip":85702,"size":355558},"ReactDOMFiber-prod.js":{"filename":"ReactDOMFiber-prod.js","gzip":94702,"size":412153},"ReactDOMServerStack-prod.js":{"filename":"ReactDOMServerStack-prod.js","gzip":81496,"size":336791},"ReactARTStack-prod.js":{"filename":"ReactARTStack-prod.js","gzip":88945,"size":368987},"ReactARTFiber-prod.js":{"filename":"ReactARTFiber-prod.js","gzip":43477,"size":207824}}
{"branch":"rollup","ReactNative.js":{"filename":"ReactNative.js","gzip":555,"size":1569}}