-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplopfile.js
35 lines (34 loc) · 894 Bytes
/
plopfile.js
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
const formatDate = require("./src/utils/format-date.js")
module.exports = function (plop) {
plop.setGenerator("posts", {
description: "generate a template file for posts",
prompts: [
{
type: "list",
name: "category",
message: "select the category:",
choices: ["front", "back", "mobile", "management", "career", "dev"],
default: 0,
},
{
type: "input",
name: "title",
message: "post title:",
},
],
actions: function (data) {
const formattedDate = formatDate(new Date())
return [
{
type: "add",
data: {
date: formattedDate.date,
hour: formattedDate.hour,
},
path: "posts/" + formattedDate.date + "-{{dashCase title}}.md",
templateFile: "plop-templates/post.hbs",
},
]
},
})
}