@@ -9,6 +9,10 @@ const COMMAND: GluegunCommand = {
9
9
description : 'cria um componente Angular do tipo widget' ,
10
10
run : async ( toolbox ) => {
11
11
const { parameters, print, prompt, template } = toolbox ;
12
+ const {
13
+ options : { path }
14
+ } = parameters ;
15
+
12
16
let componentName = parameters . first ;
13
17
14
18
if ( ! componentName ) {
@@ -28,20 +32,24 @@ const COMMAND: GluegunCommand = {
28
32
componentName = response . componentName ;
29
33
}
30
34
35
+ const componentPath = path
36
+ ? `${ path } /${ componentName } /${ componentName } `
37
+ : `./${ componentName } /${ componentName } ` ;
38
+
31
39
template . generate ( {
32
40
template : 'component.template.html.ejs' ,
33
- target : `./ ${ componentName } / ${ componentName } .component.html` ,
41
+ target : `${ componentPath } .component.html` ,
34
42
props : { name : componentName , ...strings }
35
43
} ) ;
36
44
37
45
template . generate ( {
38
46
template : 'component.template.scss.ejs' ,
39
- target : `./ ${ componentName } / ${ componentName } .component.scss`
47
+ target : `${ componentPath } .component.scss`
40
48
} ) ;
41
49
42
50
template . generate ( {
43
51
template : 'component.template.ts.ejs' ,
44
- target : `./ ${ componentName } / ${ componentName } .component.ts` ,
52
+ target : `${ componentPath } .component.ts` ,
45
53
props : {
46
54
type : 'component' ,
47
55
name : componentName ,
@@ -51,18 +59,18 @@ const COMMAND: GluegunCommand = {
51
59
52
60
template . generate ( {
53
61
template : 'widget.module.template.ts.ejs' ,
54
- target : `./ ${ componentName } / ${ componentName } .widget.module.ts` ,
62
+ target : `${ componentPath } .widget.module.ts` ,
55
63
props : {
56
64
type : 'component' ,
57
65
name : componentName ,
58
66
...strings
59
67
}
60
68
} ) ;
61
69
62
- printCreated ( print , `${ componentName } / ${ componentName } .component.html` ) ;
63
- printCreated ( print , `${ componentName } / ${ componentName } .component.ts` ) ;
64
- printCreated ( print , `${ componentName } / ${ componentName } .component.scss` ) ;
65
- printCreated ( print , `${ componentName } / ${ componentName } .widget.module.ts` ) ;
70
+ printCreated ( print , `${ componentPath } .component.html` ) ;
71
+ printCreated ( print , `${ componentPath } .component.ts` ) ;
72
+ printCreated ( print , `${ componentPath } .component.scss` ) ;
73
+ printCreated ( print , `${ componentPath } .widget.module.ts` ) ;
66
74
}
67
75
} ;
68
76
0 commit comments