Repository navigation
Expand file tree
/
Copy pathdocusaurus.config.js
More file actions
360 lines (346 loc) · 12.8 KB
/
Copy pathdocusaurus.config.js
File metadata and controls
360 lines (346 loc) · 12.8 KB
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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const path = require('path');
const { themes } = require("prism-react-renderer");
const lightCodeTheme = themes.github;
const darkCodeTheme = themes.dracula;
// External docs config - shared with import script (external-docs.json)
const externalDocs = require('./external-docs.json');
const gaMeasurementId = require('./scripts/ga-measurement-id.js');
// Custom plugin: prevent docs/project-quiver/ files from being processed by the
// main docs preset's MDX webpack loader (they are handled by the quiver plugin instance).
function excludeProjectQuiverFromMainDocsLoader() {
const projectQuiverPath = path.resolve(__dirname, 'docs', 'project-quiver');
const docsPath = path.resolve(__dirname, 'docs') + path.sep;
return {
name: 'exclude-project-quiver-from-main-mdx-loader',
configureWebpack(config) {
for (const rule of (config.module?.rules ?? [])) {
if (!rule || typeof rule !== 'object' || !Array.isArray(rule.include)) continue;
// Identify the main docs MDX rule: includes 'docs/' but not 'project-quiver'
if (rule.include.some(d => d === docsPath) &&
!rule.include.some(d => typeof d === 'string' && d.includes('project-quiver'))) {
rule.exclude = (Array.isArray(rule.exclude)
? rule.exclude
: rule.exclude ? [rule.exclude] : []
).concat(projectQuiverPath);
break;
}
}
return {};
},
};
}
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "Arrow",
tagline: "Bringing Private Air Travel to Everyone",
url: "https://arrowair.com",
baseUrl: "/",
onBrokenLinks: "warn",
// Cookie banner + Google Analytics (production builds only); GA loads
// after the visitor allows it. The static pages get the same script from
// scripts/build-html.js.
scripts: gaMeasurementId
? [{ src: "/js/cookie-consent.js", defer: true, "data-ga-id": gaMeasurementId }]
: [],
favicon: "img/favicons/favicon.ico",
organizationName: "Arrow", // Usually your GitHub org/user name.
projectName: "arrow", // Usually your repo name.
headTags: [
// Parsed before the render-blocking stylesheet, so the browser paints a
// scheme-matched canvas (not white) while CSS is still loading — prevents
// a white flash when navigating here from the dark homepage.
{tagName: 'meta', attributes: {name: 'color-scheme', content: 'dark light'}},
{tagName: 'link', attributes: {rel: 'icon', type: 'image/png', sizes: '32x32', href: '/img/favicons/favicon-32x32.png'}},
{tagName: 'link', attributes: {rel: 'icon', type: 'image/png', sizes: '16x16', href: '/img/favicons/favicon-16x16.png'}},
{tagName: 'link', attributes: {rel: 'apple-touch-icon', sizes: '180x180', href: '/img/favicons/apple-touch-icon.png'}},
{tagName: 'link', attributes: {rel: 'manifest', href: '/img/favicons/site.webmanifest'}},
],
markdown: {
format: 'detect',
mdx1Compat: {
comments: true,
admonitions: true,
headingIds: true,
},
},
themes: [
[
require.resolve("@easyops-cn/docusaurus-search-local"),
{
indexDocs: true,
indexBlog: true,
blogDir: "blog/",
docsDir: ["docs", "docs-quiver", "docs-spearhead", "docs-caribou", "docs-bounty"],
language: "en",
searchResultLimits: 8,
highlightSearchTermsOnTargetPage: true,
explicitSearchResultPath: true,
hashed: true,
},
],
],
clientModules: [
require.resolve('./src/js/imageCollapse.js'),
require.resolve('./src/js/sidebarScrollPosition.js'),
require.resolve('./src/js/routeClasses.js'),
require.resolve('./src/js/sidebarPoweredBy.js'),
require.resolve('./src/js/themeTransition.js'),
],
plugins: [
require.resolve('docusaurus-plugin-image-zoom'),
// Old URLs of pages that were merged into others, so existing links
// keep working. Client-side redirects only run in production builds.
['@docusaurus/plugin-client-redirects', {
redirects: [
{ from: '/docs/reference/discord', to: '/docs/community/discord-guide' },
{ from: '/docs/reference/github', to: '/docs/guides/github-guide' },
{ from: '/docs/reference/dao-forum', to: '/docs/community/forum' },
{ from: '/docs/governance/core/legal', to: '/docs/governance/legal-structure' },
{ from: '/docs/governance/good-to-know/submit-proposal', to: '/docs/governance/aips/submit-an-aip' },
{ from: '/docs/governance/good-to-know', to: '/docs/governance' },
{ from: '/docs/governance/core', to: '/docs/governance' },
// Old project README links from before the Quiver docs had their own
// section. These pages became category pages, so map them by hand.
{ from: '/docs/quiver/pt3-assembly-guides', to: '/quiver/category/manufacturing' },
{ from: '/docs/quiver/Engineering-Reports', to: '/quiver/category/reference--engineering-reports' },
],
// The project docs live at /quiver, /spearhead, /caribou and /bounty,
// but people (and old links) reach for /docs/<project>. Give every page
// in those sections a /docs alias that forwards to it.
createRedirects(existingPath) {
const sections = ['/quiver', '/spearhead', '/caribou', '/bounty'];
if (sections.some((s) => existingPath === s || existingPath.startsWith(`${s}/`))) {
return `/docs${existingPath}`;
}
return undefined;
},
}],
excludeProjectQuiverFromMainDocsLoader,
require.resolve('./plugins/dev-homepage'),
['@docusaurus/plugin-content-docs', {
id: 'quiver',
path: 'docs/project-quiver',
routeBasePath: 'quiver',
sidebarPath: require.resolve('./sidebars-quiver.js'),
exclude: ['**/Archive/**'],
// Upstream repo holds files under docs/<docPath>, not docs/project-quiver/<docPath>.
editUrl: (/** @type {{docPath: string}} */ { docPath }) =>
`https://github.com/Arrow-air/project-quiver/edit/main/docs/${docPath}`,
showLastUpdateTime: true,
}],
['@docusaurus/plugin-content-docs', {
id: 'spearhead',
path: 'docs-spearhead',
routeBasePath: 'spearhead',
sidebarPath: require.resolve('./sidebars-spearhead.js'),
// Content is imported from the project-spearhead repo at build time
// (see external-docs.json), so edits belong upstream.
editUrl: (/** @type {{docPath: string}} */ { docPath }) =>
`https://github.com/Arrow-air/project-spearhead/edit/main/docs/${docPath}`,
showLastUpdateTime: true,
}],
['@docusaurus/plugin-content-docs', {
id: 'caribou',
path: 'docs-caribou',
routeBasePath: 'caribou',
sidebarPath: require.resolve('./sidebars-caribou.js'),
// Content is imported from the project-caribou repo at build time
// (see external-docs.json), so edits belong upstream.
editUrl: (/** @type {{docPath: string}} */ { docPath }) =>
`https://github.com/Arrow-air/project-caribou/edit/main/docs/${docPath}`,
showLastUpdateTime: true,
}],
['@docusaurus/plugin-content-docs', {
id: 'bounty',
path: 'docs-bounty',
routeBasePath: 'bounty',
sidebarPath: require.resolve('./sidebars-bounty.js'),
editUrl: (/** @type {{docPath: string}} */ { docPath }) =>
`https://github.com/Arrow-air/website/edit/staging/docs-bounty/${docPath}`,
showLastUpdateTime: true,
}],
],
stylesheets: [
{ href: "https://fonts.googleapis.com", rel: "preconnect" },
{ href: "https://fonts.gstatic.com", rel: "preconnect" },
],
presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve("./sidebars.js"),
exclude: ['**/project-quiver/**'], // served by the separate quiver plugin instance
showLastUpdateTime: true,
editUrl: (/** @type {{docPath: string}} */ { docPath }) => {
// Check if this doc is from an external repo
for (const [folder, config] of Object.entries(externalDocs)) {
if (docPath.startsWith(`${folder}/`)) {
const relativePath = docPath.replace(`${folder}/`, '');
return `https://github.com/${config.repo}/edit/${config.branch}/${config.docsPath}/${relativePath}`;
}
}
// Default to website repo
return `https://github.com/Arrow-air/website/edit/staging/docs/${docPath}`;
},
},
blog: {
showReadingTime: true,
editUrl: "https://github.com/Arrow-air/website/edit/staging/",
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
}),
],
// Redocusaurus config (commented out - rest-develop.json is empty)
// [
// 'redocusaurus',
// {
// // Plugin Options for loading OpenAPI files
// specs: [
// {
// id: "rest-develop",
// spec: "rest-develop.json",
// route: "api/rest/develop"
// },
// ],
// // Theme Options for modifying how redoc renders them
// theme: {
// // Change with your site colors
// primaryColor: '#1890ff',
// },
// },
// ],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
// Default social preview for docs pages without their own image.
image: 'img/og/arrow-social-preview.png',
zoom: {
selector: '.theme-doc-markdown p:not(td p) > img, .theme-doc-markdown figure > img',
background: {
light: 'rgba(255, 255, 255, 0.96)',
dark: 'rgba(17, 24, 39, 0.96)',
},
// medium-zoom's `config` object is passed straight through by
// docusaurus-plugin-image-zoom to mediumZoom(selector, config).
// `margin: 48` insets the zoomed image 48px from each viewport edge.
// Do NOT add `container` here — passing a tall scrolling container
// (e.g. [class^="docMainContainer"]) makes medium-zoom translate to
// the article's geometric center, which is far below the viewport,
// so the image animates downward instead of zooming in place.
config: {
margin: 48,
},
},
colorMode: {
defaultMode: 'light',
disableSwitch: false,
respectPrefersColorScheme: true,
},
docs: {
sidebar: {
hideable: false
}
},
navbar: {
logo: {
alt: "Arrow Logo",
src: "img/brand/wordmark_gray.svg",
href: "pathname:///",
},
items: [
{
type: "search",
position: "right",
},
{
href: "https://github.com/Arrow-air",
position: "right",
className: "navbar-icon navbar-icon--github",
"aria-label": "GitHub",
},
{
href: "https://discord.com/invite/arrow",
position: "right",
className: "navbar-icon navbar-icon--discord",
"aria-label": "Discord",
},
],
},
footer: {
style: "light",
logo: {
alt: "Arrow Logo",
src: "img/brand/wordmark_gray.svg",
},
copyright:
'Built with <img src="/img/brand/arrow-icon_love.svg" style="height:1rem" alt="love"/> by the Arrow Community',
links: [
{
title: "Community",
items: [
{
label: "Discord",
href: "https://discord.com/invite/fab4bxaAW9",
},
{
label: "Twitter",
href: "https://twitter.com/ArrowAir_",
},
],
},
{
title: "Links",
items: [
{
label: "Intro",
to: "/docs",
},
{
label: "Blog",
to: "/blog",
},
{
label: "GitHub",
href: "https://github.com/Arrow-air",
},
],
},
],
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ['rust', 'toml']
},
languageTabs: [
{
highlight: "bash",
language: "curl",
logoClass: "bash",
},
{
highlight: "python",
language: "python",
logoClass: "python",
},
{
highlight: "go",
language: "go",
logoClass: "go",
},
{
highlight: "javascript",
language: "nodejs",
logoClass: "nodejs",
},
]
}),
};
module.exports = config;