Skip to content

Commit 3177d8c

Browse files
committed
refactor: replace manual bare template conditions with config array
1 parent 232474a commit 3177d8c

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

index.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -578,22 +578,19 @@ async function init() {
578578
},
579579
)
580580

581+
const bareTemplateConfig = [
582+
{ condition: needsTypeScript, template: 'bare/typescript' },
583+
{ condition: needsVitest, template: 'bare/vitest' },
584+
{ condition: needsCypressCT, template: 'bare/cypress-ct' },
585+
{ condition: needsNightwatchCT, template: 'bare/nightwatch-ct' },
586+
]
587+
581588
if (needsBareboneTemplates) {
582589
trimBoilerplate(root)
583590
render('bare/base')
584-
// TODO: refactor the `render` utility to avoid this kind of manual mapping?
585-
if (needsTypeScript) {
586-
render('bare/typescript')
587-
}
588-
if (needsVitest) {
589-
render('bare/vitest')
590-
}
591-
if (needsCypressCT) {
592-
render('bare/cypress-ct')
593-
}
594-
if (needsNightwatchCT) {
595-
render('bare/nightwatch-ct')
596-
}
591+
bareTemplateConfig.forEach(({ condition, template }) => {
592+
if (condition) render(template)
593+
})
597594
}
598595

599596
// Cleanup.

0 commit comments

Comments
 (0)