-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ui.js
48 lines (48 loc) · 1.33 KB
/
ui.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
module.exports = (api) => {
api.describeTask({
match: /vue-cli-service basec/,
description: "Generates a new base component",
link: "https://github.com/DevTony101/vue-cli-plugin-clean#using-the-basec-command",
prompts: [
{
name: "prefix",
type: "input",
default: "Base",
description: "The prefix for the name of the component (it defaults to 'Base')",
},
{
name: "name",
type: "input",
default: "button",
description: "The name of the base component",
},
{
name: "scaffold",
type: "list",
default: "none",
choices: [
{
name: "button",
value: "button",
},
{
name: "none",
value: "none",
},
],
description: "If different of none, it will create a base component with a predefined template for the selected option",
},
],
onBeforeRun: async ({ answers, args }) => {
if (answers.name && answers.name.trim()) args.push(answers.name);
if (answers.prefix && answers.prefix.trim()) args.push("--prefix", answers.prefix);
switch (answers.scaffold) {
case "button":
args.push("--scaffold-button");
break;
default:
break;
}
},
});
};