diff --git a/cmd/cmd.js b/cmd/cmd.js index 53ba06f1b..dbb43412c 100644 --- a/cmd/cmd.js +++ b/cmd/cmd.js @@ -99,6 +99,7 @@ class Cmd { .option('-c, --client [client]', __('Use a specific ethereum client or simulator (supported: %s)', 'geth, testrpc')) .option('--loglevel [loglevel]', __('level of logging to display') + ' ["error", "warn", "info", "debug", "trace"]', /^(error|warn|info|debug|trace)$/i, 'debug') .option('--locale [locale]', __('language to use (default: en)')) + .option('--pipeline [pipeline]', __('webpack config to use (default: production)')) .description(__('deploy and build dapp at ') + 'dist/ (default: development)') .action(function (env, _options) { i18n.setOrDetectLocale(_options.locale); @@ -107,6 +108,7 @@ class Cmd { _options.logLevel = _options.loglevel; // fix casing _options.onlyCompile = _options.contracts; _options.client = _options.client || 'geth'; + _options.webpackConfigName = _options.pipeline || 'production'; embark.build(_options); }); } @@ -123,6 +125,7 @@ class Cmd { .option('--logfile [logfile]', __('filename to output logs (default: %s)', 'none')) .option('--loglevel [loglevel]', __('level of logging to display') + ' ["error", "warn", "info", "debug", "trace"]', /^(error|warn|info|debug|trace)$/i, 'debug') .option('--locale [locale]', __('language to use (default: en)')) + .option('--pipeline [pipeline]', __('webpack config to use (default: development)')) .description(__('run dapp (default: %s)', 'development')) .action(function (env, options) { i18n.setOrDetectLocale(options.locale); @@ -135,7 +138,8 @@ class Cmd { runWebserver: !options.noserver, useDashboard: !options.nodashboard, logFile: options.logfile, - logLevel: options.loglevel + logLevel: options.loglevel, + webpackConfigName: options.pipeline || 'development' }); }); } diff --git a/cmd/cmd_controller.js b/cmd/cmd_controller.js index 43f5523f1..93af42a4b 100644 --- a/cmd/cmd_controller.js +++ b/cmd/cmd_controller.js @@ -84,7 +84,8 @@ class EmbarkController { logLevel: options.logLevel, context: self.context, useDashboard: options.useDashboard, - webServerConfig: webServerConfig + webServerConfig: webServerConfig, + webpackConfigName: options.webpackConfigName }); engine.init(); @@ -191,7 +192,8 @@ class EmbarkController { logger: options.logger, config: options.config, plugins: options.plugins, - context: this.context + context: this.context, + webpackConfigName: options.webpackConfigName }); engine.init(); diff --git a/lib/core/engine.js b/lib/core/engine.js index c6857095f..3c54aa368 100644 --- a/lib/core/engine.js +++ b/lib/core/engine.js @@ -18,6 +18,7 @@ class Engine { this.useDashboard = options.useDashboard; this.webServerConfig = options.webServerConfig; this.ipcRole = options.ipcRole; + this.webpackConfigName = options.webpackConfigName; } init(_options) { @@ -102,7 +103,8 @@ class Engine { assetFiles: this.config.assetFiles, events: this.events, logger: this.logger, - plugins: this.plugins + plugins: this.plugins, + webpackConfigName: this.webpackConfigName }); this.events.on('code-generator-ready', function () { self.events.request('code', function (abi, contractsJSON) { diff --git a/lib/pipeline/pipeline.js b/lib/pipeline/pipeline.js index 76f69e427..b5829f30b 100644 --- a/lib/pipeline/pipeline.js +++ b/lib/pipeline/pipeline.js @@ -14,6 +14,7 @@ class Pipeline { this.events = options.events; this.logger = options.logger; this.plugins = options.plugins; + this.webpackConfigName = options.webpackConfigName; this.pipelinePlugins = this.plugins.getPluginsFor('pipeline'); } @@ -81,6 +82,7 @@ class Pipeline { }); }); }, + webpackProcess.send({action: constants.pipeline.init, options: {webpackConfigName: self.webpackConfigName}}); function assetFileWrite(next) { async.eachOf(self.assetFiles, function (files, targetFile, cb) { async.map(files, diff --git a/lib/pipeline/webpackProcess.js b/lib/pipeline/webpackProcess.js index 32e579fb2..ef420626a 100644 --- a/lib/pipeline/webpackProcess.js +++ b/lib/pipeline/webpackProcess.js @@ -13,7 +13,7 @@ let webpackProcess; class WebpackProcess extends ProcessWrapper { constructor(options) { super(options); - this.env = options.env; + this.webpackConfigName = options.webpackConfigName; } build(file, importsList, callback) {