File tree 1 file changed +15
-7
lines changed
1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -37,15 +37,23 @@ module.exports = class ExportAPIDefGenerator extends ActionsMixin(yeoman) {
37
37
var app = require ( this . destinationRoot ( ) ) ;
38
38
var apiDef = apiGenerator . getApiDef ( app , options ) ;
39
39
40
- // Print to console if no output file specified.
41
- if ( filePath ) {
42
- mkdirp . sync ( path . dirname ( filePath ) ) ;
43
- fs . writeFileSync ( filePath , apiDef ) ;
40
+ if ( app . booting !== false ) {
41
+ app . on ( 'booted' , runGenerator ) ;
44
42
} else {
45
- process . stdout . write ( apiDef ) ;
43
+ runGenerator ( ) ;
46
44
}
47
45
48
- // Kill app if still alive
49
- setTimeout ( process . exit , 100 ) ;
46
+ function runGenerator ( ) {
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