Skip to content

Commit f7d2765

Browse files
committed
Adding UI integration for customizable options
1 parent 71cc3e9 commit f7d2765

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

ui.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
module.exports = api => {
2+
api.describeTask({
3+
match: /vue-cli-service basec/,
4+
description: "Generates a new base component",
5+
link: 'https://github.com/DevTony101/vue-cli-plugin-clean#features-',
6+
icon: "description",
7+
prompts: [
8+
{
9+
name: "name",
10+
type: "input",
11+
default: "button",
12+
description: "The name of the base component (without the preffix)"
13+
},
14+
{
15+
name: "preffix",
16+
type: "input",
17+
default: "Base",
18+
description: "The preffix for the name of the component (it defaults to 'Base')"
19+
},
20+
{
21+
name: "scaffold",
22+
type: "list",
23+
default: "none",
24+
choices: [
25+
{
26+
name: "button",
27+
value: "button"
28+
},
29+
{
30+
name: "none",
31+
value: "none"
32+
}
33+
],
34+
description: "If different of none, it will create a base component with a predefined template for the selected option"
35+
}
36+
],
37+
onBeforeRun: async ({ answers, args }) => {
38+
if (answers.name && answers.name.trim()) args.push(answers.name);
39+
if (answers.preffix && answers.preffix.trim()) args.push("--preffix", answers.preffix);
40+
switch (answers.scaffold) {
41+
case "button":
42+
args.push("--scaffold-button");
43+
break;
44+
}
45+
}
46+
});
47+
}

0 commit comments

Comments
 (0)