Abstract out more of the build stack
parent
31b8602f52
commit
4bcb3fb0a1
@ -1,11 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const split = require("split");
|
||||
|
||||
module.exports = function logStream(stream, logger) {
|
||||
stream.pipe(split()).on("data", function(data) {
|
||||
if (data.trim() !== "") {
|
||||
logger(data);
|
||||
}
|
||||
})
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const chalk = require("chalk");
|
||||
|
||||
module.exports = function(livereload, logger) {
|
||||
var _oldChanged = livereload.changed.bind(livereload);
|
||||
livereload.changed = function(filePath) {
|
||||
logger.log(chalk.magenta(filePath) + " reloaded.");
|
||||
_oldChanged.apply(null, arguments);
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const childProcess = require("child_process");
|
||||
const rfr = require("rfr");
|
||||
const logStream = rfr("src/gulp/log-stream");
|
||||
|
||||
module.exports = function runProcess(path, args, options) {
|
||||
if (options.logger != null) {
|
||||
options.logger.info(`Starting ${path}...`);
|
||||
}
|
||||
|
||||
let proc = childProcess.spawn(path, args, options);
|
||||
|
||||
if (options.logger != null) {
|
||||
logStream(proc.stdout, options.logger.log);
|
||||
logStream(proc.stderr, options.logger.error);
|
||||
}
|
||||
|
||||
proc.on("error", (err) => {
|
||||
if (options.logger != null) {
|
||||
options.logger.error(err.stack);
|
||||
}
|
||||
});
|
||||
|
||||
proc.on("close", (code) => {
|
||||
options.logger.info(`Exited with code ${code.toString()}: ${path}.`);
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue