FMHYedit/.vitepress/config.mts

110 lines
2.9 KiB
TypeScript
Raw Permalink Normal View History

2024-01-25 16:32:45 +00:00
import { defineConfig } from 'vitepress'
import UnoCSS from 'unocss/vite'
import consola from 'consola'
import {
commitRef,
feedback,
meta,
search,
sidebar,
socialLinks
} from './constants'
import { generateImages, generateMeta, generateFeed } from './hooks'
import { toggleStarredPlugin } from './markdown/toggleStarred'
import { movePlugin, emojiRender, defs } from './markdown/emoji'
2023-11-12 16:42:57 +00:00
// @unocss-include
2024-01-25 16:32:45 +00:00
const baseUrl = process.env.GITHUB_ACTIONS ? '/FMHYedit' : '/'
2023-11-13 01:54:44 +00:00
export default defineConfig({
2024-01-25 16:32:45 +00:00
title: 'FMHY',
2023-11-13 01:54:44 +00:00
description: meta.description,
2024-01-25 16:32:45 +00:00
titleTemplate: ':title • freemediaheckyeah',
lang: 'en-US',
2024-01-24 07:25:45 +00:00
lastUpdated: false,
2023-11-13 01:54:44 +00:00
cleanUrls: true,
2024-01-25 16:32:45 +00:00
appearance: 'dark',
2024-01-24 07:29:55 +00:00
base: baseUrl,
2024-01-25 16:32:45 +00:00
srcExclude: ['readme.md', 'single-page'],
2023-11-13 01:54:44 +00:00
ignoreDeadLinks: true,
sitemap: {
2024-01-25 16:32:45 +00:00
hostname: meta.hostname
2023-11-13 01:54:44 +00:00
},
head: [
2024-01-25 16:32:45 +00:00
['meta', { name: 'theme-color', content: '#7bc5e4' }],
['meta', { name: 'og:type', content: 'website' }],
['meta', { name: 'og:locale', content: 'en' }],
['link', { rel: 'icon', href: '/test.png' }],
2023-11-13 01:54:44 +00:00
// PWA
2024-01-25 16:32:45 +00:00
['link', { rel: 'icon', href: '/test.png', type: 'image/svg+xml' }],
['link', { rel: 'alternate icon', href: '/test.png' }],
['link', { rel: 'mask-icon', href: '/test.png', color: '#7bc5e4' }],
2023-11-13 01:54:44 +00:00
// prettier-ignore
["meta", { name: "keywords", content: meta.keywords.join(" ") }],
2024-01-25 16:32:45 +00:00
['link', { rel: 'apple-touch-icon', href: '/test.png', sizes: '192x192' }]
2023-11-13 01:54:44 +00:00
],
transformHead: async (context) => generateMeta(context, meta.hostname),
buildEnd: async (context) => {
2023-12-31 11:15:48 +00:00
generateImages(context)
.then(() => generateFeed(context))
2024-01-25 16:32:45 +00:00
.finally(() => consola.success('Success!'))
2023-11-13 01:54:44 +00:00
},
vite: {
2024-01-25 16:32:45 +00:00
optimizeDeps: { exclude: ['workbox-window'] },
2023-11-13 01:54:44 +00:00
plugins: [
UnoCSS({
2024-01-25 16:32:45 +00:00
configFile: '../unocss.config.ts'
2023-11-13 01:54:44 +00:00
}),
2024-01-24 07:53:57 +00:00
{
2024-01-25 16:32:45 +00:00
name: 'custom:adjust-order',
2024-01-24 07:53:57 +00:00
configResolved(c) {
2024-01-25 16:32:45 +00:00
movePlugin(
c.plugins as any,
'vitepress',
'before',
'unocss:transformers:pre'
)
}
}
2023-11-12 16:42:57 +00:00
],
2023-11-13 01:54:44 +00:00
build: {
// Shut the fuck up
2024-01-25 16:32:45 +00:00
chunkSizeWarningLimit: Number.POSITIVE_INFINITY
}
2023-11-13 01:54:44 +00:00
},
markdown: {
2024-01-24 07:53:57 +00:00
emoji: { defs },
2023-11-13 01:54:44 +00:00
config(md) {
2024-01-25 16:32:45 +00:00
md.use(emojiRender)
md.use(toggleStarredPlugin)
}
2023-11-13 01:54:44 +00:00
},
themeConfig: {
2024-01-04 08:08:55 +00:00
search,
2023-11-13 01:54:44 +00:00
footer: {
2024-01-25 16:32:45 +00:00
message: `${feedback} (rev: ${commitRef})`
2023-11-13 01:54:44 +00:00
},
2024-01-25 16:32:45 +00:00
outline: 'deep',
logo: '/fmhy.ico',
2023-11-13 01:54:44 +00:00
nav: [
2024-01-25 16:32:45 +00:00
{ text: 'Beginners Guide', link: '/beginners-guide' },
{ text: 'Glossary', link: 'https://rentry.org/The-Piracy-Glossary' },
{ text: 'Guides', link: 'https://rentry.co/fmhy-guides' },
2024-01-09 17:14:05 +00:00
{
2024-01-25 16:32:45 +00:00
text: 'Backups',
2024-02-05 17:58:03 +00:00
link: 'https://github.com/fmhy/FMHY/wiki/Backups'
2024-01-09 17:14:05 +00:00
},
2024-01-25 16:32:45 +00:00
{
text: 'Ecosystem',
2024-01-25 16:32:45 +00:00
items: [
{ text: 'Posts', link: '/posts' },
{ text: 'Feedback', link: '/feedback' },
{ text: 'snowbin', link: 'https://pastes.fmhy.net' }
2024-01-25 16:32:45 +00:00
]
}
2023-11-13 01:54:44 +00:00
],
2024-01-04 08:08:55 +00:00
sidebar,
2024-01-25 16:32:45 +00:00
socialLinks
}
})