Skip to content

Commit

Permalink
feat: improve stats reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Nov 4, 2018
1 parent 35ef721 commit 09459af
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Expand Up @@ -10,6 +10,7 @@ module.exports = {
'class-methods-use-this': 0,
'prefer-template': 0,
'no-underscore-dangle': 0,
'arrow-body-style': 0
'arrow-body-style': 0,
'no-param-reassign': 0
},
};
27 changes: 24 additions & 3 deletions src/reporters/stats.js
@@ -1,9 +1,30 @@
export default class StatsReporter {
constructor(options) {
this.options = options;
this.options = Object.assign(
{
chunks: false,
children: false,
modules: false,
colors: true,
warnings: true,
errors: true,
},
options
);
}

done(_, { stats }) {
process.stderr.write('\n' + stats.toString(this.options) + '\n');
done(context, { stats }) {
context.state.statsString = stats.toString(this.options);
}

allDone(context) {
let str = '';

context.statesArray.forEach((state) => {
str += '\n' + state.statsString + '\n';
delete state.statsString;
});

process.stderr.write(str);
}
}

0 comments on commit 09459af

Please sign in to comment.