-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.ts
215 lines (195 loc) · 5.42 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
extends: [
'./core',
'./ui',
],
ssr: true,
compatibilityDate: '2024-04-03',
devtools: { enabled: true },
modules: [
'@nuxt/eslint',
'@nuxtjs/tailwindcss',
'@pinia/nuxt',
'@nuxt/icon',
'@vueuse/nuxt',
'@nuxt/fonts',
'@vee-validate/nuxt',
'@sidebase/nuxt-auth',
'floating-vue/nuxt',
'@sentry/nuxt/module',
'@nuxt/test-utils/module',
],
eslint: {
config: {
stylistic: {
semi: true,
},
},
},
// ========================================
// set up dev server proxy
// ========================================
devServer: {
host: process.env.NUXT_APP_DEVSERVER_HOST,
https: {
key: './mydoma.in-key.pem',
cert: './mydoma.in.pem',
},
},
// ========================================
// set up pinia
// ========================================
pinia: {
storesDirs: ['./layers/**/stores/**', './core/stores/**'],
},
// ========================================
// set up sentry
// ========================================
sentry: {
sourceMapsUploadOptions: {
org: process.env.NUXT_SENTRY_ORG,
project: process.env.NUXT_SENTRY_PROJECT,
authToken: process.env.NUXT_SENTRY_TOKEN,
},
},
// ========================================
// set up fonts
// ========================================
fonts: {
// define font options
// https://fonts.nuxt.com/get-started/configuration#families
families: [
{ name: 'Inter', provider: 'google' },
],
},
// ========================================
// set up icon
// ========================================
icon: {
serverBundle: {
// explicitly define which icon package will be bundled and served from our server
// https://nuxt.com/modules/icon#iconify-dataset
collections: ['uil', 'mdi'],
},
// define custom icon settings, must set `ssr: true` or set `provider: "server"` under `icon` setting
// https://nuxt.com/modules/icon#custom-local-collections
customCollections: [
{
prefix: 'mdl',
dir: './core/assets/icons',
},
],
},
// ========================================
// setup env
// ========================================
runtimeConfig: {
public: {
enableMock: process.env.NUXT_PUBLIC_ENABLE_MOCK,
apiBaseUrl: process.env.NUXT_PUBLIC_API_BASE_URL,
},
},
// ========================================
// setup auth
// ========================================
auth: {
isEnabled: true,
disableServerSideAuth: false,
originEnvKey: 'NUXT_APP_BASE_URL',
// when setting `baseURL`, make sure it ends with `/`!
baseURL: process.env.NUXT_PUBLIC_AUTH_BASE_URL,
provider: {
type: 'local',
pages: {
login: '/auth/login',
},
endpoints: {
// RULE:
// when `path` is defined with starting `/`, it will use site as origin
// if `baseURL` is defined, and the target origin for the path, MAKE SURE to not start `path with `/`.
// ie. `path: 'api/login'` will result in `<auth.baseURL>api/login
// while `path: '/api/login'` will result in `localhost:3000/api/login` (or the site's origin when deployed)
signIn: { path: '/api/login', method: 'post' },
signOut: { path: '/api/logout', method: 'post' },
signUp: { path: '/api/register', method: 'post' },
getSession: { path: '/api/session', method: 'get' },
},
refresh: {
isEnabled: false,
},
token: {
signInResponseTokenPointer: '/data/token',
type: 'Bearer',
cookieName: 'auth.token',
headerName: 'Authorization',
// maxAgeInSeconds: 3000,
// sameSiteAttribute: 'lax',
// cookieDomain: '',
// secureCookieAttribute: false,
// httpOnlyCookieAttribute: false,
},
session: {
dataType: {
user: 'Record<string, any>',
rbac: 'Record<string, boolean>[]',
},
},
},
// sessionRefresh: {
// enablePeriodically: true,
// enableOnWindowFocus: true,
// },
globalAppMiddleware: false,
},
// ========================================
// setup layers as domain architecture
// ========================================
// aliases, layers, core and third party
alias: {
// layer-level aliases (prefixed with a `#`)
'#core': '/core',
'#playground': '~/layers/playground',
'#ui': '/ui',
'#auth': '~/layers/auth',
// core
'~/components': '/core/components',
'~/composables': '/core/composables',
'~/utils': '/core/utils',
'~/plugins': '/core/plugins',
'~/stores': '/core/stores',
},
// default folders override
dir: {
// core
middleware: 'core/middleware',
modules: 'core/modules',
plugins: 'core/plugins',
layouts: 'core/layouts',
public: 'core/public',
pages: 'core/pages',
},
// setup global style to be included in each page
css: [
'~/core/assets/global.css',
],
// define layers components path config here
// relative path must use `~` as base
components: [
{
path: '~/layers/playground/components',
pathPrefix: false,
global: false,
},
{
path: '~/core/components',
prefix: 'Core',
global: true,
},
{
path: '~/ui/components',
prefix: 'Ui',
global: true,
},
],
});