2022-04-11 18:28:07 +02:00
|
|
|
module.exports = (
|
|
|
|
/** @type {import('plop').NodePlopAPI} */
|
|
|
|
plop
|
2022-08-13 15:12:53 +02:00
|
|
|
) =>
|
2022-04-11 18:28:07 +02:00
|
|
|
plop.setGenerator('component', {
|
|
|
|
description: 'Generate a component',
|
|
|
|
prompts: [
|
|
|
|
{
|
|
|
|
type: 'input',
|
|
|
|
name: 'name',
|
2022-08-13 15:12:53 +02:00
|
|
|
message: "What's the component's name ?"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'input',
|
|
|
|
name: 'folder',
|
|
|
|
message: "What's the folder's name ?"
|
2022-04-11 18:28:07 +02:00
|
|
|
}
|
|
|
|
],
|
|
|
|
actions: [
|
|
|
|
{
|
|
|
|
type: 'add',
|
2022-08-13 15:12:53 +02:00
|
|
|
path: 'components/{{folder}}/{{properCase name}}/{{properCase name}}.tsx',
|
|
|
|
templateFile: 'generators/Component/Component.tsx.hbs'
|
2022-04-11 18:28:07 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'add',
|
2022-08-13 15:12:53 +02:00
|
|
|
path: 'components/{{folder}}/{{properCase name}}/index.ts',
|
|
|
|
templateFile: 'generators/Component/index.ts.hbs'
|
2022-04-11 18:28:07 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|