@@ -387,68 +387,40 @@ export class Generator extends Base {
387
387
this . config . set ( 'filters' , this . filters ) ;
388
388
this . config . save ( ) ;
389
389
} ,
390
- // TODO: switch to ng2 component generator
391
- // ngComponent: function() {
392
- // if(this.skipConfig) return;
393
- // var appPath = 'client/app/';
394
- // var extensions = [];
395
- // var filters = [
396
- // 'ngroute',
397
- // 'uirouter',
398
- // 'jasmine',
399
- // 'mocha',
400
- // 'expect',
401
- // 'should'
402
- // ].filter(v => this.filters[v]);
403
-
404
- // if(this.filters.ngroute) filters.push('ngroute');
405
- // if(this.filters.uirouter) filters.push('uirouter');
406
- // if(this.filters.babel) extensions.push('babel');
407
- // if(this.filters.ts) extensions.push('ts');
408
- // if(this.filters.js) extensions.push('js');
409
- // if(this.filters.html) extensions.push('html');
410
- // if(this.filters.pug) extensions.push('pug');
411
- // if(this.filters.css) extensions.push('css');
412
- // if(this.filters.stylus) extensions.push('styl');
413
- // if(this.filters.sass) extensions.push('scss');
414
- // if(this.filters.less) extensions.push('less');
415
-
416
- // filters.push('es6'); // Generate ES6 syntax code
417
- // filters.push('webpack'); // Generate ES6 Module imports/exports
418
-
419
- // this.composeWith('ng-component', {
420
- // options: {
421
- // 'routeDirectory': appPath,
422
- // 'directiveDirectory': appPath,
423
- // 'filterDirectory': appPath,
424
- // 'serviceDirectory': appPath,
425
- // 'componentDirectory': `${appPath}components/`,
426
- // 'filters': filters,
427
- // 'extensions': extensions,
428
- // 'basePath': 'client',
429
- // 'forceConfig': this.forceConfig
430
- // }
431
- // }, { local: require.resolve('generator-ng-component/generators/app/index.js') });
432
- // },
433
- // ngModules: function() {
434
- // var angModules = [
435
- // `'${this.scriptAppName}.constants'`,
436
- // "'ngCookies'",
437
- // "'ngResource'",
438
- // "'ngSanitize'"
439
- // ];
440
- // if(this.filters.ngroute) angModules.push("'ngRoute'");
441
- // if(this.filters.socketio) angModules.push("'btford.socket-io'");
442
- // if(this.filters.uirouter) angModules.push("'ui.router'");
443
- // if(this.filters.uibootstrap) angModules.push("'ui.bootstrap'");
444
- // if(this.filters.auth) {
445
- // angModules.unshift(`'${this.scriptAppName}.admin'`);
446
- // angModules.unshift(`'${this.scriptAppName}.auth'`);
447
- // angModules.push("'validation.match'");
448
- // }
449
-
450
- // this.angularModules = '\n ' + angModules.join(',\n ') +'\n';
451
- // }
390
+ angularComponent : function ( ) {
391
+ if ( this . skipConfig ) return ;
392
+ var appPath = 'client/app/' ;
393
+ var extensions = [ ] ;
394
+ var filters = [
395
+ 'jasmine' ,
396
+ 'mocha' ,
397
+ 'expect' ,
398
+ 'should'
399
+ ] . filter ( v => this . filters [ v ] ) ;
400
+
401
+ if ( this . filters . babel ) extensions . push ( 'babel' ) ;
402
+ if ( this . filters . ts ) extensions . push ( 'ts' ) ;
403
+ if ( this . filters . js ) extensions . push ( 'js' ) ;
404
+ if ( this . filters . html ) extensions . push ( 'html' ) ;
405
+ if ( this . filters . pug ) extensions . push ( 'pug' ) ;
406
+ if ( this . filters . css ) extensions . push ( 'css' ) ;
407
+ if ( this . filters . stylus ) extensions . push ( 'styl' ) ;
408
+ if ( this . filters . sass ) extensions . push ( 'scss' ) ;
409
+ if ( this . filters . less ) extensions . push ( 'less' ) ;
410
+
411
+ this . composeWith ( require . resolve ( 'generator-angular-fullstack-component/generators/app/index.js' ) , {
412
+ appModulePath : `${ appPath } app.module.${ this . filters . ts ? 'ts' : 'js' } ` ,
413
+ routeDirectory : appPath ,
414
+ directiveDirectory : appPath ,
415
+ filterDirectory : appPath ,
416
+ serviceDirectory : appPath ,
417
+ componentDirectory : `${ appPath } components/` ,
418
+ filters : filters ,
419
+ extensions : extensions ,
420
+ basePath : 'client' ,
421
+ forceConfig : this . forceConfig
422
+ } ) ;
423
+ } ,
452
424
} ;
453
425
}
454
426
0 commit comments