@@ -4,11 +4,10 @@ var dynamicPathParser = require('../../utilities/dynamic-path-parser');
44var addBarrelRegistration = require ( '../../utilities/barrel-management' ) ;
55var getFiles = Blueprint . prototype . files ;
66const stringUtils = require ( 'ember-cli-string-utils' ) ;
7- const astUtils = require ( '../../utilities/ast-utils' ) ;
87
98module . exports = {
109 description : '' ,
11-
10+
1211 availableOptions : [
1312 { name : 'flat' , type : Boolean , default : true }
1413 ] ,
@@ -26,10 +25,10 @@ module.exports = {
2625 flat : options . flat
2726 } ;
2827 } ,
29-
28+
3029 files : function ( ) {
3130 var fileList = getFiles . call ( this ) ;
32-
31+
3332 if ( this . options && this . options . flat ) {
3433 fileList = fileList . filter ( p => p . indexOf ( 'index.ts' ) <= 0 ) ;
3534 }
@@ -50,26 +49,17 @@ module.exports = {
5049 }
5150 } ;
5251 } ,
53-
52+
5453 afterInstall : function ( options ) {
5554 const returns = [ ] ;
5655 const fileName = stringUtils . dasherize ( `${ options . entity . name } .service` ) ;
57- const modulePath = path . join ( this . project . root , this . dynamicPath . appRoot , 'app.module.ts' ) ;
58- const componentDir = path . relative ( this . dynamicPath . appRoot , this . generatePath ) ;
59- const importPath = componentDir ? `./${ componentDir } /${ fileName } ` : `./${ fileName } ` ;
60- const className = stringUtils . classify ( `${ options . entity . name } Service` ) ;
6156
6257 if ( ! options . flat ) {
6358 returns . push ( addBarrelRegistration ( this , this . generatePath ) ) ;
6459 } else {
6560 returns . push ( addBarrelRegistration ( this , this . generatePath , fileName ) ) ;
6661 }
6762
68- returns . push (
69- astUtils . addProviderToModule ( modulePath , className , importPath )
70- . then ( change => change . apply ( ) ) ) ;
71-
72-
7363 return Promise . all ( returns ) ;
7464 }
7565} ;
0 commit comments