-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathdocusaurus.config.js
More file actions
547 lines (536 loc) · 17.6 KB
/
docusaurus.config.js
File metadata and controls
547 lines (536 loc) · 17.6 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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
require("dotenv").config();
const themes = require("prism-react-renderer").themes;
const lightCodeTheme = themes.oceanicNext;
const darkCodeTheme = themes.dracula;
const redirects = require("./redirects");
const ArchivedVersions = require("./archiveVersions.json");
const { pluginPacksAndIntegrationsData } = require("./plugins/packs-integrations");
const { pluginImportFontAwesomeIcons } = require("./plugins/font-awesome");
import path from "path";
// Logo paths are hardcoded or we use the default logos.
function getLightLogoPath() {
if (process.env.CUSTOM_LIGHT_LOGO && process.env.CUSTOM_LIGHT_LOGO.trim() === "true") {
return "img/custom-light-logo.svg";
}
return "img/spectrocloud-logo-light.svg?new=true";
}
// Logo paths are hardcoded through Docker mounts or we use the default logos.
function getDarkLogoPath() {
if (process.env.CUSTOM_DARK_LOGO && process.env.CUSTOM_DARK_LOGO.trim() === "true") {
return "img/custom-dark-logo.svg";
}
return "img/spectrocloud-logo-dark.svg?new=true";
}
// We will only show the update time if the environment variable is set to true.
function showLastUpdateTime() {
const envValue = process.env.SHOW_LAST_UPDATE_TIME || "";
const trimmedValue = envValue.trim().toLowerCase();
if (trimmedValue === "true") {
return true;
}
return false;
}
// The list of all scripts to be loaded on the site.
const allScripts = [
{
src: `https://w.appzi.io/w.js?token=${process.env.APPZI_TOKEN}`,
defer: true,
},
{
src: "/scripts/kapa-shortcut.js",
async: false,
},
{
src: "https://widget.kapa.ai/kapa-widget.bundle.js",
"data-website-id": "9c212df9-d1fc-4f65-9c93-8bcd9c8ec6ca",
"data-project-name": "Spectro Cloud Docs AI",
"data-project-color": "#3A9D99",
"data-consent-required": "true",
"data-consent-screen-title": "Privacy Notice",
"data-consent-screen-disclaimer":
"Thank you for using our chat service! Information you submit through this chat is subject to our [Privacy Policy and Terms of Use](https://www.spectrocloud.com/privacy-policy) and will be processed by our service provider. Please do not enter sensitive information. Chat transcripts may be kept for future reference.",
"data-modal-example-questions":
"How do I get started with Palette?, What types of infrastructure can I deploy my cluster on?,What third-party packs integrate with a Palette cluster?",
"data-example-question-button-width": "565px",
"data-example-question-button-box-shadow": "1px",
"data-consent-screen-accept-button-text": "Accept",
"data-consent-screen-reject-button-text": "Decline",
"data-project-logo": "/img/spectrocloud-mark-light-bkgd-RGB.svg",
"data-modal-title": "Spectro Cloud - Ask Docs",
"data-modal-disclaimer":
"This AI bot provides responses based solely on your input and the latest available version of Spectro Cloud’s public documentation. Its output is for informational purposes only and should not be considered official guidance. Please do not share any personally identifiable information (PII) or sensitive data. By using this service, you agree to our [Privacy Policy](https://www.spectrocloud.com/privacy-policy). \n\n Note that the bot does not have access to past versions of the documentation and cannot answer version-specific questions. \n\n If you are not sure where to start, click on one of the example questions below.",
"data-modal-x-offset": "0",
"data-modal-y-offset": "0",
"data-modal-with-overlay": "false",
"data-modal-inner-flex-direction": "column",
"data-modal-inner-justify-content": "end",
"data-modal-inner-max-width": "600px",
"data-modal-inner-position-right": "20px",
"data-modal-inner-position-bottom": "calc(2.5rem + 25px)",
"data-button-height": "5rem",
"data-button-width": "5rem",
"data-button-text": "Ask AI",
"data-conversation-button-icons-only": "true",
"data-modal-size": "100%",
"data-modal-full-screen-on-mobile": "false",
"data-modal-lock-scroll": "false",
"data-modal-inner-position-left": "auto",
"data-mcp-enabled": "true",
"data-mcp-server-url": "https://spectro-cloud.mcp.kapa.ai",
async: true,
},
{
src: "/scripts/fullstory.js",
type: "text/javascript",
},
{
type: "text/javascript",
src: "/scripts/googleTagManager.js",
dataLayer: "GTM-T2F9ZMS",
},
{
src: "https://cdn.seersco.com/banners/55793/23380/cb.js",
id: "seers-cmp",
async: "true",
"data-key": process.env.SEERS_CMP_KEY,
"data-name": "CookieXray",
type: "text/javascript",
},
];
// Load only Kapa and Seers for local development.
const localScripts = [allScripts[1], allScripts[2], allScripts[5]];
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "Palette",
tagline: "Palette",
favicon: "img/favicon.png",
url: "https://docs.spectrocloud.com",
baseUrl: "/",
organizationName: "Spectro Cloud",
// Usually your GitHub org/user name.
projectName: "Spectro Cloud docs",
// Usually your repo name.
onBrokenLinks: "throw",
onBrokenAnchors: "throw",
markdown: {
hooks: {
onBrokenMarkdownLinks: "throw",
},
},
trailingSlash: true,
// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: "en",
locales: ["en"],
},
future: {
v4: {
removeLegacyPostBuildHeadAttribute: true,
useCssCascadeLayers: true, // Slightly decreases padding of admonitions when set to `true`.
},
experimental_faster: {
ssgWorkerThreads: false, // Set to 'false' as Netlify builds fail with this enabled.
swcJsLoader: false, // Set to 'false' as Netlify builds fail with this enabled.
swcJsMinimizer: true,
swcHtmlMinimizer: true,
lightningCssMinimizer: true,
rspackBundler: true,
rspackPersistentCache: true,
mdxCrossCompilerCache: true,
},
},
customFields: {
// Used to access the environment variable in the build process during the client-side step
DISABLE_PACKS_INTEGRATIONS: process.env.DISABLE_PACKS_INTEGRATIONS,
},
staticDirectories: ["static", "static/assets/docs/images", "static/assets", "static/img/"],
headTags: [
{
tagName: "link",
attributes: {
rel: "preconnect",
href: "https://cdn.seersco.com",
},
},
{
tagName: "link",
attributes: {
rel: "preconnect",
href: "https://cdn-auth.seersco.com",
},
},
{
tagName: "link",
attributes: {
rel: "preload",
href: "https://cdn.seersco.com/banners/55793/23380/cb.js",
as: "script",
},
},
],
stylesheets: [],
presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
{
docs: {
path: "docs/docs-content",
showLastUpdateAuthor: false,
showLastUpdateTime: showLastUpdateTime(),
routeBasePath: "/",
lastVersion: "current",
includeCurrentVersion: true,
versions: {
current: {
label: "latest",
banner: process.env.UNRELEASED_VERSION_BANNER == "true" ? "unreleased" : "none",
},
},
admonitions: {
keywords: ["preview", "further"],
extendDefaults: true,
},
// exclude: ["api/v1/palette-apis-3-4"],
sidebarPath: require.resolve("./sidebars.js"),
async sidebarItemsGenerator({ defaultSidebarItemsGenerator, ...args }) {
const { docs } = args;
const filteredDocs = docs.filter((doc) => {
return true;
});
const sidebarItems = await defaultSidebarItemsGenerator({
...args,
docs: filteredDocs,
});
return sidebarItems;
},
editUrl: "https://github.com/spectrocloud/librarium/blob/master",
},
sitemap: {
changefreq: "daily",
priority: 0.5,
ignorePatterns: ["/tags/**"],
filename: "sitemap.xml",
},
theme: {
customCss: require.resolve("./src/css/custom.scss"),
},
},
],
],
plugins: [
"docusaurus-plugin-sass",
[
"@docusaurus/plugin-content-docs",
{
id: "api",
path: "docs/api-content/api-docs",
routeBasePath: "api",
docItemComponent: "@theme/ApiItem",
lastVersion: "current",
includeCurrentVersion: true,
admonitions: {
keywords: ["preview", "further"],
extendDefaults: true,
},
versions: {
current: {
label: "latest",
},
},
sidebarPath: require.resolve("./apisidebar.js"),
},
],
[
"docusaurus-plugin-openapi-docs",
{
// Visit https://docusaurus-openapi.tryingpan.dev/#config to learn more about this plugin's config options.
id: "apidocs",
docsPluginId: "api",
config: {
palette: {
specPath: "static/apis/v1/api.json",
outputDir: "docs/api-content/api-docs/v1",
downloadUrl: "/apis/v1/palette-apis.json",
sidebarOptions: {
groupPathsBy: "tag",
categoryLinkSource: "tag",
},
template: "api.mustache",
// Customize API MDX with mustache template
hideSendButton: true,
},
emc: {
specPath: "static/apis/edge-v1/emc-api.json",
outputDir: "docs/api-content/api-docs/edge-v1",
downloadUrl: "/apis/edge-v1/emc-api.json",
sidebarOptions: {
groupPathsBy: "tag",
categoryLinkSource: "tag",
},
template: "api.mustache",
// Customize API MDX with mustache template
hideSendButton: true,
},
},
},
],
process.env.NODE_ENV !== "production" && [
() => ({
name: "plugin-enable-source-map",
configureWebpack() {
return {
devtool: "source-map",
};
},
}),
{
id: "enable-source-map",
},
],
[
pluginPacksAndIntegrationsData,
{
repositories: ["Palette Registry", "Public Repo", "Spectro Addon Repo", "Palette Community Registry"],
},
],
pluginImportFontAwesomeIcons,
function () {
return {
name: "plugin-watch-custom-plugin-path",
getPathsToWatch() {
return ["plugins/font-awesome.js", "plugins/packs-integrations.js"];
},
};
},
[
"@docusaurus/plugin-ideal-image",
{
quality: 50,
max: 1035,
steps: 4,
disableInDev: false,
},
],
[
require.resolve("docusaurus-plugin-image-zoom"),
{
id: "docusaurus-plugin-image-zoom",
},
],
[
"@docusaurus/plugin-client-redirects",
{
redirects: [...redirects],
},
],
].filter(Boolean),
scripts: process.env.NODE_ENV === "production" ? allScripts : localScripts,
themes: ["docusaurus-theme-openapi-docs"],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
{
// announcementBar: {
// id: "docs_announcement_bar",
// content:
// REPLACE MESSAGE BELOW
// 'The 2024 State of Production Kubernetes report is now available and it\'s full of insights and goodies. Click <a target="_blank" rel="noopener noreferrer" href="https://www.spectrocloud.com/news/2024-state-of-production-kubernetes">here to get your own copy.</a>',
// backgroundColor: "#FBB117",
// textColor: "#091E42",
// isCloseable: false,
// },
colorMode: {
respectPrefersColorScheme: true,
},
docs: {
sidebar: {
hideable: false,
autoCollapseCategories: true,
},
},
tableOfContents: {
minHeadingLevel: 2,
maxHeadingLevel: 3,
},
// Replace with your project's social card
image: "img/spectrocloud-social-card.png",
navbar: {
title: "",
logo: {
href: "/",
width: 105,
height: 48,
alt: "Spectro cloud logo",
src: getLightLogoPath(),
srcDark: getDarkLogoPath(),
},
items: [
{
to: "/tutorials",
type: "docSidebar",
sidebarId: "tutorialSidebar",
label: "Tutorials",
position: "left",
activeBaseRegex: "^(?!/api/).*$",
},
{
to: "/downloads",
type: "docSidebar",
sidebarId: "downloadsSidebar",
label: "Downloads",
position: "left",
activeBaseRegex: "^(?!/api/).*$",
},
{
to: "/api/introduction",
label: "API",
position: "left",
},
{
type: "html",
position: "right",
value:
'<a href="https://spectrocloud.com" target="_blank" rel="noopener noreferrer" aria-label="Go to Spectro Cloud homepage (opens in a new tab)">spectrocloud.com <span aria-hidden="true">↗</span></a>',
},
{
href: "https://github.com/spectrocloud/librarium",
position: "right",
className: "header-github-link",
"aria-label": "GitHub repository",
},
{
type: "html",
position: "right",
value: `
<button
class="navbar-ai-button"
type="button"
onclick="window.Kapa && window.Kapa.open({ mode: 'ai', submit: true })"
>
Ask AI
</button>`,
},
{
type: "docsVersionDropdown",
position: "left",
docsPluginId: "default",
dropdownItemsAfter: [
...Object.entries(ArchivedVersions).map(([versionName, versionUrl]) => ({
href: versionUrl,
label: versionName,
})),
],
},
{
type: "docsVersionDropdown",
position: "left",
docsPluginId: "api",
dropdownItemsAfter: [
...Object.entries(ArchivedVersions).map(([versionName, versionUrl]) => ({
href: versionUrl,
label: versionName,
})),
],
},
],
hideOnScroll: true,
},
languageTabs: [
{
highlight: "bash",
language: "curl",
logoClass: "curl",
},
{
highlight: "python",
language: "python",
logoClass: "python",
variant: "requests",
},
{
highlight: "go",
language: "go",
logoClass: "go",
},
{
highlight: "javascript",
language: "nodejs",
logoClass: "nodejs",
variant: "axios",
},
{
highlight: "java",
language: "java",
logoClass: "java",
variant: "unirest",
},
],
algolia: {
// The application ID provided by Algolia
appId: process.env.ALGOLIA_APP_ID,
// Public API key: it is safe to commit it
apiKey: process.env.ALGOLIA_SEARCH_KEY,
indexName: process.env.ALGOLIA_INDEX_NAME,
// Optional: see doc section below
contextualSearch: true,
// Optional: Specify domains where the navigation should occur through window.location instead on history.push. Useful when our Algolia config crawls multiple documentation sites and we want to navigate with window.location.href to them.
externalUrlRegex: "external\\.com|domain\\.com",
// Optional: Replace parts of the item URLs from Algolia. Useful when using the same search index for multiple deployments using a different baseUrl. You can use regexp or string in the `from` param. For example: localhost:3000 vs myCompany.com/docs
replaceSearchResultPathname: {
from: "/docs/",
// or as RegExp: /\/docs\//
to: "/",
},
// Optional: Algolia search parameters
searchParameters: {},
// Optional: path for search page that enabled by default (`false` to disable it)
searchPagePath: "search",
maxResultsPerGroup: 7,
},
sidebar: {
hideable: true,
},
prism: {
defaultLanguage: "json",
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ["hcl", "bash", "json", "powershell", "go", "javascript", "rust"],
magicComments: [
{
className: "theme-code-block-highlighted-line",
line: "highlight-next-line",
block: {
start: "highlight-start",
end: "highlight-end",
},
},
{
className: "code-block-error-line",
line: "This will error",
},
],
},
zoom: {
selector: ".markdown-image",
background: {
light: "rgb(255, 255, 255)",
dark: "rgb(50, 50, 50)",
},
config: {},
},
},
};
module.exports = config;
export default function (context, options) {
return {
name: "@docusaurus/plugin-content-docs",
getPathsToWatch() {
const contentPath = path.resolve(context.siteDir, options.path);
return [`${contentPath}/_partials/*/*.{mdx}`];
},
};
}