Skip to content

Commit 24d3a43

Browse files
authored
feat: also check style & types in CI pipeline, fix template-formatting for everything that came malformatted (#10)
* feat: add step that automatically lint & fix all files to avoid problems from raw template strings * fix: matrix case * fix: matrix case lock files * fix: remove yarn supports - its too complicated * fix: pnm is subset of npm * revert: no crazy ci extensions * fix: newlines removed * fix: run dev before typechecl * fix: run nuxi prepare before typecheckl * fix: fix snippets instead of automatically fixing in the end
1 parent 7ff2629 commit 24d3a43

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020
- run: npm ci
2121

2222
- run: npm run lint
23-
2423
- run: npm run typecheck
2524

2625
testCli:
@@ -38,6 +37,10 @@ jobs:
3837
# This is what the user would do, minus actually starting the application
3938
- run: cd my-sidebase-app && npx prisma db push && npx prisma generate
4039

40+
# code should be 100% correct at the start
41+
- run: cd my-sidebase-app && npm run lint
42+
- run: cd my-sidebase-app && npm exec nuxi prepare && npm run typecheck
43+
4144
# start dev-app, all of the following adapted from https://stackoverflow.com/a/60996259
4245
- run: "cd my-sidebase-app && timeout 30 npm run dev || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )"
4346

@@ -50,6 +53,7 @@ jobs:
5053
# build prod-app, start it in prod mode and curl from it
5154
- run: "export AUTH_ORIGIN=http://localhost:3000 && cd my-sidebase-app && npm run build && timeout 30 npm run preview & (sleep 10 && curl --fail localhost:3000) || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )"
5255

56+
5357
publish:
5458
needs: [testCli, testCodebase]
5559
runs-on: ubuntu-latest

src/steps/2.addModules/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,12 @@ export default defineNuxtConfig(${inspect(nuxtConfig, { compact: false })})
6161

6262
// 6. Write index.vue with a nice welcome message as well as links to sub-pages
6363
const moduleIndexHtmlSnippets = selectedModules.map((module) => moduleConfigs[module].htmlForIndexVue).filter(html => typeof html !== "undefined")
64+
const moduleIndexHtml = moduleIndexHtmlSnippets.length > 0 ? "\n " + moduleIndexHtmlSnippets.join("\n ") : ""
6465
const nuxtPagesIndexVue = `<template>
6566
<div>
66-
<h1${selectedModules.includes("tailwind") ? " class=\"text-4xl\"" : ""}>Welcome to your sidebase app!</h1>${moduleIndexHtmlSnippets.length > 0 ? "\n " + moduleIndexHtmlSnippets.join("\n ") : ""}
67+
<h1${selectedModules.includes("tailwind") ? " class=\"text-4xl\"" : ""}>
68+
Welcome to your sidebase app!
69+
</h1>${moduleIndexHtml}
6770
</div>
6871
</template>
6972
`

src/steps/2.addModules/moduleConfigs.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ export default NuxtAuthHandler({
154154
const nuxtAuthExamplePage = `<template>
155155
<div>
156156
<div>I'm protected! Session data: {{ data }}</div>
157-
<button class="rounded-xl shadow-xl p-2 m-2" @click="signOut()">sign out</button>
157+
<button class="rounded-xl shadow-xl p-2 m-2" @click="signOut()">
158+
sign out
159+
</button>
158160
</div>
159161
</template>
160162
@@ -344,7 +346,12 @@ export const moduleConfigs: Record<Modules, ModuleConfig> = {
344346
"- [ ] Prisma: Run `npx prisma db push` to sync the schema to your database after changing the schema",
345347
"- [ ] Prisma: Run `npx prisma generate` to re-generate the client after changing the schema"
346348
],
347-
htmlForIndexVue: "<p>Checkout the Prisma ORM demo page here: <nuxt-link to=\"/prisma\" class=\"underline text-blue\">Click me to test the Prisma ORM setup!</nuxt-link></p>"
349+
htmlForIndexVue: `<p>
350+
Checkout the Prisma ORM demo page here:
351+
<nuxt-link to="/prisma" class="underline text-blue">
352+
Click me to test the Prisma ORM setup!
353+
</nuxt-link>
354+
</p>`
348355
},
349356
"auth": {
350357
humanReadableName: "nuxt-auth",
@@ -370,7 +377,12 @@ export const moduleConfigs: Record<Modules, ModuleConfig> = {
370377
"- [ ] Auth: Configure your auth providers to the [NuxtAuthHandler](./server/api/auth/[...].ts)",
371378
"- [ ] Auth, optional: Enable global protection by setting `enableGlobalAppMiddleware: true` in [your nuxt.config.ts](./nuxt.config.ts). Delete the logal middleware in the [protected.vue](./pages/protected.vue) page if you do"
372379
],
373-
htmlForIndexVue: "<p>Checkout the page protected by `nuxt-auth` here: <nuxt-link to=\"/protected\" class=\"underline text-blue\">Click me to test the auth setup!</nuxt-link></p>"
380+
htmlForIndexVue: `<p>
381+
Checkout the page protected by \`nuxt-auth\` here:
382+
<nuxt-link to="/protected" class="underline text-blue">
383+
Click me to test the auth setup!
384+
</nuxt-link>
385+
</p>`
374386
},
375387
"trpc": {
376388
humanReadableName: "tRPC 10",
@@ -428,7 +440,12 @@ export const moduleConfigs: Record<Modules, ModuleConfig> = {
428440
},
429441
],
430442
tasksPostInstall: [],
431-
htmlForIndexVue: "<p>Checkout the tRPC demo page here: <nuxt-link to=\"/trpc\" class=\"underline text-blue\">Click me to test the tRPC setup!</nuxt-link></p>"
443+
htmlForIndexVue: `<p>
444+
Checkout the tRPC demo page here:
445+
<nuxt-link to="/trpc" class="underline text-blue">
446+
Click me to test the tRPC setup!
447+
</nuxt-link>
448+
</p>`
432449
},
433450
"tailwind": {
434451
humanReadableName: "Tailwind CSS",

0 commit comments

Comments
 (0)