UNPKG

generator-springboot-hexagonal

Version:

A code generator for SpringBoot microservices in Hexagonal Architecture

92 lines (86 loc) 2.69 kB
module.exports = { prompting }; function prompting() { const done = this.async(); const prompts = [ { type: 'string', name: 'appName', validate: input => /^([a-z_][a-z0-9_\-]*)$/.test(input) ? true : 'The application name you have provided is not valid', message: 'What is the application name?', default: 'myservice' }, { type: 'string', name: 'packageName', validate: input => /^([a-z_][a-z0-9_]*(\.[a-z_][a-z0-9_]*)*)$/.test(input) ? true : 'The package name you have provided is not a valid Java package name.', message: 'What is the default package name?', default: 'com.mycompany.myservice' }, { type: 'list', name: 'databaseType', message: 'Which type of database you want to use?', choices: [ { value: 'postgresql', name: 'Postgresql' }, { value: 'mysql', name: 'MySQL' }, { value: 'mariadb', name: 'MariaDB' } ], default: 'postgresql' }, { type: 'list', name: 'dbMigrationTool', message: 'Which type of database migration tool you want to use?', choices: [ { value: 'flywaydb', name: 'FlywayDB' }, { value: 'none', name: 'None' } ], default: 'flywaydb' }, { type: 'list', name: 'buildTool', message: 'Which build tool do you want to use?', choices: [ { value: 'maven', name: 'Maven' }, { value: 'gradle', name: 'Gradle' } ], default: 'maven' } ]; this.prompt(prompts).then(answers => { Object.assign(this.configOptions, answers); this.configOptions.packageFolder = this.configOptions.packageName.replace(/\./g, '/'); this.configOptions.features = this.configOptions.features || []; done(); }); }