Permalink
Browse files

Improved logging in script

  • Loading branch information...
davidmerfield committed Nov 30, 2018
1 parent c9a620e commit caf5cd8e23ff5f782b0bef34205082ad9e40a905
Showing with 22 additions and 12 deletions.
  1. +22 −12 scripts/build/templates.js
@@ -215,21 +215,31 @@ function removeExtinctTemplates(directory, callback) {
}
function watch(directory) {
console.log("Watching", directory, "for changes...");
// Stop the process from exiting automatically
process.stdin.resume();
console.log("Watching", directory, "for changes...");
watcher(directory, function(x, y, z) {
console.log(x, y, z);
// Breaking this up allows us to watch individual
// template directories and only rebuilt specific
// templates, rather than every single template.
return;
build(name, function(err) {
if (err) console.error(err);
require("../cache/empty")();
var queue = async.queue(function(directory, callback) {
build(directory, function(err) {
if (err) {
console.error(err);
callback();
} else {
emptyCache(callback);
}
});
});
queue.drain = function() {
console.log("All builds have been processed");
};
watcher(directory, function(path) {
directory =
TEMPLATES_DIRECTORY +
"/" +
path.slice(TEMPLATES_DIRECTORY.length).split("/")[1];
queue.push(directory);
});
}

0 comments on commit caf5cd8

Please sign in to comment.