vchikalkin 80619ff7e2 apps: remove docs
packages: add @vchikalkin/eslint-config-awesome
packages: upgrade packages
.vscode: update settings.json
2023-11-02 17:27:52 +03:00

32 lines
980 B
TypeScript

import type { PlopTypes } from '@turbo/gen';
// Learn more about Turborepo Generators at https://turbo.build/repo/docs/core-concepts/monorepos/code-generation
// eslint-disable-next-line import/no-default-export -- Turbo generators require default export
export default function generator(plop: PlopTypes.NodePlopAPI): void {
// A simple generator to add a new React component to the internal UI library
plop.setGenerator('react-component', {
actions: [
{
path: '{{pascalCase name}}.tsx',
templateFile: 'templates/component.hbs',
type: 'add',
},
{
path: 'index.tsx',
pattern: /(?<insertion>\/\/ component exports)/gu,
template: 'export * from "./{{pascalCase name}}";',
type: 'append',
},
],
description: 'Adds a new react component',
prompts: [
{
message: 'What is the name of the component?',
name: 'name',
type: 'input',
},
],
});
}