File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -108,15 +108,16 @@ export default Mixin.create({
108108 run . scheduleOnce ( 'afterRender' , this , this . updateOpenFiles ) ;
109109 } ,
110110
111- addComponent ( path ) {
111+ async addComponent ( path ) {
112112 //strip file extension if present
113113 path = path . replace ( / \. [ ^ / . ] + $ / , "" ) ;
114114
115- let isGlimmer = false ; // TODO: decide how to let user choose
115+ let isGlimmer = await this . emberCli . twiddleJson . hasAddon ( this . model , '@glimmer/component' ) ;
116116
117117 if ( this . isPathInvalid ( 'component' , path ) ) {
118118 return ;
119119 }
120+
120121 [ 'js' , 'hbs' ] . forEach ( ( fileExt , i ) => {
121122 let replacements = { } ;
122123 if ( fileExt === 'js' ) {
Original file line number Diff line number Diff line change @@ -130,6 +130,11 @@ export default Service.extend({
130130 } ) ;
131131 } ,
132132
133+ async hasAddon ( gist , addonName ) {
134+ let json = await this . _getTwiddleJson ( gist ) ;
135+ return addonName in json . addons ;
136+ } ,
137+
133138 _dedupEmberData ( json ) {
134139 if ( json . addons && json . addons . hasOwnProperty ( 'ember-data' ) ) {
135140 if ( json . dependencies && json . dependencies . hasOwnProperty ( 'ember-data' ) ) {
You can’t perform that action at this time.
0 commit comments