-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
77 lines (71 loc) · 1.35 KB
/
index.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
const path = require('path')
const prompts = [
{
name: 'name',
type: 'string',
message: 'Plugin name:',
required: true
},
{
name: 'description',
type: 'string',
message: 'Plugin description:',
required: false
},
{
name: 'author',
type: 'string',
required: false
},
{
name: 'modules',
type: 'checkbox',
message: 'Choose modules you want to develop:',
choices: ['uploader', 'transformer', 'beforeTransformPlugins', 'beforeUploadPlugins', 'afterUploadPlugins']
},
{
name: 'cli',
type: 'confirm',
message: 'Your plugin is just used in CLI?'
},
{
name: 'type',
type: 'list',
message: 'Use TS or JS?',
choices: [
{
name: 'Yes, use TS Project(recommended)',
value: 'ts',
short: 'ts'
},
{
name: 'Yes, use JS Project',
value: 'js',
short: 'js'
}
]
},
{
name: 'commands',
type: 'confirm',
message: 'Your plugin has some shortcut for GUI?'
}
]
const filters = {
"src/index.ts": "type === 'ts'",
"tsconfig.json": "type === 'ts'",
"src/index.js": "type === 'js'"
}
const complete = ({ options, ctx }) => {
ctx.log.success(`
Generate template files successfully!
Please cd ${options.dest}, and then
npm install
# or
yarn`)
}
module.exports = {
prompts,
filters,
complete
}