rbk-templator/generators/library-generator.js
2021-04-02 14:34:46 +03:00

73 lines
2.3 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

module.exports = {
description: 'Create a java library project structure',
prompts: [
{
type: 'input',
name: 'name',
message: 'Как называется ваша либа?',
validate: function (value) {
if (value.length === 0) {
return "Вы не ввели имя!";
}
return true;
}
},
{
type: 'input',
name: 'description',
message: 'Введите описание вашей либы (maven.description):'
},
{
type: 'list',
name: 'language',
choices: ['Java', 'Kotlin'],
default: 'Java',
message: 'Выберите язык:'
},
{
type: 'input',
name: 'path',
message: 'В какой директории создать шаблон? [.]'
},
{
type: 'confirm',
name: 'withBuildUtils',
message: 'Хотите ли вы подключить build_utils?'
}
],
actions: [
{
type: 'add',
path: '{{pathHelper path}}Jenkinsfile',
templateFile: 'plop-templates/library/library-jenkinsfile'
},
{
type: 'add',
path: '{{pathHelper path}}src/main/java/com/rbkmoney/{{packageCase name}}/.gitkeep',
templateFile: 'plop-templates/gitkeep-template'
},
{
type: 'add',
path: '{{pathHelper path}}src/test/java/com/rbkmoney/{{packageCase name}}/.gitkeep',
templateFile: 'plop-templates/gitkeep-template'
},
(answers) => {
if (answers.withBuildUtils) {
let git = require('simple-git')(answers.path);
git.init();
git.subModule(["add", "-b", "master", "git@github.com:rbkmoney/build_utils.git", "build_utils"]);
}
},
{
type: 'add',
path: '{{pathHelper path}}.gitignore',
templateFile: 'plop-templates/gitignore-template'
},
{
type: 'add',
path: '{{pathHelper path}}pom.xml',
templateFile: 'plop-templates/library/library-pom.xml'
}
]
};