Skip to content

Commit deab131

Browse files
committed
fix(merino): correctly create nuxt files even if no module was selected for
1 parent f47ac23 commit deab131

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ const main = async () => {
3434
}
3535

3636
// 1. Download the Nuxt 3 template
37-
const template = await wrapInSpinner("Adding Nuxt 3 template", downloadTemplate, preferences)
37+
const template = await wrapInSpinner(`Adding Nuxt 3 ${preferences.setStack} template`, downloadTemplate, preferences)
3838

3939
// 2. Add modules
40-
await wrapInSpinner("Adding Nuxt modules", addModules, preferences, template.dir)
40+
if (preferences.setStack === "merino") {
41+
await wrapInSpinner("Adding Nuxt modules", addModules, preferences, template.dir)
42+
}
4143

4244
// 3. Initialize git
4345
if (preferences.runGitInit) {

src/steps/2.addModules/index.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ import defu from "defu"
99
import { inspect } from "node:util"
1010

1111
export default async (preferences: Preferences, templateDir: string) => {
12-
const selectedModules: Modules[] = preferences.addModules
13-
if (!selectedModules || selectedModules.length === 0) {
14-
return
15-
}
16-
12+
const selectedModules: Modules[] = preferences.addModules || []
1713
const resolver = getResolver(templateDir)
1814

1915
// 1. Gather module configuration for all selected modules
@@ -63,12 +59,11 @@ export default defineNuxtConfig(${inspect(nuxtConfig, { compact: false })})
6359
`
6460
await writeFile(resolver("app.vue"), nuxtAppVue)
6561

66-
6762
// 6. Write index.vue with a nice welcome message as well as links to sub-pages
6863
const moduleIndexHtmlSnippets = selectedModules.map((module) => moduleConfigs[module].htmlForIndexVue).filter(html => typeof html !== "undefined")
6964
const nuxtPagesIndexVue = `<template>
7065
<div>
71-
<h1 ${selectedModules.includes("tailwind") ? "class=\"text-4xl\"" : ""}>Welcome to your sidebase app!</h1>${moduleIndexHtmlSnippets.length > 0 ? "\n" + moduleIndexHtmlSnippets.join("\n ") : ""}
66+
<h1${selectedModules.includes("tailwind") ? " class=\"text-4xl\"" : ""}>Welcome to your sidebase app!</h1>${moduleIndexHtmlSnippets.length > 0 ? "\n" + moduleIndexHtmlSnippets.join("\n ") : ""}
7267
</div>
7368
</template>
7469
`

0 commit comments

Comments
 (0)