-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplopfile.js
56 lines (56 loc) · 1.32 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// 接收plop对象,用于创建生成器任务
module.exports = (plop) => {
plop.setHelper('time', () => {
const date = new Date()
return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`
})
// param 生成器名称 生成器配置选项
plop.setGenerator('create', {
description: '添加文档并格式化',
prompts: [
{
type: 'input',
name: 'name',
message: '文档名称',
default: 'text',
},
{
type: 'list',
name: 'module',
message: '选择创建文件到下面哪个文件夹',
choices: [
'css',
'docker',
'electron',
'flutter',
'git',
'javascript',
'linux',
'mobile',
'nest',
'node',
'photography',
'pnpm',
'prosemirror',
'react',
'react native',
'taro',
'tiptap',
'tool',
'vite',
'vue',
'vscode',
'webrtc',
'work',
],
},
],
actions: [
{
type: 'add', // 代表添加全新文件
path: `docs/{{module}}/{{name}}.md`,
templateFile: 'plop-templates/docs.md.hbs',
},
],
})
}