@@ -82,9 +82,10 @@ Please make sure you're pointing to the right custom template path in your gener
8282
8383function componentTemplateGenerator ( { cmd, componentName, cliConfigFile } ) {
8484 const { cssPreprocessor, testLibrary, usesCssModule, usesTypeScript } = cliConfigFile ;
85- const { customTemplates } = cliConfigFile . component [ cmd . type ] ;
85+ const { customTemplates, flat } = cliConfigFile . component [ cmd . type ] ;
8686 let template = null ;
8787 let filename = null ;
88+ const isFlat = flat || cmd . flat ;
8889
8990 // Check for a custom component template.
9091
@@ -133,16 +134,17 @@ function componentTemplateGenerator({ cmd, componentName, cliConfigFile }) {
133134 }
134135
135136 return {
136- componentPath : `${ cmd . path } ${ cmd . flat ? '' : `/${ componentName } ` } /${ filename } ` ,
137+ componentPath : `${ cmd . path } ${ isFlat ? '' : `/${ componentName } ` } /${ filename } ` ,
137138 filename,
138139 template,
139140 } ;
140141}
141142
142143function componentStyleTemplateGenerator ( { cliConfigFile, cmd, componentName } ) {
143- const { customTemplates } = cliConfigFile . component [ cmd . type ] ;
144+ const { customTemplates, flat } = cliConfigFile . component [ cmd . type ] ;
144145 let template = null ;
145146 let filename = null ;
147+ const isFlat = flat || cmd . flat ;
146148
147149 // Check for a custom style template.
148150
@@ -168,17 +170,18 @@ function componentStyleTemplateGenerator({ cliConfigFile, cmd, componentName })
168170 }
169171
170172 return {
171- componentPath : `${ cmd . path } ${ cmd . flat ? '' : `/${ componentName } ` } /${ filename } ` ,
173+ componentPath : `${ cmd . path } ${ isFlat ? '' : `/${ componentName } ` } /${ filename } ` ,
172174 filename,
173175 template,
174176 } ;
175177}
176178
177179function componentTestTemplateGenerator ( { cliConfigFile, cmd, componentName } ) {
178- const { customTemplates } = cliConfigFile . component [ cmd . type ] ;
180+ const { customTemplates, flat } = cliConfigFile . component [ cmd . type ] ;
179181 const { testLibrary, usesTypeScript } = cliConfigFile ;
180182 let template = null ;
181183 let filename = null ;
184+ const isFlat = flat || cmd . flat ;
182185
183186 // Check for a custom test template.
184187
@@ -207,17 +210,18 @@ function componentTestTemplateGenerator({ cliConfigFile, cmd, componentName }) {
207210 }
208211
209212 return {
210- componentPath : `${ cmd . path } ${ cmd . flat ? '' : `/${ componentName } ` } /${ filename } ` ,
213+ componentPath : `${ cmd . path } ${ isFlat ? '' : `/${ componentName } ` } /${ filename } ` ,
211214 filename,
212215 template,
213216 } ;
214217}
215218
216219function componentStoryTemplateGenerator ( { cliConfigFile, cmd, componentName } ) {
217220 const { usesTypeScript } = cliConfigFile ;
218- const { customTemplates } = cliConfigFile . component [ cmd . type ] ;
221+ const { customTemplates, flat } = cliConfigFile . component [ cmd . type ] ;
219222 let template = null ;
220223 let filename = null ;
224+ const isFlat = flat || cmd . flat ;
221225
222226 // Check for a custom story template.
223227
@@ -239,17 +243,18 @@ function componentStoryTemplateGenerator({ cliConfigFile, cmd, componentName })
239243 }
240244
241245 return {
242- componentPath : `${ cmd . path } ${ cmd . flat ? '' : `/${ componentName } ` } /${ filename } ` ,
246+ componentPath : `${ cmd . path } ${ isFlat ? '' : `/${ componentName } ` } /${ filename } ` ,
243247 filename,
244248 template,
245249 } ;
246250}
247251
248252function componentLazyTemplateGenerator ( { cmd, componentName, cliConfigFile } ) {
249253 const { usesTypeScript } = cliConfigFile ;
250- const { customTemplates } = cliConfigFile . component [ cmd . type ] ;
254+ const { customTemplates, flat } = cliConfigFile . component [ cmd . type ] ;
251255 let template = null ;
252256 let filename = null ;
257+ const isFlat = flat || cmd . flat ;
253258
254259 // Check for a custom lazy template.
255260
@@ -271,17 +276,18 @@ function componentLazyTemplateGenerator({ cmd, componentName, cliConfigFile }) {
271276 }
272277
273278 return {
274- componentPath : `${ cmd . path } ${ cmd . flat ? '' : `/${ componentName } ` } /${ filename } ` ,
279+ componentPath : `${ cmd . path } ${ isFlat ? '' : `/${ componentName } ` } /${ filename } ` ,
275280 filename,
276281 template,
277282 } ;
278283}
279284
280285function customFileTemplateGenerator ( { componentName, cmd, cliConfigFile, componentFileType } ) {
281- const { customTemplates } = cliConfigFile . component [ cmd . type ] ;
286+ const { customTemplates, flat } = cliConfigFile . component [ cmd . type ] ;
282287 const fileType = camelCase ( componentFileType . split ( 'with' ) [ 1 ] ) ;
283288 let filename = null ;
284289 let template = null ;
290+ const isFlat = flat || cmd . flat ;
285291
286292 // Check for a valid custom template for the corresponding custom component file.
287293
@@ -309,7 +315,7 @@ Please make sure you're pointing to the right custom template path in your gener
309315 filename = customTemplateFilename ;
310316
311317 return {
312- componentPath : `${ cmd . path } ${ cmd . flat ? '' : `/${ componentName } ` } /${ filename } ` ,
318+ componentPath : `${ cmd . path } ${ isFlat ? '' : `/${ componentName } ` } /${ filename } ` ,
313319 filename,
314320 template,
315321 } ;
0 commit comments