diff --git a/.eslintrc.json b/.eslintrc.json index d183f888b..f95dfbb33 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,5 +1,6 @@ { "env": { + "es6": true, "node": true }, "globals": {}, diff --git a/bin/node-sass b/bin/node-sass index 763fb496d..658f00b20 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,19 @@ 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 { + Promise.all(files.map(function(subject) { + return promisify(renderFile)(subject, options, emitter); + })) + .then(function(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)); + } + }) + .then(done) + .catch(function() { done(new Error('Some files failed to compile')); - } - }); + }); }); } diff --git a/package.json b/package.json index 31ca61630..4898cd704 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",