Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ BLOB_READ_WRITE_TOKEN=
# S3_REGION=
# Dev auth passthrough (optional, dev environment only)
# Uncomment and set values to skip GitHub OAuth during development
# NUXT_DEV_USER_NAME=dev-user
# NUXT_DEV_USER_NAME=dev
# NUXT_DEV_USER_EMAIL=dev@example.com
# NUXT_DEV_USER_AVATAR=https://github.com/identicons/dev.png
# NUXT_DEV_USER_AVATAR=https://avatars.githubusercontent.com/u/263761647
40 changes: 40 additions & 0 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: deploy
on:
pull_request:
branches: [main]
jobs:
preview:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- run: pnpm install
- name: Build
run: pnpm build
env:
NITRO_PRESET: cloudflare-module
CLOUDFLARE_ENV: preview
NODE_OPTIONS: --max-old-space-size=4096
- name: Upload Preview Version
id: preview
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: .output
preCommands: wrangler d1 migrations apply DB --remote --config server/wrangler.json
command: versions upload
- name: Comment Preview URL
uses: marocchino/sticky-pull-request-comment@v3
with:
header: deploy-preview
message: |
**Preview Deployment**
${{ steps.preview.outputs.deployment-url }}
62 changes: 11 additions & 51 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,27 @@ name: deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
deploy-production:
if: github.event_name == 'push'
production:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install node
uses: actions/setup-node@v6
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- name: Install dependencies
run: pnpm install
- run: pnpm install
- name: Build
run: pnpm build
env:
NITRO_PRESET: cloudflare-module
NODE_OPTIONS: --max-old-space-size=4096
- name: Apply D1 Migrations
run: npx wrangler d1 migrations apply DB --remote --config .output/server/wrangler.json
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Deploy
run: npx wrangler --cwd .output deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
deploy-preview:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install node
uses: actions/setup-node@v6
uses: cloudflare/wrangler-action@v3
with:
node-version: 24
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
env:
NITRO_PRESET: cloudflare-module
CLOUDFLARE_ENV: preview
NODE_OPTIONS: --max-old-space-size=4096
- name: Apply D1 Migrations
run: npx wrangler d1 migrations apply DB --remote --config .output/server/wrangler.json --env preview
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Deploy
run: npx wrangler --cwd .output deploy --env preview
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: .output
preCommands: wrangler d1 migrations apply DB --remote --config server/wrangler.json
command: deploy
63 changes: 46 additions & 17 deletions app/components/UserMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,11 @@ function logout() {
Appearance
</DropdownMenuSubTrigger>
<DropdownMenuSubContent>
<DropdownMenuCheckboxItem
:checked="mode === 'light'"
@select.prevent="mode = 'light'"
>
<DropdownMenuCheckboxItem :checked="mode === 'light'" @select.prevent="mode = 'light'">
<LucideIcon name="i-lucide-sun" class="size-4" />
Light
</DropdownMenuCheckboxItem>
<DropdownMenuCheckboxItem
:checked="mode === 'dark'"
@select.prevent="mode = 'dark'"
>
<DropdownMenuCheckboxItem :checked="mode === 'dark'" @select.prevent="mode = 'dark'">
<LucideIcon name="i-lucide-moon" class="size-4" />
Dark
</DropdownMenuCheckboxItem>
Expand All @@ -81,28 +75,63 @@ function logout() {
Templates
</DropdownMenuSubTrigger>
<DropdownMenuSubContent>
<DropdownMenuItem as="a" href="https://starter-template.nuxt.dev/" target="_blank">
<DropdownMenuItem
as="a"
href="https://shadcn-nuxt-ui-starter.stackhacker.io/"
target="_blank"
disabled
>
Starter
</DropdownMenuItem>
<DropdownMenuItem as="a" href="https://landing-template.nuxt.dev/" target="_blank">
<DropdownMenuItem
as="a"
href="https://shadcn-nuxt-ui-landing.stackhacker.io/"
target="_blank"
disabled
>
Landing
</DropdownMenuItem>
<DropdownMenuItem as="a" href="https://docs-template.nuxt.dev/" target="_blank">
<DropdownMenuItem
as="a"
href="https://shadcn-nuxt-ui-docs.stackhacker.io/"
target="_blank"
disabled
>
Docs
</DropdownMenuItem>
<DropdownMenuItem as="a" href="https://saas-template.nuxt.dev/" target="_blank">
<DropdownMenuItem
as="a"
href="https://shadcn-nuxt-ui-saas.stackhacker.io/"
target="_blank"
disabled
>
SaaS
</DropdownMenuItem>
<DropdownMenuItem as="a" href="https://dashboard-template.nuxt.dev/" target="_blank">
<DropdownMenuItem
as="a"
href="https://shadcn-nuxt-ui-dashboard.stackhacker.io/"
target="_blank"
disabled
>
Dashboard
</DropdownMenuItem>
<DropdownMenuCheckboxItem :checked="true" disabled>
Chat
</DropdownMenuCheckboxItem>
<DropdownMenuItem as="a" href="https://portfolio-template.nuxt.dev/" target="_blank">
<DropdownMenuItem
as="a"
href="https://shadcn-nuxt-ui-portfolio.stackhacker.io/"
target="_blank"
disabled
>
Portfolio
</DropdownMenuItem>
<DropdownMenuItem as="a" href="https://changelog-template.nuxt.dev/" target="_blank">
<DropdownMenuItem
as="a"
href="https://shadcn-nuxt-ui-changelog.stackhacker.io/"
target="_blank"
disabled
>
Changelog
</DropdownMenuItem>
</DropdownMenuSubContent>
Expand All @@ -111,11 +140,11 @@ function logout() {
<DropdownMenuSeparator />

<!-- Documentation & GitHub -->
<DropdownMenuItem as="a" href="https://ui.nuxt.com/docs/getting-started/installation/nuxt" target="_blank">
<DropdownMenuItem as="a" href="https://shadcn-nuxt-ui.stackhacker.io/" target="_blank">
<LucideIcon name="i-lucide-book-open" class="size-4" />
Documentation
</DropdownMenuItem>
<DropdownMenuItem as="a" href="https://github.com/nuxt-ui-templates/chat" target="_blank">
<DropdownMenuItem as="a" href="https://github.com/shadcn-nuxt-ui/chat" target="_blank">
<Icon name="i-simple-icons-github" class="size-4" />
GitHub repository
</DropdownMenuItem>
Expand Down
2 changes: 1 addition & 1 deletion server/plugins/dev-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { and, eq } from 'drizzle-orm'
const DEV_PROVIDER_ID = 'dev-user'

export default defineNitroPlugin((nitroApp) => {
if (!import.meta.dev) return
if (!import.meta.dev && !process.env.NUXT_DEV_USER_NAME) return

const name = process.env.NUXT_DEV_USER_NAME
const email = process.env.NUXT_DEV_USER_EMAIL
Expand Down
6 changes: 6 additions & 0 deletions wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
],
"env": {
"preview": {
"routes": [],
"vars": {
"NUXT_DEV_USER_NAME": "preview",
"NUXT_DEV_USER_EMAIL": "preview@example.com",
"NUXT_DEV_USER_AVATAR": "https://github.com/identicons/preview.png"
},
"d1_databases": [
{
"binding": "DB",
Expand Down
Loading