build-size
Advanced tools
Comparing version 0.0.6 to 0.1.2
@@ -50,2 +50,6 @@ #!/usr/bin/env node | ||
}) | ||
.option('disable-images', { | ||
type: 'boolean', | ||
default: 'false' | ||
}) | ||
.argv; | ||
@@ -62,3 +66,3 @@ checkCommands(yargs, argv, 3); | ||
if (argv.format === 'markdown') { | ||
compared = require('../src/format')(compared); | ||
compared = require('../src/format')(compared, true, argv.disableImages); | ||
} else { | ||
@@ -65,0 +69,0 @@ compared = JSON.stringify(compared, null, 2); |
@@ -11,3 +11,3 @@ { | ||
], | ||
"version": "0.0.6", | ||
"version": "0.1.2", | ||
"homepage": "https://github.com/swisnl/build-size", | ||
@@ -14,0 +14,0 @@ "author": { |
@@ -78,6 +78,6 @@ # build-size | ||
--- | --- | --- | --- | ||
js\/app.js | 129.98 KB | 135.32 KB | +5.33 KB \(4%\) | ||
js\/manifest.js | 1.44 KB | 1.45 KB | +2 B \(0%\) | ||
js\/vendor.js | 455.36 KB | 455.36 KB | +0 B \(0%\) | ||
css\/app.css | 23.92 KB | 23.92 KB | +0 B \(0%\) | ||
js\/app.js | 129.98 KB | 135.32 KB | ![▲](https://swisnl.github.io/build-size/images/increase.svg "Increase") 5.33 KB \(4%\) | ||
js\/manifest.js | 1.44 KB | 1.45 KB | ![▲](https://swisnl.github.io/build-size/images/increase.svg "Increase") 2 B \(0%\) | ||
js\/vendor.js | 455.36 KB | 455.36 KB | 0 B \(0%\) | ||
css\/app.css | 23.92 KB | 23.92 KB | 0 B \(0%\) | ||
``` | ||
@@ -84,0 +84,0 @@ |
@@ -5,3 +5,3 @@ 'use strict'; | ||
function getMarkdownForDifferences(difference, includeTotal = true) { | ||
function getMarkdownForDifferences(difference, includeTotal = true, disableImages = false) { | ||
let rows = [ | ||
@@ -12,2 +12,10 @@ 'File name | Previous size | New size | Change', | ||
let increaseIcon = '![▲](https://swisnl.github.io/build-size/images/increase.svg "Increase")'; | ||
let decreaseIcon = '![▼](https://swisnl.github.io/build-size/images/decrease.svg "Decrease")'; | ||
if (disableImages) { | ||
increaseIcon = '▲'; | ||
decreaseIcon = '▼'; | ||
} | ||
if (includeTotal) { | ||
@@ -29,3 +37,3 @@ let totalDifference = difference.pop(); | ||
row.push(file.newSize ? filesize(file.newSize) : 'x'); | ||
row.push(markdownEscape(`${file.difference.bytes >= 0 ? '+' : ''}${filesize(file.difference.bytes)} (${file.difference.percentage}%)`)); | ||
row.push((file.difference.bytes > 0 ? increaseIcon+' ' : file.difference.bytes < 0 ? decreaseIcon+' ' : '') + markdownEscape(`${filesize(Math.abs(file.difference.bytes))} (${file.difference.percentage}%)`)); | ||
@@ -32,0 +40,0 @@ return row.join(' | '); |
13882
206