--pipeline option for `ebmark build|run` to spec webpack config name

This commit is contained in:
Michael Bradley, Jr 2018-08-16 15:51:34 -05:00
parent d98476733b
commit b41f5a397d
5 changed files with 15 additions and 5 deletions

View File

@ -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'
});
});
}

View File

@ -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();

View File

@ -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) {

View File

@ -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,

View File

@ -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) {