Enhances Cloudflare Workers configuration and compatibility settings: - Enables worker execution based on provider/runtime conditions - Sets compatibility date specifically for Cloudflare to 2025-05-08 - Enforces module compatibility through experimental flag - Configures Wrangler with proper asset bindings and server entry point This update improves deployment reliability and ensures consistent behavior across different environments.
137 lines
2.9 KiB
TypeScript
137 lines
2.9 KiB
TypeScript
import { provider, runtime } from 'std-env'
|
|
import { currentLocales } from './i18n/i18n'
|
|
|
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
|
export default defineNuxtConfig({
|
|
|
|
modules: [
|
|
'@nuxthub/core',
|
|
'shadcn-nuxt',
|
|
'@vueuse/motion/nuxt',
|
|
'@nuxt/eslint',
|
|
'@nuxtjs/tailwindcss',
|
|
'@nuxtjs/color-mode',
|
|
'@nuxtjs/i18n',
|
|
],
|
|
|
|
devtools: { enabled: true },
|
|
|
|
colorMode: {
|
|
classSuffix: '',
|
|
},
|
|
|
|
runtimeConfig: {
|
|
siteToken: 'SinkCool',
|
|
redirectStatusCode: '301',
|
|
linkCacheTtl: 60,
|
|
redirectWithQuery: false,
|
|
homeURL: '',
|
|
cfAccountId: '',
|
|
cfApiToken: '',
|
|
dataset: 'sink',
|
|
aiModel: '@cf/meta/llama-3.1-8b-instruct',
|
|
aiPrompt: `You are a URL shortening assistant, please shorten the URL provided by the user into a SLUG. The SLUG information must come from the URL itself, do not make any assumptions. A SLUG is human-readable and should not exceed three words and can be validated using regular expressions {slugRegex} . Only the best one is returned, the format must be JSON reference {"slug": "example-slug"}`,
|
|
caseSensitive: false,
|
|
listQueryLimit: 500,
|
|
disableBotAccessLog: false,
|
|
public: {
|
|
previewMode: '',
|
|
slugDefaultLength: '6',
|
|
},
|
|
},
|
|
|
|
routeRules: {
|
|
'/': {
|
|
prerender: true,
|
|
ssr: false,
|
|
},
|
|
'/dashboard/**': {
|
|
prerender: true,
|
|
ssr: false,
|
|
},
|
|
'/dashboard': {
|
|
redirect: '/dashboard/links',
|
|
},
|
|
},
|
|
|
|
future: {
|
|
compatibilityVersion: 4,
|
|
},
|
|
|
|
experimental: {
|
|
enforceModuleCompatibility: true,
|
|
},
|
|
|
|
compatibilityDate: {
|
|
cloudflare: '2025-05-08',
|
|
},
|
|
|
|
nitro: {
|
|
experimental: {
|
|
openAPI: true,
|
|
},
|
|
timing: true,
|
|
openAPI: {
|
|
production: 'runtime',
|
|
meta: {
|
|
title: 'Sink API',
|
|
description: 'A Simple / Speedy / Secure Link Shortener with Analytics, 100% run on Cloudflare.',
|
|
},
|
|
route: '/_docs/openapi.json',
|
|
ui: {
|
|
scalar: {
|
|
route: '/_docs/scalar',
|
|
},
|
|
swagger: {
|
|
route: '/_docs/swagger',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
hub: {
|
|
ai: true,
|
|
analytics: true,
|
|
blob: false,
|
|
cache: false,
|
|
database: false,
|
|
kv: true,
|
|
workers: (provider === 'cloudflare_workers' || runtime === 'node') && provider !== 'cloudflare_pages',
|
|
},
|
|
|
|
eslint: {
|
|
config: {
|
|
stylistic: true,
|
|
standalone: false,
|
|
},
|
|
},
|
|
|
|
i18n: {
|
|
locales: currentLocales,
|
|
compilation: {
|
|
strictMessage: false,
|
|
escapeHtml: true,
|
|
},
|
|
lazy: true,
|
|
strategy: 'no_prefix',
|
|
detectBrowserLanguage: {
|
|
useCookie: true,
|
|
cookieKey: 'sink_i18n_redirected',
|
|
redirectOn: 'root',
|
|
},
|
|
baseUrl: '/',
|
|
defaultLocale: 'en-US',
|
|
},
|
|
|
|
shadcn: {
|
|
/**
|
|
* Prefix for all the imported component
|
|
*/
|
|
prefix: '',
|
|
/**
|
|
* Directory that the component lives in.
|
|
* @default "./components/ui"
|
|
*/
|
|
componentDir: './app/components/ui',
|
|
},
|
|
})
|