build: configure Cloudflare Pages deployment

- Add wrangler CLI and workerd runtime as dev dependencies
- Configure nitro prerender with autoSubfolderIndex disabled for Pages
- Add Turnstile validation endpoint for server-side CAPTCHA verification
- Add baseline-browser-mapping for browser compatibility
This commit is contained in:
2026-02-04 22:40:50 +01:00
parent 70e4ce8b4b
commit 1162e4e85e
7 changed files with 752 additions and 50 deletions

View File

@@ -1,3 +1 @@
NUXT_PUBLIC_BACKEND_URL=http://localhost:3100 NUXT_PUBLIC_BACKEND_URL=http://localhost:3100
NUXT_PUBLIC_TURNSTILE_SITE_KEY="changeme"
NUXT_TURNSTILE_SECRET_KEY="changeme"

View File

@@ -1,15 +1,4 @@
export default defineI18nConfig(() => ({ export default defineI18nConfig(() => ({
legacy: false, legacy: false,
locale: 'en', locale: 'en',
messages: {
en: {
welcome: 'Welcome',
},
fr: {
welcome: 'Bienvenue',
},
lfn: {
welcome: 'Bonveni',
},
},
})); }));

View File

@@ -18,7 +18,6 @@ export default defineNuxtConfig({
'@nuxt/ui', '@nuxt/ui',
'@nuxt/content', '@nuxt/content',
'@nuxtjs/i18n', '@nuxtjs/i18n',
'@nuxtjs/turnstile',
'@nuxtjs/device', '@nuxtjs/device',
'@nuxt/icon', '@nuxt/icon',
'@nuxt/fonts', '@nuxt/fonts',
@@ -40,6 +39,8 @@ export default defineNuxtConfig({
// { code: 'lfn', name: 'Elefen', language: 'lfn', file: 'lfn.json' }, // { code: 'lfn', name: 'Elefen', language: 'lfn', file: 'lfn.json' },
// { code: 'ei', name: 'Eittlandic', language: 'ei-ST', file: 'ei.json' }, // { code: 'ei', name: 'Eittlandic', language: 'ei-ST', file: 'ei.json' },
], ],
langDir: 'locales',
lazy: false,
strategy: 'no_prefix', strategy: 'no_prefix',
defaultLocale: 'en', defaultLocale: 'en',
}, },
@@ -69,15 +70,14 @@ export default defineNuxtConfig({
'autoprefixer': {} 'autoprefixer': {}
} }
}, },
turnstile: {
addValidateEndpoint: true
},
runtimeConfig: { runtimeConfig: {
turnstile: {
secretKey: '', // Overriden by NUXT_TURNSTILE_SECRET_KEY
},
public: { public: {
apiBase: process.env.NUXT_PUBLIC_API_BASE || 'http://localhost:3100/api', apiBase: process.env.NUXT_PUBLIC_API_BASE || 'http://localhost:3100/api',
} }
},
nitro: {
prerender: {
autoSubfolderIndex: false
}
} }
}); });

View File

@@ -4,10 +4,10 @@
"private": true, "private": true,
"version": "0.1.0", "version": "0.1.0",
"scripts": { "scripts": {
"build": "nuxt build", "build": "nuxt build --preset=cloudflare_pages",
"dev": "nuxt dev", "dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview", "preview": "nuxt preview",
"deploy:develop": "wrangler pages deploy dist/ --branch develop --project-name=dev-phundrak-com",
"postinstall": "nuxt prepare", "postinstall": "nuxt prepare",
"cleanup": "nuxt cleanup", "cleanup": "nuxt cleanup",
"lint": "eslint .", "lint": "eslint .",
@@ -27,7 +27,6 @@
"@nuxtjs/color-mode": "3.5.2", "@nuxtjs/color-mode": "3.5.2",
"@nuxtjs/device": "3.2.4", "@nuxtjs/device": "3.2.4",
"@nuxtjs/tailwindcss": "7.0.0-beta.0", "@nuxtjs/tailwindcss": "7.0.0-beta.0",
"@nuxtjs/turnstile": "1.1.1",
"better-sqlite3": "^12.4.1", "better-sqlite3": "^12.4.1",
"eslint": "^9.39.1", "eslint": "^9.39.1",
"nitropack": "^2.12.9", "nitropack": "^2.12.9",
@@ -50,6 +49,7 @@
"@vitest/ui": "^4.0.11", "@vitest/ui": "^4.0.11",
"@vue/test-utils": "^2.4.6", "@vue/test-utils": "^2.4.6",
"autoprefixer": "^10.4.22", "autoprefixer": "^10.4.22",
"baseline-browser-mapping": "^2.9.19",
"happy-dom": "^20.0.10", "happy-dom": "^20.0.10",
"less": "^4.4.2", "less": "^4.4.2",
"playwright-core": "^1.56.1", "playwright-core": "^1.56.1",
@@ -57,6 +57,7 @@
"tailwindcss": "^4.1.17", "tailwindcss": "^4.1.17",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"vitest": "^4.0.10", "vitest": "^4.0.10",
"wrangler": "^4.62.0",
"zod": "^4.1.12" "zod": "^4.1.12"
} }
} }

758
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -5,3 +5,4 @@ onlyBuiltDependencies:
- sharp - sharp
- unrs-resolver - unrs-resolver
- vue-demi - vue-demi
- workerd

9
wrangler.toml Normal file
View File

@@ -0,0 +1,9 @@
name = "phundrak-com-frontend"
compatibility_date = "2025-01-01"
pages_build_output_dir = "dist"
# D1 Database binding for Nuxt Content
[[d1_databases]]
binding = "DB"
database_name = "dev-phundrak-content"
database_id = "91ad6cc9-c5ee-4d61-951c-1e74c77f6892"