forked from temporalio/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docusaurus.config.js
440 lines (431 loc) · 13.8 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
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
//@ts-check
const path = require("path");
const visit = require("unist-util-visit");
const FontPreloadPlugin = require("webpack-font-preload-plugin");
/** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = {
title: "Temporal Documentation",
tagline: "Build invincible applications",
url: "https://docs.temporal.io",
baseUrl: "/",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "throw",
favicon: "img/favicon.png",
organizationName: "temporalio", // Usually your GitHub org/user name.
projectName: "temporal-documentation", // Usually your repo name.
headTags: [
{
tagName: "link",
attributes: {
rel: "preload",
href: "https://iq.temporal.io",
as: "document",
},
},
],
themeConfig: {
colorMode: {
defaultMode: "light",
disableSwitch: false,
// switchConfig: {
// darkIcon: "🌙",
// darkIconStyle: {
// content: `url(/img/moon.svg)`,
// transform: "scale(2)",
// margin: "0 0.2rem",
// },
// lightIcon: "\u{1F602}",
// lightIconStyle: {
// content: `url(/img/sun.svg)`,
// transform: "scale(2)",
// },
// },
},
metadata: [{ name: "robots", content: "follow, index" }],
prism: {
theme: require("prism-react-renderer/themes/nightOwlLight"),
darkTheme: require("prism-react-renderer/themes/dracula"),
additionalLanguages: ["java", "ruby", "php"],
},
docs: {
sidebar: {
hideable: true,
autoCollapseCategories: true,
},
},
announcementBar: {
id: "replay_announcement",
content: 'Get your tickets for <a href="https://temporal.io/replay">Replay 2023</a>!',
backgroundColor: "#141414",
textColor: "#ffffff",
isCloseable: true,
},
navbar: {
hideOnScroll: false,
logo: {
alt: "Temporal logo",
src: "img/temporal-logo-dark.svg",
srcDark: "img/temporal-logo.svg",
href: "https://temporal.io",
},
items: [
{
label: "Home",
to: "/",
position: "left",
activeBasePath: "none",
},
{
label: "Temporal Cloud",
to: "/cloud",
activeBasePath: "cloud",
position: "left",
},
{
label: "KB articles",
to: "/kb",
activeBasePath: "kb",
position: "left",
},
{
label: "Docs changelog",
to: "/changelog",
activeBasePath: "changelog",
position: "left",
},
{
label: "Learn Temporal",
href: "https://learn.temporal.io",
right: "left",
},
],
},
footer: {
logo: {
alt: "Temporal logo",
src: "img/favicon.png",
href: "https://temporal.io",
width: 24,
},
copyright: `Copyright © ${new Date().getFullYear()}</span> Temporal Technologies Inc.</div><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-TSXFPF2"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>`,
links: [
{
items: [
{
label: "Github",
href: "https://github.com/temporalio/temporal",
},
{
label: "Twitter",
href: "https://twitter.com/temporalio",
},
{
label: "YouTube",
href: "https://www.youtube.com/c/Temporalio",
},
{
label: "About the docs",
href: "https://github.com/temporalio/documentation/blob/master/README.md",
},
],
},
{
items: [
{
label: "Temporal Cloud",
href: "https://temporal.io/cloud",
},
{
label: "Meetups",
href: "https://lu.ma/temporal",
},
{
label: "Workshops",
href: "https://temporal.io/community#workshops",
},
{
label: "Support forum",
href: "https://community.temporal.io/",
},
{
label: "Ask an expert",
href: "https://pages.temporal.io/ask-an-expert",
},
],
},
{
items: [
{
label: "Learn Temporal",
href: "https://learn.temporal.io",
},
{
label: "Blog",
href: "https://temporal.io/blog",
},
{
label: "Use cases",
href: "https://temporal.io/use-cases",
},
{
label: "Newsletter signup",
href: "https://pages.temporal.io/newsletter-subscribe",
},
],
},
{
items: [
{
label: "Security",
to: "/security",
},
{
label: "Privacy policy",
to: "/privacy-policy",
},
{
label: "Terms of service",
href: "https://docs.temporal.io/pdf/temporal-tos-2021-07-24.pdf",
},
{
label: "We're hiring",
href: "https://temporal.io/careers",
},
],
},
],
},
algolia: {
apiKey: "4a2fa646f476d7756a7cdc599b625bec",
indexName: "temporal",
externalUrlRegex: "temporal\\.io",
// contextualSearch: true, // Optional; if you have different version of docs etc (v1 and v2), doesn't display dup results
appId: "T5D6KNJCQS", // Optional, if you run the DocSearch crawler on your own
// algoliaOptions: {}, // Optional, if provided by Algolia
},
},
presets: [
[
"@docusaurus/preset-classic",
{
// Will be passed to @docusaurus/plugin-content-docs
docs: {
sidebarPath: require.resolve("./sidebars.js"),
routeBasePath: "/",
exclude: ["**/php/**", "**/typescript/**", "**/go/**", "**/java/**", "**/clusters/**"], // do not render context content
// editUrl: "https://github.com/temporalio/documentation/blob/master",
/**
* Whether to display the author who last updated the doc.
*/
showLastUpdateAuthor: false,
/**
* Whether to display the last date the doc was updated.
*/
showLastUpdateTime: false,
/**
* Skip the next release docs when versioning is enabled.
* This will not generate HTML files in the production build for documents
* in `/docs/next` directory, only versioned docs.
*/
// excludeNextVersionDocs: false,
includeCurrentVersion: true, // excludeNextVersionDocs is now deprecated
// // below remark plugin disabled until we can figure out why it is not transpiling to ESNext properly - swyx
// // original PR https://github.com/temporalio/documentation/pull/496/files
remarkPlugins: [
[
() =>
function addTSNoCheck(tree) {
// Disable TS type checking for any TypeScript code blocks.
// This is because imports are messy with snipsync: we don't
// have a way to pull in a separate config for every example
// snipsync pulls from.
function visitor(node) {
if (!/^ts$/.test(node.lang)) {
return;
}
node.value = "// @ts-nocheck\n" + node.value;
}
visit(tree, "code", visitor);
},
{},
],
[
require("remark-typescript-tools").transpileCodeblocks,
{
compilerSettings: {
tsconfig: path.join(__dirname, "tsconfig.json"),
externalResolutions: {},
},
fileExtensions: [".md", ".mdx"],
// remark-typescript-tools automatically running prettier with a custom config that doesn't
// line up with ours. This disables any post processing, including the default prettier step.
postProcessTs: (files) => files,
postProcessTranspiledJs: (files) => files,
},
],
[
() =>
function removeTSNoCheck(tree) {
function visitor(node) {
if (!/^ts$/.test(node.lang) && !/^js$/.test(node.lang)) {
return;
}
if (node.value.startsWith("// @ts-nocheck\n")) {
node.value = node.value.slice("// @ts-nocheck\n".length);
if (node.lang === "ts") {
node.value = dedent(node.value);
}
}
// If TS compiled output is empty, replace it with a more helpful comment
if (node.lang === "js" && node.value.trim() === "export {};") {
node.value = "// Not required in JavaScript";
} else if (node.lang === "js") {
node.value = convertIndent4ToIndent2(node.value).trim();
}
}
visit(tree, "code", visitor);
},
{},
],
],
},
// Will be passed to @docusaurus/plugin-content-blog
// options: https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog
// blog: {},
// Will be passed to @docusaurus/theme-classic.
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
// gtag: {
// trackingID: "GTM-TSXFPF2",
// // Optional fields.
// anonymizeIP: false, // Should IPs be anonymized?
// },
// Will be passed to @docusaurus/plugin-content-sitemap
sitemap: {
// Per v2.0.0-alpha.72 cacheTime is now deprecated
//cacheTime: 600 * 1000, // 600 sec - cache purge period
changefreq: "daily",
priority: 0.5,
filename: "sitemap.xml",
},
},
],
],
scripts: [
{
src: "/scripts/googletag.js",
async: true,
defer: true,
},
{
src: "/scripts/set-tab-language.js",
async: true,
defer: true,
},
],
plugins: [
function preloadFontPlugin() {
return {
name: "preload-font-plugin",
configureWebpack() {
return {
plugins: [new FontPreloadPlugin()],
};
},
};
},
[
"@docusaurus/plugin-content-blog",
{
/**
* Required for any multi-instance plugin
*/
id: "changelog",
/**
* URL route for the blog section of your site.
* *DO NOT* include a trailing slash.
*/
routeBasePath: "changelog",
/**
* Path to data on filesystem relative to site dir.
*/
blogTitle: "Temporal documentation changelog",
blogSidebarTitle: "Docs changelog",
path: "changelog",
routeBasePath: "changelog",
blogSidebarCount: "ALL",
blogDescription: "A log of changes to this site's content.",
showReadingTime: false, // Show estimated reading time for the blog post.
feedOptions: {
type: "all",
copyright: `Copyright © ${new Date().getFullYear()} Temporal Technologies Inc. All rights reserved. Copyright © 2020 Uber Technologies, Inc.`,
},
},
],
[
"@docusaurus/plugin-content-blog",
{
/**
* Required for any multi-instance plugin
*/
id: "kb",
/**
* URL route for the blog section of your site.
* *DO NOT* include a trailing slash.
*/
routeBasePath: "kb",
/**
* Path to data on filesystem relative to site dir.
*/
path: "kb",
blogTitle: "Temporal Platform knowledge base",
blogSidebarTitle: "KB articles",
blogSidebarCount: "ALL",
blogDescription: "User facing Temporal Platform knowledge base articles",
showReadingTime: false, // Show estimated reading time for the blog post.
feedOptions: {
type: "all",
copyright: `Copyright © ${new Date().getFullYear()} Temporal Technologies Inc. All rights reserved. Copyright © 2020 Uber Technologies, Inc.`,
},
},
],
],
};
function convertIndent4ToIndent2(code) {
// TypeScript always outputs 4 space indent. This is a workaround.
// See https://github.com/microsoft/TypeScript/issues/4042
return code.replace(/^( {4})+/gm, (match) => {
return " ".repeat(match.length / 4);
});
}
// Remove the minimum leading whitespace on each line, excluding whitespace-only
// lines. Helpful for cleaning up TypeScript examples that are pulled from
// the body of a function.
function dedent(code) {
const lines = code.split("\n");
if (!lines.length) {
return code;
}
// First, find the minimum number of leading space characters, excluding
// lines that are whitespace-only.
let minIndent = Number.POSITIVE_INFINITY;
for (const line of lines) {
if (line.trim().length === 0) {
continue;
}
const match = line.match(/^( +)/);
if (match && match[0].length < minIndent) {
minIndent = match[0].length;
} else if (!match) {
minIndent = 0;
}
}
// If there's no leading whitespace, just return the code
if (minIndent === 0 || minIndent === Number.POSITIVE_INFINITY) {
return code;
}
// Otherwise, remove leading spaces from each line
return lines.map((line) => line.replace(new RegExp(`^ {${minIndent}}`), "")).join("\n");
}