mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-11 14:24:24 +00:00
more async
This commit is contained in:
parent
1d5f015aaa
commit
1fe6f4ee2c
@ -11,6 +11,10 @@ function mkdirp() {
|
|||||||
return fs.mkdirp.apply(fs.mkdirp, arguments);
|
return fs.mkdirp.apply(fs.mkdirp, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copy() {
|
||||||
|
return fs.copy.apply(fs.copy, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
function copySync() {
|
function copySync() {
|
||||||
return fs.copySync.apply(fs.copySync, arguments);
|
return fs.copySync.apply(fs.copySync, arguments);
|
||||||
}
|
}
|
||||||
@ -77,6 +81,7 @@ function createWriteStream() {
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
mkdirpSync,
|
mkdirpSync,
|
||||||
mkdirp,
|
mkdirp,
|
||||||
|
copy,
|
||||||
copySync,
|
copySync,
|
||||||
readFile,
|
readFile,
|
||||||
readFileSync,
|
readFileSync,
|
||||||
|
@ -185,13 +185,15 @@ class Pipeline {
|
|||||||
targetDir = targetDir + '/';
|
targetDir = targetDir + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
contentFiles.map(function (file) {
|
async.each(contentFiles, function (file, mapCb) {
|
||||||
let filename = file.filename.replace(file.basedir + '/', '');
|
let filename = file.filename.replace(file.basedir + '/', '');
|
||||||
self.log("writing file " + (self.buildDir + targetDir + filename).bold.dim);
|
self.log("writing file " + (self.buildDir + targetDir + filename).bold.dim);
|
||||||
|
|
||||||
fs.copySync(file.path, self.buildDir + targetDir + filename, {overwrite: true});
|
fs.copy(file.path, self.buildDir + targetDir + filename, {overwrite: true}, mapCb);
|
||||||
});
|
}, cb);
|
||||||
} else {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let content = contentFiles.map(function (file) {
|
let content = contentFiles.map(function (file) {
|
||||||
if (file === undefined) {
|
if (file === undefined) {
|
||||||
return "";
|
return "";
|
||||||
@ -199,14 +201,12 @@ class Pipeline {
|
|||||||
return file.content;
|
return file.content;
|
||||||
}).join("\n");
|
}).join("\n");
|
||||||
|
|
||||||
self.log("writing file " + (self.buildDir + targetFile).bold.dim);
|
self.log("writing file ASYNC " + (self.buildDir + targetFile).bold.dim);
|
||||||
fs.writeFileSync(self.buildDir + targetFile, content);
|
fs.writeFile(self.buildDir + targetFile, content, cb);
|
||||||
}
|
|
||||||
cb();
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function (_err, _results) {
|
function (_err) {
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user