@@ -130,12 +130,11 @@ export class Generator extends Base {
130130 } [ val ] ;
131131 }
132132 } , {
133- // TODO: enable once Babel setup supports Flow
134- // type: 'confirm',
135- // name: 'flow',
136- // message: 'Would you like to use Flow types with Babel?',
137- // when: answers => answers.transpiler === 'babel'
138- // }, {
133+ type : 'confirm' ,
134+ name : 'flow' ,
135+ message : 'Would you like to use Flow types with Babel?' ,
136+ when : answers => answers . transpiler === 'babel'
137+ } , {
139138 type : 'list' ,
140139 name : 'markup' ,
141140 message : 'What would you like to write markup with?' ,
@@ -453,15 +452,16 @@ export class Generator extends Base {
453452 ]);
454453 */
455454
455+ const flow = this . filters . flow ;
456+
456457 let babelPlugins = [
457458 'babel-plugin-syntax-flow' ,
458459 'babel-plugin-syntax-class-properties'
459460 ] ;
460461
461- // TODO: enable once Babel setup supports Flow
462- // if(this.filters.babel && !this.filters.flow) {
462+ if ( this . filters . babel && ! flow ) {
463463 babelPlugins . push ( 'babel-plugin-transform-flow-strip-types' ) ;
464- // }
464+ }
465465
466466 let jsFilter = filter ( [ 'client/**/*.js' ] , { restore : true } ) ;
467467 this . registerTransformStream ( [
@@ -470,7 +470,14 @@ export class Generator extends Base {
470470 plugins : babelPlugins . map ( require . resolve ) ,
471471 /* Babel get's confused about these if you're using an `npm link`ed
472472 generator-angular-fullstack, thus the `require.resolve` */
473- // retainLines: true,
473+ shouldPrintComment ( commentContents ) {
474+ if ( flow ) {
475+ return true ;
476+ } else {
477+ // strip `// @flow` comments if not using flow
478+ return ! ( / @ f l o w ) / . test ( commentContents ) ) ;
479+ }
480+ } ,
474481 babelrc : false // don't grab the generator's `.babelrc`
475482 } ) ,
476483 beaufityStream ( {
0 commit comments