2023-07-08 10:36:02 +02:00
|
|
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
2023-11-12 07:54:05 +01:00
|
|
|
import yaml from '@rollup/plugin-yaml';
|
2023-07-08 10:36:02 +02:00
|
|
|
import svgLoader from 'vite-svg-loader';
|
2023-11-20 16:31:13 +01:00
|
|
|
import { cpus } from 'node:os';
|
2023-07-08 10:36:02 +02:00
|
|
|
import genSitemap from './scripts/gen-sitemap';
|
2023-07-17 18:44:06 +02:00
|
|
|
import { genApiTranslationFiles } from './scripts/gen-api-translations';
|
2023-11-06 17:21:48 +01:00
|
|
|
import type { LocaleObject } from '@nuxtjs/i18n/dist/runtime/composables';
|
2023-11-12 07:54:05 +01:00
|
|
|
import { genLocalesJson } from './scripts/gen-locales';
|
2023-07-08 10:36:02 +02:00
|
|
|
|
2023-07-10 19:54:13 +02:00
|
|
|
// 公開時のドメイン(末尾スラッシュなし)
|
|
|
|
const baseUrl = 'https://misskey-hub.net';
|
|
|
|
|
2023-11-06 17:21:48 +01:00
|
|
|
// 言語定義
|
2023-11-12 05:21:23 +01:00
|
|
|
export const localesConst = [
|
2023-11-12 07:54:05 +01:00
|
|
|
{ files: [ 'ja-JP.json' ], code: 'ja', iso: 'ja-JP', name: '日本語' },
|
|
|
|
{ files: [ 'en-US.json' ], code: 'en', iso: 'en-US', name: 'English' },
|
|
|
|
{ files: [ 'id-ID.json' ], code: 'id', iso: 'id-ID', name: 'Bahasa Indonesia' },
|
|
|
|
{ files: [ 'ko-KR.json' ], code: 'ko', iso: 'ko-KR', name: '한국어' },
|
|
|
|
{ files: [ 'it-IT.json' ], code: 'it', iso: 'it-IT', name: 'Italiano' },
|
|
|
|
{ files: [ 'pl-PL.json' ], code: 'pl', iso: 'pl-PL', name: 'Polski' },
|
|
|
|
{ files: [ 'fr-FR.json' ], code: 'fr', iso: 'fr-FR', name: 'Français' },
|
|
|
|
{ files: [ 'zh-CN.json' ], code: 'cn', iso: 'zh-CN', name: '简体中文' },
|
|
|
|
{ files: [ 'zh-TW.json' ], code: 'tw', iso: 'zh-TW', name: '繁体中文' },
|
2023-11-12 05:21:23 +01:00
|
|
|
] as const;
|
|
|
|
|
|
|
|
export type LocaleCodes = typeof localesConst[number]['code'];
|
|
|
|
|
|
|
|
export const locales = localesConst as unknown as LocaleObject[];
|
2023-07-11 19:19:32 +02:00
|
|
|
|
2023-07-08 10:36:02 +02:00
|
|
|
export default defineNuxtConfig({
|
2023-07-10 19:54:13 +02:00
|
|
|
runtimeConfig: {
|
2023-10-01 06:11:13 +02:00
|
|
|
locales,
|
2023-07-10 19:54:13 +02:00
|
|
|
public: {
|
|
|
|
baseUrl,
|
|
|
|
}
|
|
|
|
},
|
2023-07-08 10:36:02 +02:00
|
|
|
css: [
|
2023-07-10 19:54:13 +02:00
|
|
|
"github-markdown-css/github-markdown.css",
|
2023-10-29 14:02:27 +01:00
|
|
|
"@/assets/css/nprogress.css",
|
2023-07-08 10:36:02 +02:00
|
|
|
"@/assets/css/tailwind.css",
|
2023-07-09 11:58:53 +02:00
|
|
|
"@/assets/css/bootstrap-forms.scss",
|
2023-07-08 10:36:02 +02:00
|
|
|
],
|
|
|
|
modules: [
|
|
|
|
'@nuxt/content',
|
|
|
|
'@nuxtjs/i18n',
|
2023-07-08 19:23:27 +02:00
|
|
|
'@nuxtjs/color-mode',
|
2023-07-08 10:36:02 +02:00
|
|
|
],
|
|
|
|
app: {
|
|
|
|
head: {
|
|
|
|
link: [
|
|
|
|
{ rel: 'stylesheet', href: '/fonts/fonts.css' },
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2023-07-10 19:54:13 +02:00
|
|
|
content: {
|
|
|
|
navigation: {
|
|
|
|
fields: [
|
|
|
|
'date',
|
2023-07-15 10:32:48 +02:00
|
|
|
'description',
|
2023-07-10 19:54:13 +02:00
|
|
|
]
|
2023-07-17 18:44:06 +02:00
|
|
|
},
|
|
|
|
highlight: {
|
|
|
|
theme: {
|
|
|
|
// Default theme (same as single string)
|
|
|
|
default: 'github-light',
|
|
|
|
// Theme used if `html.dark`
|
|
|
|
dark: 'github-dark',
|
|
|
|
},
|
|
|
|
},
|
2023-07-10 19:54:13 +02:00
|
|
|
},
|
2023-07-08 10:36:02 +02:00
|
|
|
i18n: {
|
2023-07-10 19:54:13 +02:00
|
|
|
baseUrl,
|
2023-07-08 10:36:02 +02:00
|
|
|
vueI18n: './i18n.config.ts',
|
2023-07-11 19:19:32 +02:00
|
|
|
locales,
|
2023-11-12 07:54:05 +01:00
|
|
|
lazy: true,
|
|
|
|
langDir: 'locales_dist',
|
2023-07-08 10:36:02 +02:00
|
|
|
defaultLocale: 'ja',
|
|
|
|
strategy: 'prefix',
|
2023-09-29 13:30:27 +02:00
|
|
|
detectBrowserLanguage: {
|
|
|
|
fallbackLocale: 'ja',
|
|
|
|
},
|
2023-09-09 08:06:22 +02:00
|
|
|
trailingSlash: true,
|
2023-07-08 10:36:02 +02:00
|
|
|
},
|
2023-07-08 19:23:27 +02:00
|
|
|
colorMode: {
|
|
|
|
classSuffix: '',
|
|
|
|
},
|
2023-07-08 10:36:02 +02:00
|
|
|
postcss: {
|
|
|
|
plugins: {
|
|
|
|
tailwindcss: {},
|
|
|
|
autoprefixer: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
alias: {
|
|
|
|
'bi': 'bootstrap-icons/icons',
|
|
|
|
},
|
|
|
|
vite: {
|
|
|
|
plugins: [
|
2023-11-12 07:54:05 +01:00
|
|
|
yaml(),
|
2023-07-08 10:36:02 +02:00
|
|
|
svgLoader({
|
|
|
|
defaultImport: 'component',
|
|
|
|
svgoConfig: {
|
|
|
|
plugins: [
|
|
|
|
{
|
|
|
|
name: 'preset-default',
|
|
|
|
params: {
|
|
|
|
overrides: {
|
|
|
|
removeViewBox: false,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}),
|
2023-11-12 07:54:05 +01:00
|
|
|
],
|
2023-07-08 10:36:02 +02:00
|
|
|
},
|
|
|
|
nitro: {
|
|
|
|
hooks: {
|
|
|
|
'compiled': genSitemap,
|
|
|
|
},
|
|
|
|
prerender: {
|
2023-11-20 16:31:13 +01:00
|
|
|
concurrency: cpus().length * 8 ?? 12,
|
2023-07-08 10:36:02 +02:00
|
|
|
routes: [
|
|
|
|
"/404.html"
|
2023-07-13 18:10:25 +02:00
|
|
|
],
|
|
|
|
// 【一時対応】とりあえずビルドできるようにする
|
|
|
|
failOnError: false,
|
2023-07-08 10:36:02 +02:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
'@/server/plugins/appendComment.ts',
|
2023-09-29 13:30:27 +02:00
|
|
|
'@/server/plugins/i18nRedirector.ts',
|
2023-07-08 10:36:02 +02:00
|
|
|
],
|
2023-07-13 18:27:48 +02:00
|
|
|
},
|
2023-07-17 18:44:06 +02:00
|
|
|
hooks: {
|
2023-11-12 07:54:05 +01:00
|
|
|
'build:before': (...args) => {
|
|
|
|
genApiTranslationFiles(...args);
|
|
|
|
genLocalesJson(...args);
|
|
|
|
},
|
2023-07-17 18:44:06 +02:00
|
|
|
},
|
2023-07-13 18:27:48 +02:00
|
|
|
experimental: {
|
|
|
|
inlineSSRStyles: false,
|
2023-07-15 10:44:29 +02:00
|
|
|
payloadExtraction: true,
|
2023-09-28 12:29:11 +02:00
|
|
|
componentIslands: true,
|
2023-07-13 18:27:48 +02:00
|
|
|
},
|
2023-07-08 10:36:02 +02:00
|
|
|
})
|