-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plopfile.ts
46 lines (42 loc) · 1.24 KB
/
plopfile.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { NodePlopAPI } from "plop";
import { PATTERNS_MAP } from "./app/_constants/patterns";
import { i18n } from "./app/_dictionaries/i18n-config";
export default function (plop: NodePlopAPI) {
const availableSections = Object.values(PATTERNS_MAP).map((p) => ({
name: p.name,
value: p.path,
}));
plop.setGenerator("pattern", {
description: "Generate pattern documentation outline",
prompts: [
{
type: "list",
name: "lang",
message: "Select documentation language",
choices: i18n.locales,
default: i18n.defaultLocale,
},
{
type: "list",
name: "section",
message: "Select documentation section",
choices: availableSections,
},
{
type: "input",
name: "name",
message: "What is the component name? (e.g., Breadcrumb)",
},
],
actions: [
{
type: "add",
path: "content/{{lang}}/patterns/{{section}}/{{kebabCase name}}.mdx",
templateFile: "templates/patterns/component.mdx.hbs",
},
],
});
// Helper for creating example code blocks
plop.setHelper("codeBlock", (content) => "```" + content + "```");
plop.addHelper("lowercase", (text) => text.toLowerCase());
}