-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplopfile.js
35 lines (34 loc) · 886 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
import limax from 'limax';
export default function (plop) {
plop.setGenerator('talk', {
description: 'Add new talk',
prompts: [{
type: 'input',
name: 'author',
message: 'Author name:'
},{
type: 'input',
name: 'title',
message: 'Title:'
}],
actions: function(data) {
const createdAt = Date.now();
const date = new Date().toISOString().split('T')[0];
const slug = limax(data.title);
const path = `${date}-${slug}`;
return [{
type: 'add',
path: `talks/${path}/package.json`,
templateFile: 'templates/package.json.hbs',
data: {createdAt, path}
}, {
type: 'add',
path: `talks/${path}/slides.md`,
templateFile: 'templates/slides.md.hbs',
}, {
type: 'add',
path: `talks/${path}/public/.gitkeep`,
}]
}
});
};