@@ -82,9 +82,10 @@ Please make sure you're pointing to the right custom template path in your gener
82
82
83
83
function componentTemplateGenerator ( { cmd, componentName, cliConfigFile } ) {
84
84
const { cssPreprocessor, testLibrary, usesCssModule, usesTypeScript } = cliConfigFile ;
85
- const { customTemplates } = cliConfigFile . component [ cmd . type ] ;
85
+ const { customTemplates, flat } = cliConfigFile . component [ cmd . type ] ;
86
86
let template = null ;
87
87
let filename = null ;
88
+ const isFlat = flat || cmd . flat ;
88
89
89
90
// Check for a custom component template.
90
91
@@ -133,16 +134,17 @@ function componentTemplateGenerator({ cmd, componentName, cliConfigFile }) {
133
134
}
134
135
135
136
return {
136
- componentPath : `${ cmd . path } ${ cmd . flat ? '' : `/${ componentName } ` } /${ filename } ` ,
137
+ componentPath : `${ cmd . path } ${ isFlat ? '' : `/${ componentName } ` } /${ filename } ` ,
137
138
filename,
138
139
template,
139
140
} ;
140
141
}
141
142
142
143
function componentStyleTemplateGenerator ( { cliConfigFile, cmd, componentName } ) {
143
- const { customTemplates } = cliConfigFile . component [ cmd . type ] ;
144
+ const { customTemplates, flat } = cliConfigFile . component [ cmd . type ] ;
144
145
let template = null ;
145
146
let filename = null ;
147
+ const isFlat = flat || cmd . flat ;
146
148
147
149
// Check for a custom style template.
148
150
@@ -168,17 +170,18 @@ function componentStyleTemplateGenerator({ cliConfigFile, cmd, componentName })
168
170
}
169
171
170
172
return {
171
- componentPath : `${ cmd . path } ${ cmd . flat ? '' : `/${ componentName } ` } /${ filename } ` ,
173
+ componentPath : `${ cmd . path } ${ isFlat ? '' : `/${ componentName } ` } /${ filename } ` ,
172
174
filename,
173
175
template,
174
176
} ;
175
177
}
176
178
177
179
function componentTestTemplateGenerator ( { cliConfigFile, cmd, componentName } ) {
178
- const { customTemplates } = cliConfigFile . component [ cmd . type ] ;
180
+ const { customTemplates, flat } = cliConfigFile . component [ cmd . type ] ;
179
181
const { testLibrary, usesTypeScript } = cliConfigFile ;
180
182
let template = null ;
181
183
let filename = null ;
184
+ const isFlat = flat || cmd . flat ;
182
185
183
186
// Check for a custom test template.
184
187
@@ -207,17 +210,18 @@ function componentTestTemplateGenerator({ cliConfigFile, cmd, componentName }) {
207
210
}
208
211
209
212
return {
210
- componentPath : `${ cmd . path } ${ cmd . flat ? '' : `/${ componentName } ` } /${ filename } ` ,
213
+ componentPath : `${ cmd . path } ${ isFlat ? '' : `/${ componentName } ` } /${ filename } ` ,
211
214
filename,
212
215
template,
213
216
} ;
214
217
}
215
218
216
219
function componentStoryTemplateGenerator ( { cliConfigFile, cmd, componentName } ) {
217
220
const { usesTypeScript } = cliConfigFile ;
218
- const { customTemplates } = cliConfigFile . component [ cmd . type ] ;
221
+ const { customTemplates, flat } = cliConfigFile . component [ cmd . type ] ;
219
222
let template = null ;
220
223
let filename = null ;
224
+ const isFlat = flat || cmd . flat ;
221
225
222
226
// Check for a custom story template.
223
227
@@ -239,17 +243,18 @@ function componentStoryTemplateGenerator({ cliConfigFile, cmd, componentName })
239
243
}
240
244
241
245
return {
242
- componentPath : `${ cmd . path } ${ cmd . flat ? '' : `/${ componentName } ` } /${ filename } ` ,
246
+ componentPath : `${ cmd . path } ${ isFlat ? '' : `/${ componentName } ` } /${ filename } ` ,
243
247
filename,
244
248
template,
245
249
} ;
246
250
}
247
251
248
252
function componentLazyTemplateGenerator ( { cmd, componentName, cliConfigFile } ) {
249
253
const { usesTypeScript } = cliConfigFile ;
250
- const { customTemplates } = cliConfigFile . component [ cmd . type ] ;
254
+ const { customTemplates, flat } = cliConfigFile . component [ cmd . type ] ;
251
255
let template = null ;
252
256
let filename = null ;
257
+ const isFlat = flat || cmd . flat ;
253
258
254
259
// Check for a custom lazy template.
255
260
@@ -271,17 +276,18 @@ function componentLazyTemplateGenerator({ cmd, componentName, cliConfigFile }) {
271
276
}
272
277
273
278
return {
274
- componentPath : `${ cmd . path } ${ cmd . flat ? '' : `/${ componentName } ` } /${ filename } ` ,
279
+ componentPath : `${ cmd . path } ${ isFlat ? '' : `/${ componentName } ` } /${ filename } ` ,
275
280
filename,
276
281
template,
277
282
} ;
278
283
}
279
284
280
285
function customFileTemplateGenerator ( { componentName, cmd, cliConfigFile, componentFileType } ) {
281
- const { customTemplates } = cliConfigFile . component [ cmd . type ] ;
286
+ const { customTemplates, flat } = cliConfigFile . component [ cmd . type ] ;
282
287
const fileType = camelCase ( componentFileType . split ( 'with' ) [ 1 ] ) ;
283
288
let filename = null ;
284
289
let template = null ;
290
+ const isFlat = flat || cmd . flat ;
285
291
286
292
// Check for a valid custom template for the corresponding custom component file.
287
293
@@ -309,7 +315,7 @@ Please make sure you're pointing to the right custom template path in your gener
309
315
filename = customTemplateFilename ;
310
316
311
317
return {
312
- componentPath : `${ cmd . path } ${ cmd . flat ? '' : `/${ componentName } ` } /${ filename } ` ,
318
+ componentPath : `${ cmd . path } ${ isFlat ? '' : `/${ componentName } ` } /${ filename } ` ,
313
319
filename,
314
320
template,
315
321
} ;
0 commit comments