--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('-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('--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('--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)') .description(__('deploy and build dapp at ') + 'dist/ (default: development)')
.action(function (env, _options) { .action(function (env, _options) {
i18n.setOrDetectLocale(_options.locale); i18n.setOrDetectLocale(_options.locale);
@ -107,6 +108,7 @@ class Cmd {
_options.logLevel = _options.loglevel; // fix casing _options.logLevel = _options.loglevel; // fix casing
_options.onlyCompile = _options.contracts; _options.onlyCompile = _options.contracts;
_options.client = _options.client || 'geth'; _options.client = _options.client || 'geth';
_options.webpackConfigName = _options.pipeline || 'production';
embark.build(_options); embark.build(_options);
}); });
} }
@ -123,6 +125,7 @@ class Cmd {
.option('--logfile [logfile]', __('filename to output logs (default: %s)', 'none')) .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('--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('--locale [locale]', __('language to use (default: en)'))
.option('--pipeline [pipeline]', __('webpack config to use (default: development)'))
.description(__('run dapp (default: %s)', 'development')) .description(__('run dapp (default: %s)', 'development'))
.action(function (env, options) { .action(function (env, options) {
i18n.setOrDetectLocale(options.locale); i18n.setOrDetectLocale(options.locale);
@ -135,7 +138,8 @@ class Cmd {
runWebserver: !options.noserver, runWebserver: !options.noserver,
useDashboard: !options.nodashboard, useDashboard: !options.nodashboard,
logFile: options.logfile, logFile: options.logfile,
logLevel: options.loglevel logLevel: options.loglevel,
webpackConfigName: options.pipeline || 'development'
}); });
}); });
} }

View File

@ -84,7 +84,8 @@ class EmbarkController {
logLevel: options.logLevel, logLevel: options.logLevel,
context: self.context, context: self.context,
useDashboard: options.useDashboard, useDashboard: options.useDashboard,
webServerConfig: webServerConfig webServerConfig: webServerConfig,
webpackConfigName: options.webpackConfigName
}); });
engine.init(); engine.init();
@ -191,7 +192,8 @@ class EmbarkController {
logger: options.logger, logger: options.logger,
config: options.config, config: options.config,
plugins: options.plugins, plugins: options.plugins,
context: this.context context: this.context,
webpackConfigName: options.webpackConfigName
}); });
engine.init(); engine.init();

View File

@ -18,6 +18,7 @@ class Engine {
this.useDashboard = options.useDashboard; this.useDashboard = options.useDashboard;
this.webServerConfig = options.webServerConfig; this.webServerConfig = options.webServerConfig;
this.ipcRole = options.ipcRole; this.ipcRole = options.ipcRole;
this.webpackConfigName = options.webpackConfigName;
} }
init(_options) { init(_options) {
@ -102,7 +103,8 @@ class Engine {
assetFiles: this.config.assetFiles, assetFiles: this.config.assetFiles,
events: this.events, events: this.events,
logger: this.logger, logger: this.logger,
plugins: this.plugins plugins: this.plugins,
webpackConfigName: this.webpackConfigName
}); });
this.events.on('code-generator-ready', function () { this.events.on('code-generator-ready', function () {
self.events.request('code', function (abi, contractsJSON) { self.events.request('code', function (abi, contractsJSON) {

View File

@ -14,6 +14,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.webpackConfigName = options.webpackConfigName;
this.pipelinePlugins = this.plugins.getPluginsFor('pipeline'); 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) { function assetFileWrite(next) {
async.eachOf(self.assetFiles, function (files, targetFile, cb) { async.eachOf(self.assetFiles, function (files, targetFile, cb) {
async.map(files, async.map(files,

View File

@ -13,7 +13,7 @@ let webpackProcess;
class WebpackProcess extends ProcessWrapper { class WebpackProcess extends ProcessWrapper {
constructor(options) { constructor(options) {
super(options); super(options);
this.env = options.env; this.webpackConfigName = options.webpackConfigName;
} }
build(file, importsList, callback) { build(file, importsList, callback) {