@naoufal/create-react-component
Version:
The fastest way to create React Components
54 lines (47 loc) • 1.14 kB
JavaScript
const {
validatePath,
validateName,
whenDirectoryDoesNotExist,
whenCreateDirectoryIsTrue,
templateChoices,
typeChoices
} = require('./helpers');
const pathQuestion = {
name: 'componentPath',
type: 'input',
message: 'Where would you like to create the component?',
validate: validatePath
};
const createDirectoryQuestion = {
name: 'createDirectory',
type: 'confirm',
'default': true,
message: 'This directory does not exist, would you like to create it?',
when: whenDirectoryDoesNotExist
}
const nameQuestion = {
name: 'componentName',
type: 'input',
message: 'What would you like to name the component?',
validate: validateName,
when: whenCreateDirectoryIsTrue
};
const templateQuestion = {
name: 'selectedTemplate',
type: 'list',
message: 'What component template would you like to use?',
choices: templateChoices
};
const typeQuestion = {
name: 'componentType',
type: 'list',
message: 'What type of component would like to create?',
choices: typeChoices
};
module.exports = {
pathQuestion,
createDirectoryQuestion,
nameQuestion,
templateQuestion,
typeQuestion
};