@@ -63,16 +63,15 @@ export class Generator extends Base {
63
63
this . log ( 'Out of the box I create an AngularJS app with an Express server.\n' ) ;
64
64
} ,
65
65
checkForConfig : function ( ) {
66
- var cb = this . async ( ) ;
67
66
var existingFilters = this . config . get ( 'filters' ) ;
68
67
69
68
if ( existingFilters ) {
70
- this . prompt ( [ {
69
+ return this . prompt ( [ {
71
70
type : 'confirm' ,
72
71
name : 'skipConfig' ,
73
72
message : 'Existing .yo-rc configuration found, would you like to use it?' ,
74
73
default : true ,
75
- } ] , answers => {
74
+ } ] ) . then ( answers => {
76
75
this . skipConfig = answers . skipConfig ;
77
76
78
77
if ( this . skipConfig ) {
@@ -92,11 +91,7 @@ export class Generator extends Base {
92
91
this . config . set ( 'filters' , this . filters ) ;
93
92
this . config . forceSave ( ) ;
94
93
}
95
-
96
- cb ( ) ;
97
94
} ) ;
98
- } else {
99
- cb ( ) ;
100
95
}
101
96
}
102
97
} ;
@@ -106,11 +101,10 @@ export class Generator extends Base {
106
101
return {
107
102
clientPrompts : function ( ) {
108
103
if ( this . skipConfig ) return ;
109
- var cb = this . async ( ) ;
110
104
111
105
this . log ( '# Client\n' ) ;
112
106
113
- this . prompt ( [ {
107
+ return this . prompt ( [ {
114
108
type : 'list' ,
115
109
name : 'transpiler' ,
116
110
message : 'What would you like to write scripts with?' ,
@@ -156,7 +150,7 @@ export class Generator extends Base {
156
150
name : 'uibootstrap' ,
157
151
message : 'Would you like to include UI Bootstrap?' ,
158
152
when : answers => answers . bootstrap
159
- } ] , answers => {
153
+ } ] ) . then ( answers => {
160
154
this . filters . js = true ;
161
155
this . filters [ answers . transpiler ] = true ;
162
156
insight . track ( 'transpiler' , answers . transpiler ) ;
@@ -184,18 +178,15 @@ export class Generator extends Base {
184
178
185
179
var styleExt = { sass : 'scss' , stylus : 'styl' } [ answers . stylesheet ] ;
186
180
this . styleExt = styleExt ? styleExt : answers . stylesheet ;
187
-
188
- cb ( ) ;
189
181
} ) ;
190
182
} ,
191
183
serverPrompts : function ( ) {
192
184
if ( this . skipConfig ) return ;
193
- var cb = this . async ( ) ;
194
185
var self = this ;
195
186
196
187
this . log ( '\n# Server\n' ) ;
197
188
198
- this . prompt ( [ {
189
+ return this . prompt ( [ {
199
190
type : 'checkbox' ,
200
191
name : 'odms' ,
201
192
message : 'What would you like to use for data modeling?' ,
@@ -245,7 +236,7 @@ export class Generator extends Base {
245
236
// to-do: should not be dependent on ODMs
246
237
when : answers => answers . odms && answers . odms . length !== 0 ,
247
238
default : true
248
- } ] , answers => {
239
+ } ] ) . then ( answers => {
249
240
if ( answers . socketio ) this . filters . socketio = true ;
250
241
insight . track ( 'socketio' , ! ! answers . socketio ) ;
251
242
@@ -284,18 +275,15 @@ export class Generator extends Base {
284
275
insight . track ( 'google-oauth' , ! ! this . filters [ 'googleAuth' ] ) ;
285
276
insight . track ( 'facebook-oauth' , ! ! this . filters [ 'facebookAuth' ] ) ;
286
277
insight . track ( 'twitter-oauth' , ! ! this . filters [ 'twitterAuth' ] ) ;
287
-
288
- cb ( ) ;
289
278
} ) ;
290
279
} ,
291
280
projectPrompts : function ( ) {
292
281
if ( this . skipConfig ) return ;
293
- var cb = this . async ( ) ;
294
282
var self = this ;
295
283
296
284
this . log ( '\n# Project\n' ) ;
297
285
298
- this . prompt ( [ {
286
+ return this . prompt ( [ {
299
287
type : 'list' ,
300
288
name : 'buildtool' ,
301
289
message : 'Would you like to use Gulp or Grunt?' ,
@@ -320,7 +308,7 @@ export class Generator extends Base {
320
308
choices : [ 'Expect' , 'Should' ] ,
321
309
filter : val => val . toLowerCase ( ) ,
322
310
when : answers => answers . testing === 'mocha'
323
- } ] , answers => {
311
+ } ] ) . then ( answers => {
324
312
this . filters [ answers . buildtool ] = true ;
325
313
insight . track ( 'buildtool' , answers . buildtool ) ;
326
314
@@ -338,8 +326,6 @@ export class Generator extends Base {
338
326
this . filters . should = false ;
339
327
this . filters . expect = false ;
340
328
}
341
-
342
- cb ( ) ;
343
329
} ) ;
344
330
}
345
331
} ;
0 commit comments