34 lines
843 B
TypeScript
34 lines
843 B
TypeScript
module.exports = function(plop) {
|
|
// create your generators here
|
|
plop.setGenerator('New component', {
|
|
description: 'Create a new TSX + SCSS component for React.',
|
|
prompts: [
|
|
{
|
|
type: 'input',
|
|
name: 'name',
|
|
message: 'Component name'
|
|
}
|
|
], // array of inquirer prompts
|
|
actions: [
|
|
{
|
|
type: 'add',
|
|
path: 'src/components/{{ properCase name }}/{{ properCase name }}.tsx',
|
|
templateFile: 'plop-templates/component.tsx',
|
|
abortOnFail: true
|
|
},
|
|
{
|
|
type: 'add',
|
|
path: 'src/components/{{ properCase name }}/{{ properCase name }}.scss',
|
|
templateFile: 'plop-templates/component.scss',
|
|
abortOnFail: true
|
|
},
|
|
{
|
|
type: 'add',
|
|
path: 'src/components/{{ properCase name }}/index.ts',
|
|
templateFile: 'plop-templates/index.ts',
|
|
abortOnFail: true
|
|
}
|
|
] // array of actions
|
|
});
|
|
};
|