Don't use sync functions

This commit is contained in:
Sébastien Chopin 2016-11-10 14:51:40 +01:00
parent a8776de913
commit d5230accaf

View File

@ -9,6 +9,7 @@ const { resolve, join, dirname } = require('path')
const copy = pify(fs.copy) const copy = pify(fs.copy)
const remove = pify(fs.remove) const remove = pify(fs.remove)
const writeFile = pify(fs.writeFile) const writeFile = pify(fs.writeFile)
const mkdirp = pify(fs.mkdirp)
const defaults = { const defaults = {
dir: 'dist', dir: 'dist',
@ -53,8 +54,10 @@ module.exports = function () {
debug('Generate file: ' + path) debug('Generate file: ' + path)
path = join(distPath, path) path = join(distPath, path)
// Make sure the sub folders are created // Make sure the sub folders are created
fs.mkdirsSync(dirname(path)) return co(function * () {
return writeFile(path, html, 'utf8') yield mkdirp(dirname(path))
yield writeFile(path, html, 'utf8')
})
}) })
promises.push(promise) promises.push(promise)
}) })