File tree 1 file changed +16
-8
lines changed
1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -35,17 +35,25 @@ module.exports = class ExportAPIDefGenerator extends ActionsMixin(yeoman) {
35
35
var filePath = this . options . output ;
36
36
var options = { format : this . format , output : filePath } ;
37
37
var app = require ( this . destinationRoot ( ) ) ;
38
- var apiDef = apiGenerator . getApiDef ( app , options ) ;
39
38
40
- // Print to console if no output file specified.
41
- if ( filePath ) {
42
- mkdirp . sync ( path . dirname ( filePath ) ) ;
43
- fs . writeFileSync ( filePath , apiDef ) ;
39
+ if ( app . booting ) {
40
+ app . on ( 'booted' , runGenerator ) ;
44
41
} else {
45
- process . stdout . write ( apiDef ) ;
42
+ runGenerator ( ) ;
46
43
}
47
44
48
- // Kill app if still alive
49
- setTimeout ( process . exit , 100 ) ;
45
+ function runGenerator ( ) {
46
+ var apiDef = apiGenerator . getApiDef ( app , options ) ;
47
+ // Print to console if no output file specified.
48
+ if ( filePath ) {
49
+ mkdirp . sync ( path . dirname ( filePath ) ) ;
50
+ fs . writeFileSync ( filePath , apiDef ) ;
51
+ } else {
52
+ process . stdout . write ( apiDef ) ;
53
+ }
54
+
55
+ // Kill app if still alive
56
+ setTimeout ( process . exit , 100 ) ;
57
+ }
50
58
}
51
59
} ;
You can’t perform that action at this time.
0 commit comments