(plop: PlopTypes.NodePlopAPI)
| 3 | // Learn more about Turborepo Generators at https://turbo.build/repo/docs/core-concepts/monorepos/code-generation |
| 4 | |
| 5 | export default function generator(plop: PlopTypes.NodePlopAPI): void { |
| 6 | // A simple generator to add a new React component to the internal UI library |
| 7 | plop.setGenerator('react-component', { |
| 8 | description: 'Adds a new react component', |
| 9 | prompts: [ |
| 10 | { |
| 11 | type: 'input', |
| 12 | name: 'name', |
| 13 | message: 'What is the name of the component?', |
| 14 | }, |
| 15 | ], |
| 16 | actions: [ |
| 17 | { |
| 18 | type: 'add', |
| 19 | path: 'src/{{kebabCase name}}.tsx', |
| 20 | templateFile: 'templates/component.hbs', |
| 21 | }, |
| 22 | { |
| 23 | type: 'append', |
| 24 | path: 'package.json', |
| 25 | pattern: /"exports": {(?<insertion>)/g, |
| 26 | template: '"./{{kebabCase name}}": "./src/{{kebabCase name}}.tsx",', |
| 27 | }, |
| 28 | ], |
| 29 | }); |
| 30 | } |
nothing calls this directly
no outgoing calls
no test coverage detected