1
1
'use strict' ;
2
2
3
3
const chalk = require ( 'chalk' ) ;
4
- const path = require ( 'path' ) ;
5
4
const SilentError = require ( 'silent-error' ) ;
6
5
const stringUtil = require ( 'ember-cli-string-utils' ) ;
7
- const pathUtil = require ( 'ember-cli-path-utils' ) ;
8
6
const getPathOption = require ( 'ember-cli-get-component-path-option' ) ;
9
7
const normalizeEntityName = require ( 'ember-cli-normalize-entity-name' ) ;
10
- const { EOL } = require ( 'os' ) ;
11
8
const { has } = require ( '@ember/edition-utils' ) ;
12
9
const { generateComponentSignature } = require ( '../-utils' ) ;
13
10
@@ -48,9 +45,9 @@ module.exports = {
48
45
} ,
49
46
{
50
47
name : 'component-structure' ,
51
- type : OCTANE ? [ 'flat' , 'nested' , 'classic' ] : [ 'classic '] ,
52
- default : OCTANE ? 'flat' : 'classic ',
53
- aliases : OCTANE ? [ { fs : 'flat' } , { ns : 'nested' } , { cs : 'classic' } ] : [ { cs : 'classic ' } ] ,
48
+ type : [ 'flat' , 'nested' ] ,
49
+ default : 'flat' ,
50
+ aliases : [ { fs : 'flat' } , { ns : 'nested' } ] ,
54
51
} ,
55
52
] ,
56
53
@@ -75,15 +72,9 @@ module.exports = {
75
72
option . default = '@ember/component' ;
76
73
}
77
74
} else if ( option . name === 'component-structure' ) {
78
- if ( isOctane ) {
79
- option . type = [ 'flat' , 'nested' , 'classic' ] ;
80
- option . default = 'flat' ;
81
- option . aliases = [ { fs : 'flat' } , { ns : 'nested' } , { cs : 'classic' } ] ;
82
- } else {
83
- option . type = [ 'classic' ] ;
84
- option . default = 'classic' ;
85
- option . aliases = [ { cs : 'classic' } ] ;
86
- }
75
+ option . type = [ 'flat' , 'nested' ] ;
76
+ option . default = 'flat' ;
77
+ option . aliases = [ { fs : 'flat' } , { ns : 'nested' } ] ;
87
78
}
88
79
} ) ;
89
80
@@ -107,12 +98,6 @@ module.exports = {
107
98
'Usage of --component-class argument to `ember generate component` is only available on canary'
108
99
) ;
109
100
}
110
-
111
- if ( options . componentStructure !== 'classic' ) {
112
- throw new SilentError (
113
- 'Usage of --component-structure argument to `ember generate component` is only available on canary'
114
- ) ;
115
- }
116
101
}
117
102
118
103
return this . _super . install . apply ( this , arguments ) ;
@@ -149,37 +134,7 @@ module.exports = {
149
134
fileMapTokens ( options ) {
150
135
let commandOptions = this . options ;
151
136
152
- if ( commandOptions . pod ) {
153
- return {
154
- __path__ ( ) {
155
- return path . join ( options . podPath , options . locals . path , options . dasherizedModuleName ) ;
156
- } ,
157
- __templatepath__ ( ) {
158
- return path . join ( options . podPath , options . locals . path , options . dasherizedModuleName ) ;
159
- } ,
160
- __templatename__ ( ) {
161
- return 'template' ;
162
- } ,
163
- } ;
164
- } else if (
165
- ! this . EMBER_GLIMMER_SET_COMPONENT_TEMPLATE ||
166
- commandOptions . componentStructure === 'classic'
167
- ) {
168
- return {
169
- __path__ ( ) {
170
- return 'components' ;
171
- } ,
172
- __templatepath__ ( ) {
173
- return 'templates/components' ;
174
- } ,
175
- __templatename__ ( ) {
176
- return options . dasherizedModuleName ;
177
- } ,
178
- } ;
179
- } else if (
180
- this . EMBER_GLIMMER_SET_COMPONENT_TEMPLATE &&
181
- commandOptions . componentStructure === 'flat'
182
- ) {
137
+ if ( this . EMBER_GLIMMER_SET_COMPONENT_TEMPLATE && commandOptions . componentStructure === 'flat' ) {
183
138
return {
184
139
__path__ ( ) {
185
140
return 'components' ;
@@ -236,19 +191,6 @@ module.exports = {
236
191
} ,
237
192
238
193
locals ( options ) {
239
- // if we're in an addon, build import statement
240
- let templatePath = '' ;
241
- if ( options . project . isEmberCLIAddon ( ) || ( options . inRepoAddon && ! options . inDummy ) ) {
242
- if ( options . pod ) {
243
- templatePath = './template' ;
244
- } else {
245
- templatePath =
246
- pathUtil . getRelativeParentPath ( options . entity . name ) +
247
- 'templates/components/' +
248
- stringUtil . dasherize ( options . entity . name ) ;
249
- }
250
- }
251
-
252
194
let componentClass = this . EMBER_GLIMMER_SET_COMPONENT_TEMPLATE
253
195
? options . componentClass
254
196
: '@ember/component' ;
@@ -264,12 +206,7 @@ module.exports = {
264
206
switch ( componentClass ) {
265
207
case '@ember/component' :
266
208
importComponent = `import Component from '@ember/component';` ;
267
- if ( templatePath ) {
268
- importTemplate = `import layout from '${ templatePath } ';${ EOL } ` ;
269
- defaultExport = `Component.extend({${ EOL } layout${ EOL } });` ;
270
- } else {
271
- defaultExport = `Component.extend({});` ;
272
- }
209
+ defaultExport = `Component.extend({});` ;
273
210
break ;
274
211
case '@glimmer/component' :
275
212
importComponent = `import Component from '@glimmer/component';` ;
0 commit comments