Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add size tracking for deliverables - part 1
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
npm install --silent mind-the-bulk humanize cli-table && node build/size $* |