-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdocusaurus.config.ts
More file actions
298 lines (281 loc) · 9.53 KB
/
Copy pathdocusaurus.config.ts
File metadata and controls
298 lines (281 loc) · 9.53 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
import type * as Preset from '@docusaurus/preset-classic';
import type { Config } from '@docusaurus/types';
import { themes as prismThemes } from 'prism-react-renderer';
import { readdirSync } from 'node:fs';
import latestVersions from "./src/plugins/latest-versions";
import remarkTokenReplacer from "./src/plugins/replace-tokens";
import redirects from "./redirects";
// Fast iteration on the redesigned recipe pages: when EXAMPLE_RECIPES_ONLY is set, exclude the entire
// recipe-catalog EXCEPT the handful of example pages we're actively developing, so a build/start only
// compiles those (plus the rest of the non-catalog docs) instead of all ~5,700 catalog pages.
const RECIPE_CATALOG = 'user-documentation/recipes/recipe-catalog';
const EXAMPLE_RECIPE_PAGES = [
`${RECIPE_CATALOG}/staticanalysis/replaceduplicatestringliterals.md`,
`${RECIPE_CATALOG}/staticanalysis/commonstaticanalysis.md`,
`${RECIPE_CATALOG}/quarkus/quarkus1to1_13migration.md`,
];
function exampleRecipesExclude(): string[] {
const keep = new Set(EXAMPLE_RECIPE_PAGES);
return readdirSync(`docs/${RECIPE_CATALOG}`, { recursive: true })
.map((f) => `${RECIPE_CATALOG}/${String(f).replace(/\\/g, '/')}`)
.filter((f) => /\.mdx?$/.test(f) && !keep.has(f));
}
const config: Config = {
title: 'Moderne Docs',
tagline: 'Large-scale automated source code refactoring',
url: 'https://docs.moderne.io',
baseUrl: '/',
organizationName: 'moderneinc',
projectName: 'moderne-docs',
// Only throw on broken links when the full site (including recipe catalog) is built.
onBrokenLinks: (process.env.CI_STRICT_LINKS && !process.env.SKIP_RECIPE_CATALOG && !process.env.EXAMPLE_RECIPES_ONLY) ? 'throw' : 'warn',
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
scripts: [
{
src: 'reo.js',
}
],
clientModules: [
require.resolve('./src/client/gtagGuard.js'),
require.resolve('./src/client/algoliaInsights.js'),
],
headTags: [
// <link rel="preconnect" href="https://fonts.googleapis.com">
{
tagName: 'link',
attributes: {
rel: 'preconnect',
href: 'https://fonts.googleapis.com',
},
},
// <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
{
tagName: 'link',
attributes: {
rel: 'preconnect',
href: 'https://fonts.gstatic.com',
crossorigin: 'anonymous',
},
},
{
tagName: 'link',
attributes: {
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css2?family=Geist:ital,wght@0,300..700;1,300..700&family=Geist+Mono:ital,wght@0,400;0,500;1,400&display=swap',
},
},
{
tagName: 'link',
attributes: {
rel: 'icon',
href: '/img/favicon.ico',
type: 'image/x-icon',
sizes: '32x32',
media: '(prefers-color-scheme: light)',
},
},
{
tagName: 'link',
attributes: {
rel: 'icon',
href: '/img/favicon_dark.ico',
type: 'image/x-icon',
sizes: '32x32',
media: '(prefers-color-scheme: dark)',
},
},
],
presets: [
[
'classic',
{
docs: {
routeBasePath: "/",
sidebarCollapsible: true,
sidebarPath: './sidebars.ts',
editUrl:
'https://github.com/moderneinc/moderne-docs/edit/main',
// Disabled on Vercel to allow manual preview deployments via `npx vercel`
// (CLI deployments don't include .git directory, breaking git-based timestamps)
showLastUpdateTime: !process.env.VERCEL,
// showLastUpdateAuthor: true,
exclude: [
'**/*.stories.tsx',
'**/*.stories.ts',
'**/*.stories.jsx',
'**/*.stories.js',
// Skip 5,700+ recipe-catalog pages for faster local rebuilds.
// Use `yarn start:fast` to enable this; `yarn start` includes everything.
...(process.env.SKIP_RECIPE_CATALOG ? ['user-documentation/recipes/recipe-catalog/**'] : []),
...(process.env.EXAMPLE_RECIPES_ONLY ? exampleRecipesExclude() : []),
],
remarkPlugins: [
[
remarkTokenReplacer,
{
replacements: latestVersions,
},
],
],
admonitions: {
keywords: ['summary'],
extendDefaults: true,
},
},
gtag: {
trackingID: "G-Q1CMC219Y5",
},
theme: {
customCss: [
'./src/css/morpheus-tokens.css',
'./src/css/custom.css',
'./src/css/morpheus-theme.css',
],
},
} satisfies Preset.Options,
],
],
markdown: {
mermaid: true,
hooks: {
// Only throw on broken markdown links when the full site (including recipe catalog) is built.
// When SKIP_RECIPE_CATALOG is set, recipe list pages will have expected broken links.
onBrokenMarkdownLinks: (process.env.CI_STRICT_LINKS && !process.env.SKIP_RECIPE_CATALOG) ? 'throw' : 'warn',
onBrokenMarkdownImages: process.env.CI_STRICT_LINKS ? 'throw' : 'warn',
}
},
themes: [
'@docusaurus/theme-mermaid',
],
plugins: [
// TRIAL (throwaway): site-wide copy/view-as-markdown button for LLMs.
[
'docusaurus-plugin-copy-page-button',
{
// We render the button ourselves (src/components/CopyPageAction via the DocBreadcrumbs /
// DocItem-Layout swizzles) rather than the plugin's auto-injection, which is unreliable on
// pages with hydration mismatches. Actions + markdownUrl are configured on the component.
// No generateMarkdownRoutes: non-catalog pages reuse docusaurus-plugin-llms' /path.md, and
// recipe pages point at their GitHub raw source.
injectButton: false,
},
],
[
'docusaurus-plugin-llms',
{
generateLLMsTxt: true,
generateLLMsFullTxt: false,
generateMarkdownFiles: true,
docsDir: 'docs',
title: 'Moderne Documentation',
description: 'Large-scale automated source code refactoring',
excludeImports: true,
removeDuplicateHeadings: true,
ignoreFiles: ['**/recipe-catalog/**'],
customLLMFiles: [
{
filename: 'llms-platform.txt',
includePatterns: ['**/moderne-platform/**/*'],
fullContent: false,
title: 'Moderne Platform Documentation',
description: 'Enterprise SaaS solution for automated code remediation',
},
{
filename: 'llms-cli.txt',
includePatterns: ['**/moderne-cli/**/*'],
fullContent: false,
title: 'Moderne CLI Documentation',
description: 'Command-line interface for running recipes locally',
},
{
filename: 'llms-dx.txt',
includePatterns: ['**/moderne-dx/**/*'],
fullContent: false,
title: 'Moderne DX Documentation',
description: 'On-premise deployment solution',
},
],
},
],
// Client-side redirects for docs that have moved. The list lives in
// ./redirects.ts — add an entry there when you move or rename a doc.
[
'@docusaurus/plugin-client-redirects',
{ redirects },
],
],
future: {
faster: {
// SSG worker threads parallelise per-page rendering; each worker
// holds a React render tree and a copy of the server bundle,
// multiplying sustained memory across pages in flight. With the
// full recipe-catalog build (~7,500 routes) on ubuntu-latest's
// 16 GB the kernel SIGTERMs the job mid-build. Locally we keep
// parallel SSG for speed; on CI we serialise to keep sustained
// memory bounded. Rspack/SWC keep their own internal parallelism
// for the bundling/minimising work either way.
ssgWorkerThreads: !process.env.CI,
swcJsLoader: true,
swcJsMinimizer: true,
swcHtmlMinimizer: true,
lightningCssMinimizer: true,
rspackBundler: true,
rspackPersistentCache: true,
mdxCrossCompilerCache: true,
},
v4: true,
},
themeConfig: {
algolia: {
appId: "MEFFK0HGO6",
apiKey: "15eb9c9f6f3147b1cf82b1b7f93cace8",
indexName: "moderne",
// Search filtering is handled by SearchFacetTabs (src/theme/SearchBar)
insights: true,
searchParameters: {
clickAnalytics: true,
},
},
announcementBar: {
id: "code_genome_project",
content: 'Recipes are moving from Maven Central to the <a href="https://codegenomeproject.org/" target="_blank" rel="noopener noreferrer">Code Genome Project</a>. <a href="/administrator-documentation/moderne-platform/how-to-guides/accessing-the-code-genome-project">Configure access</a> to keep releases resolving.',
isCloseable: true,
},
colorMode: {
respectPrefersColorScheme: true,
},
image: 'img/moderne-poster-logo.svg',
navbar: {
logo: {
alt: 'Moderne Logo Logo',
src: 'img/logo.svg',
srcDark: 'img/darkLogo.svg',
},
// Navigation handled by MegaMenu in swizzled Navbar/Layout component
},
footer: {
copyright: `© Moderne, ${new Date().getFullYear()}`,
},
prism: {
theme: prismThemes.vsDark,
darkTheme: prismThemes.vsDark,
additionalLanguages: [
"bash",
"docker",
"groovy",
"java",
"kotlin",
"yaml",
"powershell",
"csv",
],
},
sidebar: {
hideable: true,
}
} satisfies Preset.ThemeConfig,
};
export default config;