Skip to content

Commit

Permalink
chore: add size tracking for deliverables - part 1
Browse files Browse the repository at this point in the history
Closes #258

Closes #258
  • Loading branch information
PK1A committed Aug 8, 2014
1 parent 679e110 commit a119d21
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -30,6 +30,8 @@ after_success:
- cat test-results/*.info test-results/*/*/*.info | coveralls && echo "Successfully sent coverage to https://coveralls.io"
- chmod -R 777 ./ci-release.sh
- ./ci-release.sh
- chmod -R 777 ./build/size/size.sh
- ./build/size/size.sh dist/!(*.min.js)

after_failure:
- chmod -R 777 ./build/sauce/connect_logs.sh
Expand Down
29 changes: 29 additions & 0 deletions build/size/index.js
@@ -0,0 +1,29 @@
var mindthebulk = require('mind-the-bulk');
var humanize = require('humanize');
var Table = require('cli-table');

var args = process.argv.slice(2);

if (!args.length) {
throw new Error('You need to provide file paths to measure');
}

var sizes = mindthebulk(args);

//pretty-print results
var table = new Table({
head: ['', 'initial', 'min', 'min+gzip'],
colWidths: [40, 15, 15, 15],
colAligns: ['left', 'right', 'right', 'right']
});

sizes.forEach(function (size) {
table.push([
size.file,
humanize.filesize(size.raw),
humanize.filesize(size.min),
humanize.filesize(size.gzip)
]);
});

console.log(table.toString());
3 changes: 3 additions & 0 deletions build/size/size.sh
@@ -0,0 +1,3 @@
#!/bin/sh

npm install --silent mind-the-bulk humanize cli-table && node build/size $*

0 comments on commit a119d21

Please sign in to comment.