Skip to content

Commit 03ffa14

Browse files
authored
feat: bump to nuxt 3.2, nuxt-auth 0.4.0, prisma 4.10, trpc 10.10 and more (#19)
* chore: update minor and major deps * chore: remove unused prisma command, fix locale to ensure render match for tRPC page * chore: resolve prisma hybrid rendering problem by removing bad p-tag * revert: no more need to explicitly type examples as useFetch was fixed
1 parent 4465903 commit 03ffa14

File tree

4 files changed

+22
-28
lines changed

4 files changed

+22
-28
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- run: npm run dev -- -- --ci
3636

3737
# This is what the user would do, minus actually starting the application
38-
- run: cd my-sidebase-app && npx prisma db push && npx prisma generate
38+
- run: cd my-sidebase-app && npx prisma db push
3939

4040
# code should be 100% correct at the start
4141
- run: cd my-sidebase-app && npm run lint
@@ -52,4 +52,3 @@ jobs:
5252

5353
# build prod-app, start it in prod mode and curl from it
5454
- 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\" )"
55-

src/messages.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ export const sayGoodbye = (preferences: Preferences) => {
7373
}
7474

7575
if (preferences.addModules?.includes("prisma") || preferences.setStack === "cheviot") {
76-
sayCommand("npx prisma db push", "Initialize the database")
77-
sayCommand("npx prisma generate", "Initialize the Prisma client")
76+
sayCommand("npx prisma db push", "Initialize the database & Prisma client")
7877
}
7978

8079
sayCommand(`${packageManager} run dev`, "Start the development server, use CTRL+C to stop")

src/steps/2.addModules/moduleConfigs.ts

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ DATABASE_URL=file:./db.sqlite
5353
`
5454

5555
const prismaExampleEndpoint = `/**
56-
* Fetch all \`examples\` from the database. Run \`npx prisma generate\` and \`npx prisma db push\` for this to work.
56+
* Fetch all \`examples\` from the database. Run \`npx prisma db push\` at least once for this to work.
5757
*
5858
* If you are using \`tRPC\` you can access the prisma-client by adding it to the context:
5959
* \`\`\`ts
@@ -111,21 +111,12 @@ export const resetDatabase = (databaseUrl?: string) => {
111111
`
112112

113113
const prismaExamplePage = `<script setup lang="ts">
114-
/**
115-
* In Nuxt 3.1.2 \`useFetch\` return types are not correctly inferred. In order to workaround this limitation, we sadly need to manually import and type a lof ot things.
116-
*
117-
* As soon as https://github.com/nuxt/nuxt/issues/15280 is closed and released, we can go back to just: \`const { data: examples } = useFetch('/api/examples')\`
118-
* */
119-
import type { Ref } from 'vue'
120-
import { Example } from '.prisma/client'
121-
122-
const { data } = useFetch('/api/examples')
123-
const examples = (data as Ref<Example[] | null>)
114+
const { data: examples } = useFetch('/api/examples')
124115
</script>
125116
126117
<template>
127118
<div>
128-
<p>Prisma ORM Data from the database, received {{ examples?.length || 0 }} records: <pre>{{ examples }}</pre></p>
119+
Prisma ORM Data from the database, received {{ examples?.length || 0 }} records: <pre>{{ examples }}</pre>
129120
</div>
130121
</template>
131122
`
@@ -315,7 +306,7 @@ const hello = await $client.hello.useQuery({ text: 'client' })
315306
<template>
316307
<div>
317308
<!-- As \`superjson\` is already pre-configured, we can use \`time\` as a \`Date\` object without further deserialization 🎉 -->
318-
<p>tRPC Data: "{{ hello.data.value?.greeting }}" send at "{{ hello.data.value?.time.toLocaleDateString() }}".</p>
309+
tRPC Data: "{{ hello.data.value?.greeting }}" send at "{{ hello.data.value?.time.toLocaleDateString('en-EN') }}".
319310
</div>
320311
</template>
321312
`
@@ -348,12 +339,12 @@ export const moduleConfigs: Record<Modules, ModuleConfig> = {
348339
dependencies: [
349340
{
350341
name: "prisma",
351-
version: "^4.8.0",
342+
version: "^4.10.1",
352343
isDev: true
353344
},
354345
{
355346
name: "@prisma/client",
356-
version: "^4.8.0",
347+
version: "^4.10.1",
357348
isDev: false
358349
}
359350
],
@@ -379,8 +370,7 @@ export const moduleConfigs: Record<Modules, ModuleConfig> = {
379370
}],
380371
tasksPostInstall: [
381372
"- [ ] Prisma: Edit your `prisma/prisma.schema` to your liking",
382-
"- [ ] Prisma: Run `npx prisma db push` to sync the schema to your database after changing the schema",
383-
"- [ ] Prisma: Run `npx prisma generate` to re-generate the client after changing the schema"
373+
"- [ ] Prisma: Run `npx prisma db push` to sync the schema to your database & generate the Prisma Client",
384374
],
385375
indexVue: generateModuleHTMLSnippet(
386376
"Prisma ORM",
@@ -396,9 +386,14 @@ export const moduleConfigs: Record<Modules, ModuleConfig> = {
396386
dependencies: [
397387
{
398388
name: "@sidebase/nuxt-auth",
399-
version: "^0.3.3",
389+
version: "^0.4.1",
400390
isDev: true
401391
},
392+
{
393+
name: "next-auth",
394+
version: "^4.18.8",
395+
isDev: false
396+
}
402397
],
403398
nuxtConfig: {
404399
modules: ["@sidebase/nuxt-auth"]
@@ -427,23 +422,23 @@ export const moduleConfigs: Record<Modules, ModuleConfig> = {
427422
description: "Build end-to-end typesafe APIs in Nuxt applications. See more: https://trpc.io/",
428423
dependencies: [{
429424
name: "@trpc/server",
430-
version: "^10.5.0",
425+
version: "^10.10.0",
431426
isDev: false
432427
}, {
433428
name: "@trpc/client",
434-
version: "^10.5.0",
429+
version: "^10.10.0",
435430
isDev: false
436431
}, {
437432
name: "trpc-nuxt",
438-
version: "^0.4.4",
433+
version: "^0.6.0",
439434
isDev: false
440435
}, {
441436
name: "zod",
442-
version: "^3.20.2",
437+
version: "^3.20.6",
443438
isDev: false
444439
}, {
445440
name: "superjson",
446-
version: "^1.12.1",
441+
version: "^1.12.2",
447442
isDev: false
448443
}],
449444
nuxtConfig: {
@@ -512,7 +507,7 @@ export const moduleConfigs: Record<Modules, ModuleConfig> = {
512507
description: "A Vue 3 Component Library. Complete, Customizable, Uses TypeScript, Fast. See more: https://www.naiveui.com/",
513508
dependencies: [{
514509
name: "@huntersofbook/naive-ui-nuxt",
515-
version: "^0.5.1",
510+
version: "^0.6.0",
516511
isDev: true
517512
}],
518513
nuxtConfig: {

src/steps/6.addReadme.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Some tasks you should probably do in the beginning are:
5151
- [ ] replace this generic README with a more specific one
5252
- [ ] install the Vue Volar extension
5353
- [ ] enable [Volar takeover mode](https://nuxt.com/docs/getting-started/installation#prerequisites) to ensure a smooth editor setup
54+
- [ ] [install Nuxt 3 devtools](https://github.com/nuxt/devtools#installation) if you want to use them
5455
${tasksPostInstall.join("\n")}
5556
5657
### Setup

0 commit comments

Comments
 (0)