Skip to content

Commit 29b3ed6

Browse files
committed
fix generating a component
1 parent 204d5ea commit 29b3ed6

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

app/mixins/files.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,21 @@ export default Mixin.create({
112112
//strip file extension if present
113113
path = path.replace(/\.[^/.]+$/, "");
114114

115+
let isGlimmer = false; // TODO: decide how to let user choose
116+
115117
if (this.isPathInvalid('component', path)) {
116118
return;
117119
}
118120
['js', 'hbs'].forEach((fileExt, i)=>{
119-
let fileProperties = this.emberCli.buildProperties(`component-${fileExt}`);
121+
let replacements = {};
122+
if (fileExt === 'js') {
123+
replacements.importComponent = isGlimmer ?
124+
`import Component from '@glimmer/component';` :
125+
`import Component from '@ember/component';`;
126+
replacements.importTemplate = '';
127+
replacements.defaultExport = "class extends Component {\n}";
128+
}
129+
let fileProperties = this.emberCli.buildProperties(`component-${fileExt}`, replacements);
120130
let notPodPrefix = "components/";
121131
let filePath;
122132
if (path.substr(0, notPodPrefix.length) === notPodPrefix) {

lib/get-ember-cli-blueprints.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ function getEmberCLIBlueprints() {
88
let fileMap = {};
99

1010
let blueprintFiles = {
11-
"cliBlueprintFiles": {
12-
"path": "node_modules/ember-cli",
13-
"files": {
14-
"app": "app/files/app/app.js",
15-
"router": "app/files/app/router.js"
16-
}
17-
},
1811
"emberBlueprintFiles": {
1912
"path": "node_modules/ember-source",
2013
"files": {

0 commit comments

Comments
 (0)