Skip to content

Commit

Permalink
Switch to the table package.
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Nov 8, 2019
1 parent 7a5d3f2 commit 1f22cf7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 23 deletions.
12 changes: 7 additions & 5 deletions lib/process-output.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Table = require('cli-table');
const { table } = require('table');
const HTMLTable = require('./html-table');
const formatRow = require('./format-row');
const benchmarkInfo = require('./benchmark-info');
Expand All @@ -19,7 +19,7 @@ const write = (processedFiles, activeMinifiers, asHTML, measureGzip, showTotal,
// this is needed for the table's first `th`
data.unshift('File');

const results = asHTML ? HTMLTable({ data }) : new Table({ head: data });
const results = asHTML ? HTMLTable({ data }) : [data];
let totalLength = 0;

Object.keys(processedFiles).forEach(filename => {
Expand Down Expand Up @@ -50,11 +50,13 @@ const write = (processedFiles, activeMinifiers, asHTML, measureGzip, showTotal,
results.push(totalRow);
}

if (!asHTML) {
results.push([`${benchmarkInfo()}`]);
if (asHTML) {
process.stdout.write(results.toString());
} else {
process.stdout.write(table(results));
process.stdout.write(benchmarkInfo());
}

process.stdout.write(results.toString());
process.stdout.write(lineBreak);
};

Expand Down
17 changes: 0 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
"devDependencies": {
"chalk": "^2.4.2",
"clean-css": "^4.2.1",
"cli-table": "^0.3.1",
"crass": "^0.12.3",
"cssnano": "^4.1.10",
"cssnano-preset-advanced": "^4.0.7",
"csso": "^4.0.2",
"csswring": "^7.0.0",
"gzip-size": "^5.1.1",
"q": "^1.5.1",
"table": "^5.4.6",
"xo": "^0.25.3"
},
"engines": {
Expand Down

0 comments on commit 1f22cf7

Please sign in to comment.