touch ups

This commit is contained in:
Jonathan Rainville 2018-05-10 10:48:06 -04:00
parent 31e82e31d0
commit 83f97407e8
1 changed files with 5 additions and 7 deletions

View File

@ -18,6 +18,7 @@ class Pipeline {
this.events = options.events; this.events = options.events;
this.logger = options.logger; this.logger = options.logger;
this.plugins = options.plugins; this.plugins = options.plugins;
this.pipelinePlugins = this.plugins.getPluginsFor('pipeline');
} }
build(abi, contractsJSON, path, callback) { build(abi, contractsJSON, path, callback) {
@ -57,6 +58,7 @@ class Pipeline {
function (file, fileCb) { function (file, fileCb) {
self.logger.trace("reading " + file.filename); self.logger.trace("reading " + file.filename);
// Not a JS file
if (file.filename.indexOf('.js') < 0) { if (file.filename.indexOf('.js') < 0) {
return file.content(function (fileContent) { return file.content(function (fileContent) {
self.runPlugins(file, fileContent, fileCb); self.runPlugins(file, fileContent, fileCb);
@ -73,10 +75,7 @@ class Pipeline {
webpackProcess.on('message', function (msg) { webpackProcess.on('message', function (msg) {
if (msg.result === constants.pipeline.built) { if (msg.result === constants.pipeline.built) {
webpackProcess.disconnect(); webpackProcess.disconnect();
if (msg.error) { return next(msg.error);
return next(msg.error);
}
return next();
} }
if (msg.result === constants.pipeline.log) { if (msg.result === constants.pipeline.log) {
@ -154,11 +153,10 @@ class Pipeline {
runPlugins(file, fileContent, fileCb) { runPlugins(file, fileContent, fileCb) {
const self = this; const self = this;
let pipelinePlugins = self.plugins.getPluginsFor('pipeline'); if (self.pipelinePlugins.length <= 0) {
if (pipelinePlugins.length <= 0) {
return fileCb(null, {content: fileContent, filename: file.filename, path: file.path, basedir: file.basedir, modified: true}); return fileCb(null, {content: fileContent, filename: file.filename, path: file.path, basedir: file.basedir, modified: true});
} }
async.eachSeries(pipelinePlugins, async.eachSeries(self.pipelinePlugins,
function(plugin, pluginCB) { function(plugin, pluginCB) {
if (file.options && file.options.skipPipeline) { if (file.options && file.options.skipPipeline) {
return pluginCB(); return pluginCB();