Skip to content

Commit d10230a

Browse files
committed
bump: template and all configs to Nuxt 4
1 parent 633bc56 commit d10230a

File tree

11 files changed

+39
-40
lines changed

11 files changed

+39
-40
lines changed

src/configs/i18n.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const i18n: ModuleConfig = {
5050
dependencies: [
5151
{
5252
name: '@nuxtjs/i18n',
53-
version: '^9.2.1',
53+
version: '^10.1.0',
5454
isDev: true
5555
}
5656
],
@@ -64,9 +64,7 @@ const i18n: ModuleConfig = {
6464
],
6565
strategy: 'prefix_except_default',
6666
detectBrowserLanguage: false,
67-
lazy: true,
6867
experimental: {
69-
autoImportTranslationFunctions: true,
7068
localeDetector: 'localeDetector.ts'
7169
}
7270
}
@@ -81,7 +79,7 @@ const i18n: ModuleConfig = {
8179
content: englishLocaleFile
8280
},
8381
{
84-
path: 'components/Welcome/I18nDemo.vue',
82+
path: 'app/components/Welcome/I18nDemo.vue',
8583
content: i18nDemoComponent
8684
}
8785
],

src/configs/naiveui.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const naiveui: ModuleConfig = {
4242
dependencies: [
4343
{
4444
name: '@bg-dev/nuxt-naiveui',
45-
version: '2.0.0-rc.4',
45+
version: '2.0.0',
4646
isDev: true
4747
}
4848
],
@@ -51,11 +51,11 @@ const naiveui: ModuleConfig = {
5151
},
5252
files: [
5353
{
54-
path: 'components/Welcome/NaiveDemo.vue',
54+
path: 'app/components/Welcome/NaiveDemo.vue',
5555
content: naiveDemoComponent
5656
},
5757
{
58-
path: 'app.vue',
58+
path: 'app/app.vue',
5959
content: nuxtAppVueWithNaiveConfig
6060
}
6161
],

src/configs/prisma.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ const prismaRootSchema = `// This is your Prisma schema file,
66
// learn more about it in the docs: https://pris.ly/d/prisma-schema
77
88
generator client {
9-
provider = "prisma-client-js"
10-
previewFeatures = ["prismaSchemaFolder"]
9+
provider = "prisma-client"
10+
output = "./client"
11+
12+
engineType = "library"
1113
}
1214
1315
datasource db {
@@ -49,7 +51,8 @@ const prismaExampleEndpoint = `/**
4951
export default defineEventHandler(event => event.context.prisma.example.findMany())
5052
`
5153

52-
const prismaServerMiddleware = `import { PrismaClient } from '@prisma/client'
54+
const prismaServerMiddleware = `import { PrismaPg } from '@prisma/adapter-pg'
55+
import { PrismaClient } from '@prisma/client'
5356
5457
let prisma: PrismaClient
5558
@@ -61,7 +64,8 @@ declare module 'h3' {
6164
6265
export default eventHandler((event) => {
6366
if (!prisma) {
64-
prisma = new PrismaClient()
67+
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
68+
prisma = new PrismaClient({ adapter })
6569
}
6670
event.context.prisma = prisma
6771
})
@@ -166,33 +170,33 @@ const prisma: ModuleConfig = {
166170
scripts: [
167171
{
168172
name: 'db',
169-
command: 'vite-node prisma/pglite.ts',
173+
command: 'node prisma/pglite.ts',
170174
}
171175
],
172176
dependencies: [
173177
{
174178
name: 'prisma',
175-
version: '^5.22.0',
179+
version: '^6.16.3',
176180
isDev: true
177181
},
178182
{
179183
name: '@prisma/client',
180-
version: '^5.22.0',
184+
version: '^6.16.3',
181185
isDev: false
182186
},
187+
{
188+
name: '@prisma/adapter-pg',
189+
version: '^6.16.3',
190+
isDev: false,
191+
},
183192
{
184193
name: '@electric-sql/pglite',
185194
version: '0.2.13',
186195
isDev: true,
187196
},
188197
{
189198
name: 'pg-gateway',
190-
version: '0.3.0-beta.3',
191-
isDev: true,
192-
},
193-
{
194-
name: 'vite-node',
195-
version: '^2.1.5',
199+
version: '0.3.0-beta.4',
196200
isDev: true,
197201
}
198202
],
@@ -219,7 +223,7 @@ const prisma: ModuleConfig = {
219223
content: prismaServerMiddleware
220224
},
221225
{
222-
path: 'components/Welcome/PrismaDemo.vue',
226+
path: 'app/components/Welcome/PrismaDemo.vue',
223227
content: prismaDemoComponent,
224228
},
225229
{

src/configs/sidebase-auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const sidebaseAuth: ModuleConfig = {
8686
dependencies: [
8787
{
8888
name: '@sidebase/nuxt-auth',
89-
version: '^0.9.4',
89+
version: '^1.1.0',
9090
isDev: true
9191
},
9292
{
@@ -105,7 +105,7 @@ const sidebaseAuth: ModuleConfig = {
105105
content: nuxtAuthServerFile
106106
},
107107
{
108-
path: 'components/Welcome/AuthDemo.vue',
108+
path: 'app/components/Welcome/AuthDemo.vue',
109109
content: authDemoComponent
110110
}
111111
],

src/configs/tailwind.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const tailwind: ModuleConfig = {
2121
dependencies: [
2222
{
2323
name: '@nuxtjs/tailwindcss',
24-
version: '^6.13.1',
24+
version: '^6.14.0',
2525
isDev: true
2626
}
2727
],
@@ -30,7 +30,7 @@ const tailwind: ModuleConfig = {
3030
},
3131
files: [
3232
{
33-
path: 'components/Welcome/TailwindDemo.vue',
33+
path: 'app/components/Welcome/TailwindDemo.vue',
3434
content: tailwindDemoComponent,
3535
}
3636
],

src/configs/trpc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@ const trpc: ModuleConfig = {
179179
content: nuxtTrpcApiHandler
180180
},
181181
{
182-
path: 'plugins/trpcClient.ts',
182+
path: 'app/plugins/trpcClient.ts',
183183
content: nuxtTrpcPlugin
184184
},
185185
{
186-
path: 'components/Welcome/TRPCDemo.vue',
186+
path: 'app/components/Welcome/TRPCDemo.vue',
187187
content: trpcDemoComponent,
188188
}
189189
],

src/configs/typescript.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ const scripts: Config = {
1111
dependencies: [
1212
{
1313
name: 'vue-tsc',
14-
version: '2.2.8',
14+
version: '3.0.6',
1515
isDev: true
1616
},
1717
{
1818
name: 'typescript',
19-
version: '5.7.3',
19+
version: '5.9.2',
2020
isDev: true,
2121
}
2222
],

src/steps/1.downloadTemplate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { downloadTemplate } from 'giget'
22
import { say } from '../messages'
33
import type { Preferences } from '../types'
44

5-
const TEMPLATE_NAME = 'github:sidebase/templates#nuxt-3.15.4'
5+
const TEMPLATE_NAME = 'github:sidebase/templates#nuxt-4.1.2'
66

77
export default async (preferences: Preferences) => {
88
// 1. Download template

src/steps/4.buildNuxtConfig.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ export default async function (templateDir: string, configs: Config[], modules:
2020

2121
// 2. Build base Nuxt Config
2222
let nuxtConfig = {
23-
compatibilityDate: '2024-08-19',
23+
compatibilityDate: '2025-07-15',
2424
devtools: { enabled: true },
25-
typescript: {
26-
shim: false,
27-
},
2825
} as NuxtConfig
2926

3027
for (const nuxtConfigExtension of nuxtConfigExtensions) {

src/steps/5.writeFiles.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default async function (templateDir: string, configs: Config[], modules:
2020
</div>
2121
</template>
2222
`
23-
await writeFile(resolver('app.vue'), nuxtAppVue)
23+
await writeFile(resolver('app/app.vue'), nuxtAppVue)
2424

2525
// 1. Collect all Files
2626
const filesToAdd: File[] = []
@@ -36,12 +36,12 @@ export default async function (templateDir: string, configs: Config[], modules:
3636

3737
// 3. Write index.vue with a nice welcome message as well as links to sub-pages
3838
const nuxtPagesIndexVue = generateIndexVue(modules)
39-
await mkdir(resolver('pages'), { recursive: true })
40-
await writeFile(resolver('pages/index.vue'), nuxtPagesIndexVue)
39+
await mkdir(resolver('app/pages'), { recursive: true })
40+
await writeFile(resolver('app/pages/index.vue'), nuxtPagesIndexVue)
4141

4242
// 4. Write ButtonLink.vue for the module components
4343
if (modules.length > 0) {
44-
await mkdir(resolver('components/Welcome'), { recursive: true })
45-
await writeFile(resolver('components/Welcome/ButtonLink.vue'), buttonLink)
44+
await mkdir(resolver('app/components/Welcome'), { recursive: true })
45+
await writeFile(resolver('app/components/Welcome/ButtonLink.vue'), buttonLink)
4646
}
4747
}

0 commit comments

Comments
 (0)