Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
refactor: replace manual bare template conditions with config array
  • Loading branch information
FlorianBx committed Aug 9, 2025
commit 3177d8c21335963188bf0bb7806624ad71fd42e8
23 changes: 10 additions & 13 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,22 +578,19 @@ async function init() {
},
)

const bareTemplateConfig = [
{ condition: needsTypeScript, template: 'bare/typescript' },
{ condition: needsVitest, template: 'bare/vitest' },
{ condition: needsCypressCT, template: 'bare/cypress-ct' },
{ condition: needsNightwatchCT, template: 'bare/nightwatch-ct' },
]

if (needsBareboneTemplates) {
trimBoilerplate(root)
render('bare/base')
// TODO: refactor the `render` utility to avoid this kind of manual mapping?
if (needsTypeScript) {
render('bare/typescript')
}
if (needsVitest) {
render('bare/vitest')
}
if (needsCypressCT) {
render('bare/cypress-ct')
}
if (needsNightwatchCT) {
render('bare/nightwatch-ct')
}
bareTemplateConfig.forEach(({ condition, template }) => {
if (condition) render(template)
})
}

// Cleanup.
Expand Down
Loading