-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuxt.config.ts
308 lines (287 loc) · 8.83 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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
import { NuxtConfig } from '@nuxt/types'
import fetch from 'node-fetch'
// @ts-ignore
import colors from 'vuetify/es5/util/colors'
import { Group, News, Tag } from './types/quaint'
const environment = process.env.QUAINT_ENV || 'development'
const env_set = require(`./env.${environment}.js`)
const nuxt_config: NuxtConfig = {
ssr: true,
// Target: https://go.nuxtjs.dev/config-target
target: 'static',
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
htmlAttrs: {
lang: 'ja',
prefix: 'og: http://ogp.me/ns#', // OGPを使う宣言
},
titleTemplate: '%s - 日比谷高校星陵祭2024「Magic」公式サイト',
title: '星陵祭',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{
hid: 'description',
name: 'description',
content:
'令和6年度 第49回星陵祭 9月14日(土)、15日(日)開催 今年度の星陵祭は、テーマは「Magic」。日比谷のお祭りをみんなで盛り上げましょう!皆様のご来場を心よりお待ち申し上げております。',
},
{ name: 'format-detection', content: 'telephone=no' },
// OGP
{
hid: 'og:title',
property: 'og:title',
content: '日比谷高校星陵祭2024公式サイト',
},
{
hid: 'og:url',
property: 'og:url',
content: 'https://2024.seiryofes.com/',
},
{
hid: 'og:description',
property: 'og:description',
content:
'令和6年度 第49回星陵祭 9月14日(土)、15日(日)開催 テーマは「Magic」。皆様のご来場を心よりお待ち申し上げております。',
},
{
hid: 'og:image',
property: 'og:image',
content: 'https://2024.seiryofes.com/ogpimage.png',
// 正式実装期間は'ogpimage.png'、開発期間は'ogpimage_dev.png'を使用
},
{
hid: 'og:site_name',
property: 'og:site_name',
content: '日比谷高校星陵祭2024公式サイト',
},
{ hid: 'og:type', property: 'og:type', content: 'website' },
{ name: 'twitter:card', content: 'summary_large_image' },
{ name: 'twitter:site', content: '@hibiya_IT' },
{
hid: 'twitter:image',
name: 'twitter:image',
content: 'https://2024.seiryofes.com/ogpimage.png',
// 正式実装期間は'ogpimage.png'、開発期間は'ogpimage_dev.png'を使用
},
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'preconnect', href: 'https://fonts.gstatic.com' },
{
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css2?family=Noto+Sans+JP&display=swap',
},
],
},
// cross-env
env: env_set,
router: {
base: '/',
middleware: ['auth'],
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: ['~/assets/css/main.css'],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
'~/plugins/userrole.ts',
{ src: '~/plugins/vue-qrcode-reader.ts', ssr: false },
],
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
// https://go.nuxtjs.dev/typescript
'@nuxt/typescript-build',
// https://go.nuxtjs.dev/stylelint
'@nuxtjs/stylelint-module',
// https://go.nuxtjs.dev/vuetify
'@nuxtjs/vuetify',
],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
// https://go.nuxtjs.dev/axios
'@nuxtjs/axios',
// https://go.nuxtjs.dev/pwa
'@nuxtjs/pwa',
// https://go.nuxtjs.dev/content
'@nuxt/content',
// https://auth.nuxtjs.org/
'@nuxtjs/auth-next',
'@nuxtjs/google-gtag',
],
// Axios module configuration: https://go.nuxtjs.dev/config-axios
axios: {
// Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308
baseURL: env_set.BASEURL,
},
// PWA module configuration: https://go.nuxtjs.dev/pwa
pwa: {
meta: {
name: '星陵祭',
author: 'IT委員会|東京都立日比谷高等学校',
},
manifest: {
name: '星陵祭',
short_name: '星陵祭',
lang: 'ja',
},
},
// Content module configuration: https://go.nuxtjs.dev/config-content
content: {},
auth: {
plugins: ['~/plugins/axios.ts'],
watchLoggedIn: true,
redirect: {
login: '/login',
logout: '/',
callback: '/callback',
home: '/',
},
strategies: {
b2c: {
scheme: 'oauth2',
clientId: env_set.AZURE_B2C_CLIENTID,
endpoints: {
authorization: env_set.AZURE_B2C_ENDPOINT_AUTHORIZATION,
token: env_set.AZURE_B2C_ENDPOINT_TOKEN,
userInfo: undefined,
logout: env_set.AZURE_B2C_ENDPOINT_LOGOUT,
},
// ライブラリはthis.option.tokenで読んでるからここは絶対に"token"
token: {
property: 'id_token', // ここは /tokenエンドポイントをたたいた時に返ってくるjsonに合わせる
type: 'Bearer',
maxAge: 1800,
global: true,
},
// ライブラリはthis.option.refreshTokenで読んでるからここは絶対に"refreshToken"
refreshToken: {
property: 'refresh_token',
maxAge: 60 * 60 * 24 * 60,
},
responseType: 'code',
grantType: 'authorization_code',
accessType: 'offline',
codeChallengeMethod: 'S256',
scope: ['openid', 'profile', 'offline_access'],
},
ad: {
scheme: 'openIDConnect',
clientId: env_set.AZURE_AD_CLIENTID, // seiryofes.onmicrosoft.com
endpoints: {
configuration: env_set.AZURE_AD_OPENIDCONFIGURATION,
},
token: {
property: 'id_token',
maxAge: 60 * 60 * 24 * 30,
type: 'Bearer',
prefix: '_id_token.',
expirationPrefix: '_id_token_expiration.',
global: true,
},
responseType: 'code',
grantType: 'authorization_code',
scope: ['openid', 'profile', 'offline_access'],
codeChallengeMethod: 'S256',
},
},
},
'google-gtag': {
id: 'G-P1PFLRX395',
debug: true, // Enable to track in dev mode.
},
// Vuetify module configuration: https://go.nuxtjs.dev/config-vuetify
vuetify: {
customVariables: ['~/assets/variables.scss'],
theme: {
dark: false,
themes: {
light: {
theme_color: '#335594',
},
dark: {
primary: colors.blue.darken2,
accent: colors.grey.darken3,
secondary: colors.amber.darken3,
info: colors.teal.lighten1,
warning: colors.amber.base,
error: colors.deepOrange.accent4,
success: colors.green.accent3,
},
},
},
},
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
transpile: ['defu'],
},
generate: {
fallback: true,
async routes() {
// emvSet.BASEURLの末尾にスラッシュがある場合は削除する
const baseurl_without_slash =
env_set.BASEURL.slice(-1) === '/'
? env_set.BASEURL.slice(0, -1)
: env_set.BASEURL
const groups: Group[] = (await (
await fetch(baseurl_without_slash + '/groups', {
method: 'GET',
})
).json()) as Group[]
// デフォルト順にソート
groups.sort((x, y) => {
return x.id > y.id ? 1 : -1
})
const tags: Tag[] = (await (
await fetch(baseurl_without_slash + '/tags', {
method: 'GET',
})
).json()) as Tag[]
const all_news: News[] = (await (
await fetch(baseurl_without_slash + '/news', {
method: 'GET',
})
).json()) as News[]
const group_routes = groups.map((group) => {
return {
route: `/groups/${group.id}`,
payload: group,
}
})
const group_edit_routes = groups.map((group) => {
return {
route: `/groups/${group.id}/edit`,
payload: { group, tags },
}
})
const group_data_routes = groups.map((group) => {
return {
route: `/groups/${group.id}/data`,
payload: { group },
}
})
const news_routes = all_news.map((news: News) => {
return {
route: `/news/${news.id}`,
payload: { news },
}
})
return [
{
route: '/groups',
payload: { groups, tags },
},
...group_routes,
...group_edit_routes,
...group_data_routes,
...news_routes,
]
},
},
loading: {
color: '#335594',
height: '5px',
},
}
export default nuxt_config