Skip to content

Commit

Permalink
Merge pull request #3843 from kwonoj/disable-danger-size
Browse files Browse the repository at this point in the history
chore(danger): disable size checker
  • Loading branch information
kwonoj authored Jun 16, 2018
2 parents b5ed59d + bbd56da commit 1ed8563
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,47 +94,3 @@ function sizeDiffBadge(name, value) {
}
return 'https://img.shields.io/badge/' + name + '-' + getFormattedKB(getKB(value)) + 'KB-' + color + '.svg?style=flat-square';
}

//post size of build
schedule(new Promise(function (res) {
getSize('./dist/cjs', function (e, result) {
var localGlobalFile = path.resolve('./dist/global', globalFile);
var localMinFile = path.resolve('./dist/global', minFile);

//get sizes of PR build
var global = fs.statSync(localGlobalFile);
var global_gzip = gzipSize.sync(fs.readFileSync(localGlobalFile, 'utf8'));
var min = fs.statSync(localMinFile);
var min_gzip = gzipSize.sync(fs.readFileSync(localMinFile, 'utf8'));

//resolve path to release build
var releasePath = path.dirname(require.resolve(require.resolve('rxjs')));
var bundlePath = path.resolve(releasePath, 'bundles');
var bundleGlobalFile = path.resolve(bundlePath, globalFile);
var bundleMinFile = path.resolve(bundlePath, minFile);

var packagePath = path.resolve(releasePath, 'package.json');
var releaseVersion = require(packagePath).version;

//get sizes of release build
var bundleGlobal = fs.statSync(bundleGlobalFile);
var bundle_global_gzip = gzipSize.sync(fs.readFileSync(bundleGlobalFile, 'utf8'));
var bundleMin = fs.statSync(bundleMinFile);
var bundle_min_gzip = gzipSize.sync(fs.readFileSync(bundleMinFile, 'utf8'));

var sizeMessage = '<img src="https://img.shields.io/badge/Size%20Diff%20%28' + releaseVersion + '%29--lightgrey.svg?style=flat-square"/> ';
sizeMessage += '<img src="' + sizeDiffBadge('Global', global.size - bundleGlobal.size) + '"/> ';
sizeMessage += '<img src="' + sizeDiffBadge('Global(gzip)', global_gzip - bundle_global_gzip) + '"/> ';
sizeMessage += '<img src="' + sizeDiffBadge('Min', min.size - bundleMin.size) + '"/> ';
sizeMessage += '<img src="' + sizeDiffBadge('Min (gzip)', min_gzip - bundle_min_gzip) + '"/> ';
message(sizeMessage);

markdown('> CJS: **' + getKB(result) +
'**KB, global: **' + getKB(global.size) +
'**KB (gzipped: **' + getKB(global_gzip) +
'**KB), min: **' + getKB(min.size) +
'**KB (gzipped: **' + getKB(min_gzip) + '**KB)');

res();
});
}));

0 comments on commit 1ed8563

Please sign in to comment.