Skip to content
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,12 @@ jobs:

# start prod-app
- name: app:run in prod
env:
AUTH_ORIGIN: http://localhost:3000/api/auth
run: "cd my-sidebase-app && npm run build && timeout 30 npm run preview || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )"

# start dev-app and curl from it
- name: app:test in prod
env:
AUTH_ORIGIN: http://localhost:3000/api/auth
run: "cd my-sidebase-app && timeout 30 npm run dev & (sleep 20 && curl --fail localhost:3000) || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )"
4 changes: 2 additions & 2 deletions src/configs/droneCI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ trigger:

steps:
- name: lint-and-typecheck
image: node:20.9.0-slim
image: node:24.9.0-slim
commands:
- npm i -g @antfu/ni
- nci
- nr lint
- nr typecheck
- name: build
image: node:20.9.0-slim
image: node:24.9.0-slim
commands:
- npm i -g @antfu/ni
- nci
Expand Down
6 changes: 3 additions & 3 deletions src/configs/eslint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ const eslint: Config = {
dependencies: [
{
name: 'eslint',
version: '^9.18.0',
version: '^9.37.0',
isDev: true
},
{
name: '@antfu/eslint-config',
version: '^3.15.0',
version: '^5.4.1',
isDev: true
},
{
name: 'oxlint',
version: '^0.15.7',
version: '^1.20.0',
isDev: true
}
],
Expand Down
11 changes: 7 additions & 4 deletions src/configs/github-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ on:
pull_request:
branches: [ main ]

env:
NODE_VERSION: '24.9.0'

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.6.1
- name: Use Node.js $/{{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: 20.6.1
node-version: $/{{ env.NODE_VERSION }}

- name: Setup
run: npm i -g @antfu/ni
Expand All @@ -32,10 +35,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.6.1
- name: Use Node.js $/{{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: 20.6.1
node-version: $/{{ env.NODE_VERSION }}

- name: Setup
run: npm i -g @antfu/ni
Expand Down
6 changes: 2 additions & 4 deletions src/configs/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const i18n: ModuleConfig = {
dependencies: [
{
name: '@nuxtjs/i18n',
version: '^9.2.1',
version: '^10.1.0',
isDev: true
}
],
Expand All @@ -64,9 +64,7 @@ const i18n: ModuleConfig = {
],
strategy: 'prefix_except_default',
detectBrowserLanguage: false,
lazy: true,
experimental: {
autoImportTranslationFunctions: true,
localeDetector: 'localeDetector.ts'
}
}
Expand All @@ -81,7 +79,7 @@ const i18n: ModuleConfig = {
content: englishLocaleFile
},
{
path: 'components/Welcome/I18nDemo.vue',
path: 'app/components/Welcome/I18nDemo.vue',
content: i18nDemoComponent
}
],
Expand Down
6 changes: 3 additions & 3 deletions src/configs/naiveui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const naiveui: ModuleConfig = {
dependencies: [
{
name: '@bg-dev/nuxt-naiveui',
version: '2.0.0-rc.4',
version: '2.0.0',
isDev: true
}
],
Expand All @@ -51,11 +51,11 @@ const naiveui: ModuleConfig = {
},
files: [
{
path: 'components/Welcome/NaiveDemo.vue',
path: 'app/components/Welcome/NaiveDemo.vue',
content: naiveDemoComponent
},
{
path: 'app.vue',
path: 'app/app.vue',
content: nuxtAppVueWithNaiveConfig
}
],
Expand Down
41 changes: 20 additions & 21 deletions src/configs/prisma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ const prismaRootSchema = `// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
provider = "prisma-client-js"
previewFeatures = ["prismaSchemaFolder"]
provider = "prisma-client"
output = "./client"

engineType = "library"
}

datasource db {
Expand All @@ -21,9 +23,8 @@ datasource db {
// This is required for development only.
shadowDatabaseUrl = "postgres://postgres@localhost/prisma-shadow?pgbouncer=true&connection_limit=1"
}
`

const prismaExampleSchema = `model Example {
model Example {
id String @id @default(uuid())
details String
}
Expand All @@ -49,7 +50,8 @@ const prismaExampleEndpoint = `/**
export default defineEventHandler(event => event.context.prisma.example.findMany())
`

const prismaServerMiddleware = `import { PrismaClient } from '@prisma/client'
const prismaServerMiddleware = `import { PrismaPg } from '@prisma/adapter-pg'
import { PrismaClient } from '~~/prisma/client/client'

let prisma: PrismaClient

Expand All @@ -61,7 +63,8 @@ declare module 'h3' {

export default eventHandler((event) => {
if (!prisma) {
prisma = new PrismaClient()
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
prisma = new PrismaClient({ adapter })
}
event.context.prisma = prisma
})
Expand Down Expand Up @@ -166,33 +169,33 @@ const prisma: ModuleConfig = {
scripts: [
{
name: 'db',
command: 'vite-node prisma/pglite.ts',
command: 'node prisma/pglite.ts',
}
],
dependencies: [
{
name: 'prisma',
version: '^5.22.0',
version: '^6.16.3',
isDev: true
},
{
name: '@prisma/client',
version: '^5.22.0',
version: '^6.16.3',
isDev: false
},
{
name: '@prisma/adapter-pg',
version: '^6.16.3',
isDev: false,
},
{
name: '@electric-sql/pglite',
version: '0.2.13',
isDev: true,
},
{
name: 'pg-gateway',
version: '0.3.0-beta.3',
isDev: true,
},
{
name: 'vite-node',
version: '^2.1.5',
version: '0.3.0-beta.4',
isDev: true,
}
],
Expand All @@ -203,13 +206,9 @@ const prisma: ModuleConfig = {
content: prismaEnvFile
},
{
path: 'prisma/schema/schema.prisma',
path: 'prisma/schema.prisma',
content: prismaRootSchema
},
{
path: 'prisma/schema/example.prisma',
content: prismaExampleSchema
},
{
path: 'server/api/examples.get.ts',
content: prismaExampleEndpoint
Expand All @@ -219,7 +218,7 @@ const prisma: ModuleConfig = {
content: prismaServerMiddleware
},
{
path: 'components/Welcome/PrismaDemo.vue',
path: 'app/components/Welcome/PrismaDemo.vue',
content: prismaDemoComponent,
},
{
Expand Down
4 changes: 2 additions & 2 deletions src/configs/sidebase-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const sidebaseAuth: ModuleConfig = {
dependencies: [
{
name: '@sidebase/nuxt-auth',
version: '^0.9.4',
version: '^1.1.0',
isDev: true
},
{
Expand All @@ -105,7 +105,7 @@ const sidebaseAuth: ModuleConfig = {
content: nuxtAuthServerFile
},
{
path: 'components/Welcome/AuthDemo.vue',
path: 'app/components/Welcome/AuthDemo.vue',
content: authDemoComponent
}
],
Expand Down
4 changes: 2 additions & 2 deletions src/configs/tailwind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const tailwind: ModuleConfig = {
dependencies: [
{
name: '@nuxtjs/tailwindcss',
version: '^6.13.1',
version: '^6.14.0',
isDev: true
}
],
Expand All @@ -30,7 +30,7 @@ const tailwind: ModuleConfig = {
},
files: [
{
path: 'components/Welcome/TailwindDemo.vue',
path: 'app/components/Welcome/TailwindDemo.vue',
content: tailwindDemoComponent,
}
],
Expand Down
22 changes: 11 additions & 11 deletions src/configs/trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const nuxtTrpcRootConfig = `/**
* @see https://trpc.io/docs/v10/router
* @see https://trpc.io/docs/v10/procedures
*/
import type { Context } from '~/server/trpc/context'
import type { Context } from '~~/server/trpc/context'
import { initTRPC } from '@trpc/server'
import superjson from 'superjson'

Expand Down Expand Up @@ -69,8 +69,8 @@ export type Context = inferAsyncReturnType<typeof createContext>
`

const nuxtTrpcApiHandler = `import { createNuxtApiHandler } from 'trpc-nuxt'
import { createContext } from '~/server/trpc/context'
import { appRouter } from '~/server/trpc/routers'
import { createContext } from '~~/server/trpc/context'
import { appRouter } from '~~/server/trpc/routers'

// export API handler
export default createNuxtApiHandler({
Expand All @@ -79,7 +79,7 @@ export default createNuxtApiHandler({
})
`

const nuxtTrpcPlugin = `import type { AppRouter } from '~/server/trpc/routers'
const nuxtTrpcPlugin = `import type { AppRouter } from '~~/server/trpc/routers'
import superjson from 'superjson'
import { createTRPCNuxtClient, httpBatchLink } from 'trpc-nuxt/client'

Expand Down Expand Up @@ -132,27 +132,27 @@ const trpc: ModuleConfig = {
dependencies: [
{
name: '@trpc/server',
version: '^10.45.2',
version: '^11.6.0',
isDev: false
},
{
name: '@trpc/client',
version: '^10.45.2',
version: '^11.6.0',
isDev: false
},
{
name: 'trpc-nuxt',
version: '^0.10.21',
version: '^1.2.0',
isDev: false
},
{
name: 'zod',
version: '^3.23.8',
version: '^4.1.12',
isDev: false
},
{
name: 'superjson',
version: '^2.2.1',
version: '^2.2.2',
isDev: false
}
],
Expand All @@ -179,11 +179,11 @@ const trpc: ModuleConfig = {
content: nuxtTrpcApiHandler
},
{
path: 'plugins/trpcClient.ts',
path: 'app/plugins/trpcClient.ts',
content: nuxtTrpcPlugin
},
{
path: 'components/Welcome/TRPCDemo.vue',
path: 'app/components/Welcome/TRPCDemo.vue',
content: trpcDemoComponent,
}
],
Expand Down
4 changes: 2 additions & 2 deletions src/configs/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ const scripts: Config = {
dependencies: [
{
name: 'vue-tsc',
version: '2.2.8',
version: '^3.1.1',
isDev: true
},
{
name: 'typescript',
version: '5.7.3',
version: '^5.9.3',
isDev: true,
}
],
Expand Down
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ async function main() {
// Collect User preferences
let preferences: Preferences = {
setProjectName: 'my-sidebase-app',
setStack: 'merino',
addModules: ['prisma', 'sidebase-auth', 'trpc', 'tailwind', 'naiveui', 'i18n'],
runGitInit: true,
addCi: 'github',
Expand All @@ -37,7 +36,7 @@ async function main() {
}

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

// 2. Get Configs and modules
const { configs, modules } = getConfigs(preferences)
Expand Down
2 changes: 1 addition & 1 deletion src/messages/goodbye.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function sayGoodbye(preferences: Preferences) {
sayCommand(`${packageManager} install`, 'Install project dependencies')
}

if (preferences.addModules?.includes('prisma') || preferences.setStack === 'cheviot') {
if (preferences.addModules?.includes('prisma')) {
sayCommand(`${packageManager} run db`, 'Start the local postgres database in a new window')
sayCommand('npx prisma db push', 'Initialize the database & Prisma client')
}
Expand Down
Loading
Loading