`embark eject-webpack` command

This commit is contained in:
Michael Bradley, Jr 2018-08-16 18:02:54 -05:00
parent 35f92f2ae8
commit 2670476d5e
2 changed files with 26 additions and 0 deletions

View File

@ -18,6 +18,7 @@ class Cmd {
this.simulator();
this.test();
this.reset();
this.ejectWebpack();
this.graph();
this.upload();
this.versionCmd();
@ -280,6 +281,15 @@ class Cmd {
});
}
ejectWebpack() {
program
.command('eject-webpack')
.description(__('copy the default webpack config into your dapp for customization'))
.action(function () {
embark.ejectWebpack();
});
}
versionCmd() {
program
.command('version')

View File

@ -411,6 +411,22 @@ class EmbarkController {
console.log(__("reset done!").green);
}
ejectWebpack() {
var fs = require('../lib/core/fs.js');
var dappConfig = fs.dappPath('webpack.config.js');
var embarkConfig = fs.embarkPath('webpack.config.js');
if (fs.existsSync(dappConfig)) {
console.error(`${dappConfig} ${__('already exists')}`.bold.red);
console.error(__('not overwritten, rename or re/move the file and re-run this command').yellow);
process.exit(1);
} else {
fs.copySync(embarkConfig, dappConfig);
console.log(`${embarkConfig}`.green);
console.log(__('copied to').dim.green);
console.log(`${dappConfig}`.green);
}
}
upload(options) {
this.context = options.context || [constants.contexts.upload, constants.contexts.build];