-
Notifications
You must be signed in to change notification settings - Fork 0
/
plopfile.mjs
63 lines (60 loc) · 1.26 KB
/
plopfile.mjs
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const uniq = (arr) => Array.from(new Set(arr));
const tags = uniq([
'thoughts',
'chakra',
'design-system',
'roadmap',
'finance',
'hiring',
'stock',
'testing',
'react',
'career',
'interview',
'panda',
'github-actions',
'ci',
]);
/**
* @param {import("plop").NodePlopAPI} plop
*/
function run(plop) {
plop.setGenerator('blog:create', {
description: 'Create a new blog',
prompts: [
{
type: 'input',
name: 'title',
message: 'What is the title of the blog?',
},
{
type: 'checkbox',
name: 'tags',
message: 'What are the tags for the blog?',
choices: tags,
},
{
type: 'input',
name: 'description',
message: 'What is the description of the blog?',
default: 'Some description about the blog',
},
],
actions: (data) => {
return [
{
type: 'add',
path: 'data/blog/{{kebabCase title}}.mdx',
templateFile: 'templates/blog.mdx.hbs',
data: {
title: data.title,
tags: data.tags,
description: data.description,
publishedAt: new Date().toISOString().split('T')[0],
},
},
];
},
});
}
export default run;