if dapp has a webpack.config.js, make a backup copy and proceed
This commit is contained in:
parent
f66552b044
commit
d14ee86c32
|
@ -411,17 +411,23 @@ class EmbarkController {
|
||||||
var fs = require('../lib/core/fs.js');
|
var fs = require('../lib/core/fs.js');
|
||||||
var dappConfig = fs.dappPath('webpack.config.js');
|
var dappConfig = fs.dappPath('webpack.config.js');
|
||||||
var embarkConfig = fs.embarkPath('lib/pipeline', 'webpack.config.js');
|
var embarkConfig = fs.embarkPath('lib/pipeline', 'webpack.config.js');
|
||||||
if (fs.existsSync(dappConfig)) {
|
let ext = 1;
|
||||||
console.error(`${dappConfig} ${__('already exists')}`.bold.red);
|
let dappConfigOld = dappConfig;
|
||||||
console.error(__('not overwritten, rename or re/move the file and re-run this command').yellow);
|
while (fs.existsSync(dappConfigOld)) {
|
||||||
process.exit(1);
|
dappConfigOld = dappConfig + `.${ext}`;
|
||||||
} else {
|
ext++;
|
||||||
|
}
|
||||||
|
if (dappConfigOld !== dappConfig) {
|
||||||
|
fs.copySync(dappConfig, dappConfigOld);
|
||||||
|
console.warn(`${dappConfig}`.yellow);
|
||||||
|
console.warn(__('copied to').dim.yellow);
|
||||||
|
console.warn(`${dappConfigOld}\n`.yellow);
|
||||||
|
}
|
||||||
fs.copySync(embarkConfig, dappConfig);
|
fs.copySync(embarkConfig, dappConfig);
|
||||||
console.log(`${embarkConfig}`.green);
|
console.log(`${embarkConfig}`.green);
|
||||||
console.log(__('copied to').dim.green);
|
console.log(__('copied to').dim.green);
|
||||||
console.log(`${dappConfig}`.green);
|
console.log(`${dappConfig}`.green);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
upload(options) {
|
upload(options) {
|
||||||
this.context = options.context || [constants.contexts.upload, constants.contexts.build];
|
this.context = options.context || [constants.contexts.upload, constants.contexts.build];
|
||||||
|
|
Loading…
Reference in New Issue