From 25be46af2c78feb7a05b284de41f34a694201b9b Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Thu, 19 Jul 2018 20:47:11 -0500 Subject: [PATCH] propagate env --- lib/core/engine.js | 1 + lib/pipeline/pipeline.js | 4 +++- lib/process/processLauncher.js | 1 + lib/process/processWrapper.js | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/core/engine.js b/lib/core/engine.js index 844efd469..71b8ec2ed 100644 --- a/lib/core/engine.js +++ b/lib/core/engine.js @@ -100,6 +100,7 @@ class Engine { this.events.emit("status", "Building Assets"); const Pipeline = require('../pipeline/pipeline.js'); const pipeline = new Pipeline({ + env: this.env, buildDir: this.config.buildDir, contractsFiles: this.config.contractsFiles, assetFiles: this.config.assetFiles, diff --git a/lib/pipeline/pipeline.js b/lib/pipeline/pipeline.js index d86253487..79ed54ea2 100644 --- a/lib/pipeline/pipeline.js +++ b/lib/pipeline/pipeline.js @@ -12,6 +12,7 @@ require("babel-preset-es2017"); class Pipeline { constructor(options) { + this.env = options.env; this.buildDir = options.buildDir; this.contractsFiles = options.contractsFiles; this.assetFiles = options.assetFiles; @@ -103,6 +104,7 @@ class Pipeline { function runWebpack(next) { let built = false; const webpackProcess = new ProcessLauncher({ + env: self.env, modulePath: utils.joinPath(__dirname, 'webpackProcess.js'), logger: self.logger, events: self.events, @@ -115,7 +117,7 @@ class Pipeline { } } }); - webpackProcess.send({action: constants.pipeline.init, options: {}}); + webpackProcess.send({action: constants.pipeline.init, options: {env: self.env}}); webpackProcess.send({action: constants.pipeline.build, file, importsList}); webpackProcess.once('result', constants.pipeline.built, (msg) => { diff --git a/lib/process/processLauncher.js b/lib/process/processLauncher.js index 9c2c1b1d1..8487e8a43 100644 --- a/lib/process/processLauncher.js +++ b/lib/process/processLauncher.js @@ -14,6 +14,7 @@ class ProcessLauncher { * @return {ProcessLauncher} The ProcessLauncher instance */ constructor(options) { + this.env = options.env; this.name = path.basename(options.modulePath); this.process = child_process.fork(options.modulePath); this.logger = options.logger; diff --git a/lib/process/processWrapper.js b/lib/process/processWrapper.js index 6154ab4dd..82666a475 100644 --- a/lib/process/processWrapper.js +++ b/lib/process/processWrapper.js @@ -17,6 +17,7 @@ class ProcessWrapper { */ constructor(_options) { this.interceptLogs(); + this.env = _options ? _options.env : 'development'; this.events = new Events(); this.pingParent();