Skip to content

Commit 12c179f

Browse files
committed
generate gimmer components if addon included
1 parent e81c5a8 commit 12c179f

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

app/mixins/files.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff 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') {

app/services/twiddle-json.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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')) {

0 commit comments

Comments
 (0)