File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ module . exports = api => {
2+ api . describeTask ( {
3+ match : / v u e - c l i - s e r v i c e b a s e c / ,
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+ }
You can’t perform that action at this time.
0 commit comments