added recreate feature to skip all prompts and recreate installation configuration based on previsous selection in props.json

This commit is contained in:
jash
2018-10-08 16:20:34 +02:00
committed by kexkey
parent 886b2f7d8c
commit a7ccd08a2f
4 changed files with 24 additions and 8 deletions

View File

@@ -19,6 +19,10 @@ module.exports = class extends Generator {
constructor(args, opts) {
super(args, opts);
if( args.indexOf('recreate') !== -1 ) {
this.recreate = true;
}
if( fs.existsSync(this.destinationPath('props.json')) ) {
this.props = require(this.destinationPath('props.json'));
} else {
@@ -36,6 +40,10 @@ module.exports = class extends Generator {
}
prompting() {
if( this.recreate ) {
// no prompts
return;
}
const splash = fs.readFileSync(this.templatePath('splash.txt'));
this.log(splash.toString());