diff --git a/bin/node-sass b/bin/node-sass index 763fb496d..a8580e724 100755 --- a/bin/node-sass +++ b/bin/node-sass @@ -1,7 +1,7 @@ #!/usr/bin/env node var Emitter = require('events').EventEmitter, - forEach = require('async-foreach').forEach, + promisify = require('util').promisify, chokidar = require('chokidar'), meow = require('meow'), util = require('util'), @@ -410,19 +410,17 @@ function renderDir(options, emitter, done) { return emitter.emit('error', 'No input file was found.'); } - forEach(files, function(subject) { - renderFile(subject, options, emitter, this.async()); - }, function(successful, arr) { - var outputDir = path.join(process.cwd(), options.output); - if (!options.quiet) { - emitter.emit('info', util.format('Wrote %s CSS files to %s', arr.length, outputDir)); - } - if (successful) { - done(); - } else { - done(new Error('Some files failed to compile')); - } - }); + Promise.all(files.map(subject => { + return promisify(renderFile)(subject, options, emitter); + })) + .then(res => { + var outputDir = path.join(process.cwd(), options.output); + if (!options.quiet) { + emitter.emit('info', util.format('Wrote %s CSS files to %s', res.length, outputDir)); + } + }) + .catch(() => done(new Error('Some files failed to compile'))) + .then(done) }); } diff --git a/package.json b/package.json index 392daa0f5..c0f49d449 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "style" ], "dependencies": { - "async-foreach": "^0.1.3", "chalk": "^2.4.2", "chokidar": "^3.3.0", "cross-spawn": "^7.0.1",