-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathprompttexts.js
More file actions
173 lines (169 loc) · 5.04 KB
/
Copy pathprompttexts.js
File metadata and controls
173 lines (169 loc) · 5.04 KB
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
const { valid, satisfies } = require("semver");
function promptWidgetProperties(mxProjectDir, widgetName) {
return [
{
type: "input",
name: "name",
validate: input => {
if (/^([a-zA-Z]+)$/.test(input)) {
return true;
}
return "Your widget name can only contain one or more letters (a-z & A-Z). Please provide a valid name";
},
message: "What is the name of your widget?",
default: widgetName ? widgetName : "MyWidget"
},
{
type: "input",
name: "description",
message: "Enter a description for your widget",
default: "My widget description"
},
{
type: "input",
name: "prompt",
message: "Enter prompt for your widget (optional)",
default: ""
},
{
type: "input",
name: "organization",
message: "Organization name",
default: "Mendix",
store: true
},
{
type: "input",
name: "copyright",
message: "Add a copyright",
default: `© Mendix Technology BV ${new Date().getFullYear()}. All rights reserved.`,
store: true
},
{
type: "input",
name: "license",
message: "Add a license",
default: "Apache-2.0",
store: true
},
{
type: "input",
name: "version",
validate(input) {
if (valid(input) && satisfies(input, ">=0.0.1")) {
return true;
}
return "Your version needs to be formatted as x.x.x and starts at 0.0.1";
},
message: "Initial version",
default: "1.0.0"
},
{
type: "input",
name: "author",
message: "Author",
default: "John",
store: true
},
{
type: "input",
name: "projectPath",
message: "Mendix project path",
default: mxProjectDir ? mxProjectDir : "./tests/testProject"
},
{
type: "list",
name: "programmingLanguage",
message: "Which programming language do you want to use for the widget?",
choices: [
{
name: "JavaScript ES6",
value: "javascript"
},
{
name: "TypeScript",
value: "typescript"
}
],
default: "javascript",
store: true
},
{
type: "list",
name: "programmingStyle",
message: "Which type of components do you want to use?",
choices: [
{
name: "Class Components",
value: "class"
},
{
name: "Function Components",
value: "function"
}
],
default: "class",
store: true
},
{
type: "list",
name: "platform",
message: "Which type of widget are you developing?",
choices: [
{
name: "For web and hybrid mobile apps",
value: "web"
},
{
name: "For native mobile apps",
value: "native"
}
],
default: "web",
store: true
},
{
type: "list",
name: "boilerplate",
message: "Which template do you want to use for the widget?",
choices: [
{
name: "Full Boilerplate (recommended for beginners)",
value: "full"
},
{
name: "Empty widget (recommended for more experienced developers)",
value: "empty"
}
],
default: "full",
store: true
}
];
}
function promptTestsInfo(props) {
if (props) {
const prompts = [
{
type: "confirm",
name: "hasUnitTests",
message: "Add unit tests for the widget ? (recommended for Full Boilerplate)",
default: !!(props.boilerplate && props.boilerplate === "full")
}
];
if (props.platform && props.platform === "web") {
prompts.push({
type: "confirm",
name: "hasE2eTests",
message: "Add End-to-end tests for the widget ? (recommended for Full Boilerplate)",
default: !!(props.boilerplate && props.boilerplate === "full")
});
}
return prompts;
}
return [];
}
module.exports = {
promptWidgetProperties,
promptTestsInfo
};