-
Notifications
You must be signed in to change notification settings - Fork 0
/
plopfile.mjs
49 lines (49 loc) · 1.18 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
export default function (plop) {
const d = new Date();
const s = {
minimumIntegerDigits: 2,
useGrouping: false,
};
plop.setGenerator("draft", {
description: "Draft a blog post",
prompts: [
{
type: "input",
name: "title",
message: "What is the title of the post?",
},
{
type: "input",
name: "slug",
message: "What is the slug of the post?",
default: "draft",
},
{
type: "input",
name: "date",
message: "What date would you like this post to have?",
default: `${d.getFullYear()}-${Number(d.getMonth() + 1).toLocaleString(
"en-US",
s
)}-${d.getDate().toLocaleString("en-US", s)}`,
},
{
type: "input",
name: "img",
message: "What is the URL of the main post image",
},
{
type: "input",
name: "attribution",
message: "What is the attribution text of the main post image",
},
],
actions: [
{
type: "add",
path: "./_posts/{{kebabCase date}}-{{kebabCase slug}}.mdx",
templateFile: "_templates/draft.hbs",
},
],
});
}