-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
nuxt.config.ts
129 lines (124 loc) · 3.45 KB
/
nuxt.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import fs from "node:fs/promises";
import path from "node:path";
import { defineNuxtConfig } from "nuxt/config";
import pkg from "./package.json";
export default defineNuxtConfig({
modules: ["@unocss/nuxt", "@vueuse/nuxt", "@pinia/nuxt", "@nuxtjs/i18n", "@nuxt/devtools", "@nuxt/eslint"],
runtimeConfig: {
public: {
appName: pkg.name,
appVersion: pkg.version,
},
auth: {
session: {
cookieName: "auth_session",
maxAge: "2592000", // 30 days
},
oidc: {
rootUrl: "http://localhost:3000",
clientId: undefined,
clientSecret: undefined,
codeVerifierCookieName: "oidc_code_verifier",
stateCookieName: "oidc_state",
nonceCookieName: "oidc_nonce",
issuer: undefined,
authorizationEndpoint: undefined,
tokenEndpoint: undefined,
userInfoEndpoint: undefined,
endSessionEndpoint: undefined,
jwksUri: undefined,
scopes: "openid profile email roles",
nameAttributePath: "name || preferred_username",
emailAttributePath: "email",
roleAttributePath:
"contains(roles[*], 'admin') && 'admin' || contains(roles[*], 'editor') && 'editor' || 'viewer'",
},
},
logLevel: "info",
},
routeRules: {
"/private": { ssr: false },
"/profile": { ssr: false },
"/api/trpc/**": { prerender: false },
},
nitro: {
experimental: {
tasks: true,
},
scheduledTasks: {
"0 * * * *": ["auth:session-reaper"],
},
},
imports: {
autoImport: false,
dirs: [],
},
components: {
dirs: [],
},
typescript: {
shim: false,
},
build: {
transpile: ["primevue", "trpc-nuxt"],
},
hooks: {
"nitro:build:public-assets": async (nitro) => {
// Copy bin directory to the output directory
const binInDir = path.join(__dirname, "bin");
const binOutDir = path.join(nitro.options.output.dir, "bin");
await fs.cp(binInDir, binOutDir, { recursive: true });
// Copy Prisma schema and migrations to the output directory
const prismaInDir = path.join(__dirname, "prisma");
const prismaOutDir = path.join(nitro.options.output.dir, "prisma");
await fs.cp(prismaInDir, prismaOutDir, { recursive: true });
// Copy Prisma schema engine to the output directory
const prismaEnginesInDir = path.join(__dirname, "node_modules", "@prisma", "engines");
const prismaEnginesOutDir = path.join(nitro.options.output.serverDir, "node_modules", "@prisma", "engines");
const prismaEnginesFiles = await fs.readdir(prismaEnginesInDir);
for (const file of prismaEnginesFiles) {
if (/^schema-engine-.+$/.test(file)) {
await fs.cp(path.join(prismaEnginesInDir, file), path.join(prismaEnginesOutDir, file));
}
}
},
},
unocss: {
components: false,
},
vueuse: {
autoImports: false,
},
i18n: {
lazy: true,
langDir: "locales",
defaultLocale: "en",
locales: [
{
name: "English",
code: "en",
iso: "en-US",
file: "en-US.ts",
dir: "ltr",
},
{
name: "Español",
code: "es",
iso: "es-ES",
file: "es-ES.ts",
dir: "ltr",
},
],
strategy: "no_prefix",
detectBrowserLanguage: {
useCookie: true,
cookieKey: "i18n_locale",
alwaysRedirect: true,
fallbackLocale: "en",
},
},
devtools: {
enabled: true,
},
telemetry: false,
});