-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplopfile.js
139 lines (139 loc) · 3.61 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
module.exports = function (plop) {
plop.setHelper('upperCase', (txt) => txt.toUpperCase().replace(" ","-"));
// create your generators here
plop.setGenerator('blueprint', {
description: 'set a new blueprint to start with',
prompts: [{
type: 'input',
name: 'name',
message: 'workflow name'
},
{
type: 'input',
name: 'description',
message: 'workflow description'
}],
actions: [{
type: 'add',
path: 'src/blueprints/{{name}}.js',
templateFile: 'templates/blueprint.hbs'
}]
});
plop.setGenerator('node', {
description: 'set a new node spec',
prompts: [{
type: 'list',
name: 'type',
message: 'node type',
choices: ["finish","flow","formRequest","http","start","startProcess","subProcess","systemTask","timer","userTask"],
loop: false
},
{
type: 'input',
name: 'name',
message: 'node name'
},
{
type: 'input',
name: 'id',
message: 'node id',
default: function (response) {
return response.name.toUpperCase().replace(" ","-");
}
}, {
when: function (response) {
return !["finish"].includes(response.type)
},
type: 'input',
name: 'next',
message: 'next node id (default option for flow nodes)',
default: "END"
},
{
type: 'input',
name: 'lane',
message: 'lane id',
default: "free"
}, {
when: function (response) {
return ["userTask"].includes(response.type)
},
type: 'input',
name: 'action',
message: "UserTask Action"
}, {
when: function (response) {
return ["userTask"].includes(response.type)
},
type: 'list',
name: 'activityManager',
message: "Activity Manager Type",
choices: ["commit","notify"],
loop: false,
default: "commit"
}, {
when: function (response) {
return ["formRequest","http"].includes(response.type)
},
type: 'input',
name: 'url',
message: 'endpoint',
default: "{ $mustache: 'any' }"
}, {
when: function (response) {
return ["formRequest","http"].includes(response.type)
},
type: 'list',
name: 'verb',
message: 'endpoint',
choices: ["GET","POST","PUT","PATCH","DELETE"],
loop: false,
default: "GET"
}, {
when: function (response) {
return ["formRequest","http"].includes(response.type)
},
type: 'input',
name: 'responseCodes',
message: 'Valid Response Codes',
default: "200,201,202"
}, {
when: function (response) {
return ["formRequest","http"].includes(response.type)
},
type: 'number',
name: 'maxLength',
message: 'Max Content Length',
default: 2000
}, {
when: function (response) {
return ["startProcess","subProcess"].includes(response.type)
},
type: 'input',
name: 'workflow',
message: "Workflow name to start"
}, {
when: function (response) {
return ["formRequest","http","start","timer","userTask"].includes(response.type)
},
type: 'number',
name: 'timeout',
message: "timeout in seconds",
default: 600
}, {
when: function (response) {
return ["systemTask"].includes(response.type)
},
type: 'input',
name: 'category',
message: "system task category"
}],
actions: function(data) {
return [{
type: 'add',
path: 'src/nodes/specs/{{camelCase name}}.js',
templateFile: `templates/${data.type}.hbs`
}]
}
});
}