Skip to content

Commit

Permalink
feat(app): implements react choices on cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Henriquecesp committed Oct 24, 2021
1 parent 78c1ae1 commit d42986e
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,36 @@ class SecGenerator extends Generator {
{ name: 'NestJS TypeORM', value: 'nestjsTypeOrm' },
{ name: 'NestJS Mongoose', value: 'nestjsMongoose' },
{ name: 'NestJS PrismaORM', value: 'nestjsPrismaOrm' },
{ name: 'ReactJS', value: 'reactjs' },
],
},
{
when: answers => answers.framework === 'reactjs',
type: 'list',
name: 'reactjs',
message: 'Select your component type:',
choices: [
{ name: 'ReactJS Component', value: 'reactjsComponent' },
{ name: 'ReactJS Material-UI', value: 'reactjsMui' },
{ name: 'ReactJS StyledComponents', value: 'reactjsStyled' },
{ name: 'ReactJS ContextAPI', value: 'reactjsContext' },
{ name: 'ReactJS Hook', value: 'reactjsHook' },
],
},
])
}

frameworkChoice(framework) {
switch (framework) {
case 'reactjs':
return this.answers.reactjs
default:
return this.answers.framework
}
}

async writing() {
const framework = this.answers.framework
const framework = this.frameworkChoice(this.answers.framework)
const dir = path.join(__dirname, `templates/${framework}/`)

for await (const f of makeFileTemplate(dir, this.variables.name)) {
Expand Down

0 comments on commit d42986e

Please sign in to comment.