PromucFlow_constructor/app/client/packages/design-system/ads/plopfile.mjs

54 lines
1.5 KiB
JavaScript
Raw Normal View History

2024-07-29 13:23:26 +00:00
export default function (plop) {
plop.addHelper("capitalize", (text) => {
return text.charAt(0).toUpperCase() + text.slice(1);
});
// component generator
plop.setGenerator("component", {
description: "Component generator",
prompts: [
{
type: "input",
name: "name",
message: "Enter component name",
},
],
actions: [
{
type: "add",
path: "src/{{capitalize name}}/{{capitalize name}}.tsx",
templateFile: "plop-templates/component.tsx.hbs",
},
{
type: "add",
path: "src/{{capitalize name}}/index.ts",
templateFile: "plop-templates/index.ts.hbs",
},
{
type: "add",
path: "src/{{capitalize name}}/{{capitalize name}}.stories.tsx",
templateFile: "plop-templates/stories.tsx.hbs",
},
{
type: "add",
path: "src/{{capitalize name}}/{{capitalize name}}.styles.tsx",
templateFile: "plop-templates/styles.tsx.hbs",
},
{
type: "add",
path: "src/{{capitalize name}}/{{capitalize name}}.types.ts",
templateFile: "plop-templates/types.ts.hbs",
},
{
type: "add",
path: "src/{{capitalize name}}/{{capitalize name}}.constants.ts",
templateFile: "plop-templates/constants.ts.hbs",
},
{
type: "add",
path: "src/{{capitalize name}}/{{capitalize name}}.mdx",
templateFile: "plop-templates/component.mdx.hbs",
},
],
});
}