-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.js
102 lines (101 loc) · 2.41 KB
/
nuxt.config.js
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
import { createDirectus, rest, staticToken, readSingleton, updateSingleton } from "@directus/sdk"
import pack from './package.json'
export default defineNuxtConfig({
compatibilityDate: "2024-08-04",
extends: ['./auth', './theme', './membership'],
devServer: {
port: 3000
},
app: {
layoutTransition: { name: 'page', mode: 'out-in' },
pageTransition: { name: 'page', mode: 'out-in' },
siteName: 'Chromatone Academy',
},
site: {
url: 'https://academy.chromatone.center',
},
css: [
'@unocss/reset/tailwind.css',
],
devtools: {
enabled: true,
timeline: {
enabled: true
}
},
directus: {
autoRefresh: true,
devtools: true,
url: process.env?.NUXT_PUBLIC_DB_URL,
token: process.env?.NUXT_PUBLIC_ACADEMY_KEY
},
runtimeConfig: {
dbManagerKey: '',
stripeSecretKey: '',
stripeWebhookSecret: '',
apiToken: '',
public: {
appDomain: '',
botUrl: '',
dbUrl: '',
dbToken: '',
academyKey: '',
umamiId: '',
umamiUrl: '',
subscriptionsOpen: '',
}
},
modules: [
'nuxt-auth-utils',
"@unocss/nuxt",
"nuxt-directus",
"@nuxtjs/sitemap",
'@nuxtjs/mdc',
'@nuxt/image',
'@nuxtjs/color-mode',
'floating-vue/nuxt',
'nuxt-cron'
],
router: {
scrollBehavior() {
return { top: 0 }
}
},
routeRules: {
'/': { prerender: true },
},
colorMode: {
classSuffix: ''
},
image: {
provider: 'directus',
format: ['webp'],
domains: [process.env?.NUXT_PUBLIC_DB_DOMAIN],
directus: {
baseURL: `${process.env?.NUXT_PUBLIC_DB_URL}/assets/`,
modifiers: {
withoutEnlargement: 'true'
}
}
},
experimental: {
sharedPrerenderData: true
},
vueEmail: {
baseUrl: 'https://academy.chromatone.center/',
autoImport: true,
},
hooks: {
'build:before': async () => {
const db = createDirectus(process.env?.NUXT_PUBLIC_DB_URL).with(rest()).with(staticToken(process.env?.NUXT_PUBLIC_ACADEMY_KEY))
const academy = await db.request(readSingleton('academy', { fields: ['version'] }))
console.log('version: ', pack?.version, pack?.version == academy?.version ? '✔️' : 'updating')
if (pack?.version != academy?.version) {
await db.request(updateSingleton('academy', {
version: pack?.version
}))
console.log('updated version to: ', pack?.version)
}
}
}
})