-
Notifications
You must be signed in to change notification settings - Fork 3
/
docusaurus.config.js
193 lines (184 loc) · 5.99 KB
/
docusaurus.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
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
// @ts-check
//#region Types
/**
* @typedef DocusaurusSearchLocalOptions
* @property {boolean} [indexDocs=true] Whether to index docs.
* @property {boolean} [indexBlog=true] Whether to index blog.
* @property {boolean} [indexPages=false] Whether to index pages.
* @property {string|string[]} [docsRouteBasePath='/docs'] Base route path(s) of docs. Slash at beginning is not required.
* @property {string|string[]} [blogRouteBasePath='/blog'] Base route path(s) of blog. Slash at beginning is not required.
* @property {string|string[]} [language='en'] All [lunr-languages](https://github.com/MihaiValentin/lunr-languages) supported languages.
* @property {boolean} [hashed=false] Whether to add a hashed query when fetching index (based on the content hash of all indexed `*.md` in {@link DocusaurusSearchLocalOptions.docsDir `docsDir`} and {@link DocusaurusSearchLocalOptions.blogDir `blogDir`} if applicable).
* @property {string|string[]} [docsDir='docs'] The dir(s) of docs to get the content hash, it's relative to the dir of your project.
* @property {string|string[]} [blogDir='blog'] Just like the {@link DocusaurusSearchLocalOptions.docsDir `docsDir`} but applied to blog.
* @property {boolean} [removeDefaultStopWordFilter=false] Sometimes people (E.g., us) want to keep the English stop words as indexed, since they maybe are relevant in programming docs.
* @property {boolean} [highlightSearchTermsOnTargetPage=false] Highlight search terms on target page.
* @property {number} [searchResultLimits=8] Limit the search results.
* @property {number} [searchResultContextMaxLength=50] Set the max length of characters of each search result to show.
* @property {{[key: string]: string}} [translations] Set translations of this theme.
* @property {string|RegExp|(string | RegExp)[]} [ignoreFiles] Set the match rules to ignore some files.
*/
//#endregion
const lightCodeTheme = require('prism-react-renderer/themes/vsLight');
const darkCodeTheme = require('prism-react-renderer/themes/vsDark');
const creationYear = 2016;
const dev = process.env.NODE_ENV === 'dev';
const url = dev ? process.env.DEV_URL : process.env.PROD_URL;
const {
REPO_NAME_DEV: repoDev,
BRANCH_NAME_DEV: branchDev,
REPO_NAME_PROD: repoProd,
REPO_BRANCH_PROD: branchProd,
} = process.env;
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'nyxx',
tagline: 'Documentation for the nyxx project, a Dart wrapper around the Discord API',
url,
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/icons/favicon.ico',
organizationName: 'nyxx-discord',
projectName: 'nyxx',
deploymentBranch: 'main',
plugins: [
[
'@easyops-cn/docusaurus-search-local',
/**@type {DocusaurusSearchLocalOptions} */ ({
hashed: true,
language: ['en'],
indexBlog: false,
}),
],
[
'@docusaurus/plugin-pwa',
/**@type {Partial<import('@docusaurus/plugin-pwa').PluginOptions & { id: string }>} */ ({
debug: dev,
offlineModeActivationStrategies: [
'appInstalled',
'standalone',
'queryString',
],
pwaHead: [
{
tagName: 'link',
rel: 'manifest',
href: '/manifest.json',
},
],
}),
],
],
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
editUrl: `https://github.com/${dev ? repoDev : repoProd}/tree/${
dev ? branchDev : branchProd
}/`,
showLastUpdateAuthor: true,
showLastUpdateTime: true,
},
theme: {
customCss: require.resolve('./src/css/global.css'),
},
blog: false,
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
image: 'img/Nyxx_Squared.png',
colorMode: {
defaultMode: 'dark',
},
metadata: [
{
name: 'keywords',
content: 'discord, bot, bot-framework, nyxx, dart',
},
{
name: 'language',
content: 'EN',
},
{
name: 'theme-color',
content: '#5a65f3',
},
],
navbar: {
title: 'nyxx Docs',
logo: {
alt: 'Nyxx Logo',
src: 'img/Nyxx_Squared.svg',
},
items: [
{
href: 'https://github.com/nyxx-discord/nyxx',
label: 'GitHub',
position: 'right',
},
{
type: 'localeDropdown',
position: 'right',
},
],
},
footer: {
style: 'light',
links: [
{
title: 'Docs',
items: [
{
label: 'Getting Started',
to: '/docs/intro',
},
{
label: 'API documentation',
href: 'https://pub.dev/documentation/nyxx/latest',
},
],
},
{
title: 'Community',
items: [
{
label: 'Discord',
href: 'https://discord.gg/nyxx',
},
],
},
{
title: 'More',
items: [
{
label: 'GitHub',
href: 'https://github.com/nyxx-discord/nyxx',
},
{
label: 'nyxx_commands',
href: 'https://pub.dev/packages/nyxx_commands',
},
{
label: 'nyxx_extensions',
href: 'https://pub.dev/packages/nyxx_extensions',
},
],
},
],
copyright: `Copyright © ${creationYear} - ${new Date().getFullYear()} nyxx.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ['dart'],
},
}),
};
module.exports = config;