@@ -18,14 +18,17 @@ module.exports = {
18
18
{ name : 'prefix' , type : Boolean , default : true } ,
19
19
{ name : 'spec' , type : Boolean } ,
20
20
{ name : 'view-encapsulation' , type : String , aliases : [ 've' ] } ,
21
- { name : 'change-detection' , type : String , aliases : [ 'cd' ] }
21
+ { name : 'change-detection' , type : String , aliases : [ 'cd' ] } ,
22
+ { name : 'skip-import' , type : Boolean , default : false }
22
23
] ,
23
24
24
- beforeInstall : function ( ) {
25
+ beforeInstall : function ( options ) {
25
26
try {
26
27
this . pathToModule = findParentModule ( this . project , this . dynamicPath . dir ) ;
27
28
} catch ( e ) {
28
- throw `Error locating module for declaration\n\t${ e } ` ;
29
+ if ( ! options . skipImport ) {
30
+ throw `Error locating module for declaration\n\t${ e } ` ;
31
+ }
29
32
}
30
33
} ,
31
34
@@ -139,7 +142,7 @@ module.exports = {
139
142
const componentDir = path . relative ( path . dirname ( this . pathToModule ) , this . generatePath ) ;
140
143
const importPath = componentDir ? `./${ componentDir } /${ fileName } ` : `./${ fileName } ` ;
141
144
142
- if ( ! options [ 'skip-import' ] ) {
145
+ if ( ! options . skipImport ) {
143
146
returns . push (
144
147
astUtils . addDeclarationToModule ( this . pathToModule , className , importPath )
145
148
. then ( change => change . apply ( NodeHost ) ) ) ;
0 commit comments