forked from withastro/docs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
astro.config.ts
122 lines (114 loc) · 3.44 KB
/
astro.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
import { defineConfig, sharpImageService } from 'astro/config';
import { makeLocalesConfig } from './config/locales';
import { makeSidebar } from './config/sidebar';
import { rehypeAutolink } from './plugins/rehype-autolink';
import { rehypeTasklistEnhancer } from './plugins/rehype-tasklist-enhancer';
import { remarkFallbackLang } from './plugins/remark-fallback-lang';
import { sitemap } from './integrations/sitemap';
import rehypeSlug from 'rehype-slug';
import remarkSmartypants from 'remark-smartypants';
import starlight from '@astrojs/starlight';
import tailwind from '@astrojs/tailwind';
import json5Plugin from 'vite-plugin-json5'
import { builtinModules } from 'module';
/* https://vercel.com/docs/projects/environment-variables/system-environment-variables#system-environment-variables */
const VERCEL_PREVIEW_SITE =
process.env.VERCEL_ENV !== 'production' &&
process.env.VERCEL_URL &&
`https://${process.env.VERCEL_URL}`;
const site = VERCEL_PREVIEW_SITE || 'https://docs.prosopo.io/';
const allExternal = [
...builtinModules,
...builtinModules.map((m) => `node:${m}`)
]
// https://astro.build/config
export default defineConfig({
site,
integrations: [
starlight({
title: 'Docs',
customCss: ['./src/styles/custom.css', './src/styles/tailwind.css'],
components: {
EditLink: './src/components/starlight/EditLink.astro',
Head: './src/components/starlight/Head.astro',
Hero: './src/components/starlight/Hero.astro',
MarkdownContent: './src/components/starlight/MarkdownContent.astro',
MobileTableOfContents: './src/components/starlight/MobileTableOfContents.astro',
TableOfContents: './src/components/starlight/TableOfContents.astro',
PageSidebar: './src/components/starlight/PageSidebar.astro',
Pagination: './src/components/starlight/Pagination.astro',
SiteTitle: './src/components/starlight/SiteTitle.astro',
Search: './src/components/starlight/Search.astro',
Sidebar: './src/components/starlight/Sidebar.astro',
PageTitle: './src/components/starlight/PageTitle.astro',
},
editLink: {
baseUrl: 'https://github.com/prosopo/docs/edit/main',
},
defaultLocale: 'en',
locales: makeLocalesConfig(),
sidebar: makeSidebar(),
social: {
github: 'https://github.com/prosopo/captcha',
discord: 'https://discord.gg/3nMYAHecZT',
},
pagefind: false,
head: [
// Add ICO favicon fallback for Safari.
{
tag: 'link',
attrs: {
rel: 'icon',
href: '/favicon.ico',
sizes: '32x32',
},
},
],
}),
tailwind({
// Disable the default base styles:
applyBaseStyles: false,
configFiles: ['./tailwind.config.mjs'],
}),
sitemap(),
],
trailingSlash: 'always',
scopedStyleStrategy: 'where',
compressHTML: false,
markdown: {
// Override with our own config
smartypants: false,
remarkPlugins: [
[remarkSmartypants, { dashes: false }],
// Add our custom plugin that marks links to fallback language pages
remarkFallbackLang(),
],
rehypePlugins: [
rehypeSlug,
// This adds links to headings
...rehypeAutolink(),
// Tweak GFM task list syntax
rehypeTasklistEnhancer(),
],
},
image: {
domains: ['avatars.githubusercontent.com'],
service: sharpImageService(),
},
experimental: {
contentCollectionCache: false,
directRenderScript: true,
},
vite: {
plugins: [json5Plugin()],
build: {
modulePreload: { polyfill: true },
rollupOptions: {
external: [
'fsevents',
...allExternal
],
}
}
}
});