Skip to content

Commit

Permalink
Merge pull request #388 from srod/update-cli
Browse files Browse the repository at this point in the history
fix(cli): add uglify-es to cli
  • Loading branch information
srod authored Aug 4, 2018
2 parents 14670ec + 908dcd1 commit 8272cc8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ program.on('--help', function() {
console.log(' - butternut');
console.log(' - gcc');
console.log(' - uglifyjs');
console.log(' - uglify-es');
console.log(' - yui');
console.log('');
});
Expand Down
16 changes: 11 additions & 5 deletions lib/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ var spinner = require('./spinner');
* Module variables.
*/

var all = ['babel-minify', 'butternut', 'gcc', 'uglifyjs', 'yui'];
var all = ['babel-minify', 'butternut', 'gcc', 'uglifyjs', 'uglify-es', 'yui'];
var cliOptions;
var selectedCompressors;
var processed = 0;

/**
* Last step after minify.
*/

function finalize(results, smallers) {
if (results.length - 1 === selectedCompressors.length) {
if (processed === selectedCompressors.length) {
var _table = table(results);

console.log('');
Expand Down Expand Up @@ -98,6 +99,7 @@ function runOne(cli, compressor, results, smallers) {
return compress(options)
.then(function(result) {
results.push([result.compressor, result.size, result.sizeGzip]);
processed++;
setSmaller(result, smallers);
spinner.stop(compressor);
resolve();
Expand Down Expand Up @@ -135,9 +137,13 @@ function run(cli) {
if (isMultipleCompressors) {
var sequence = Promise.resolve();
selectedCompressors.forEach(function(compressor) {
sequence = sequence.then(function() {
return runOne(cli, compressor, results, smallers);
});
sequence = sequence
.then(function() {
return runOne(cli, compressor, results, smallers);
})
.catch(function() {
processed++;
});
});
sequence
.then(function() {
Expand Down

0 comments on commit 8272cc8

Please sign in to comment.