-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
docusaurus.config.js
330 lines (311 loc) · 9.59 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
// @ts-check
const lightCodeTheme = require('prism-react-renderer').themes.vsDark;
const darkCodeTheme = require('prism-react-renderer').themes.nightOwl;
const fs = require('fs');
const path = require('path');
// Redirects handling:
const { getStaticRedirects } = require('./plugins/staticRedirects');
const { redirectsPlugin } = require('./plugins/dynamicRedirects');
// Define the directory containing your CSS files
const cssDirectory = path.resolve(__dirname, './src/css');
// Read all CSS files from the directory
const customCssFiles = fs.readdirSync(cssDirectory)
.filter(file => file.endsWith('.css'))
.map(file => require.resolve(path.join(cssDirectory, file)));
//https://github.com/saucelabs/elemental-next/blob/b1a325631243a13a4f3beee58a295b7b36f6574d/frontend/docusaurus.config.js#L105
function metadataPlugin(context, options) {
return {
name: 'metadata',
async allContentLoaded({actions, allContent}) {
const {setGlobalData} = actions;
let docs = []
allContent['docusaurus-plugin-content-docs']
.default
.loadedVersions[0]
.docs
.filter(doc => doc.id !== undefined)
.map((doc) => docs.push(doc));
//console.log(JSON.stringify(allContent['docusaurus-plugin-content-docs'], 2, 2, null));
//console.log(tempFrontMatter);
setGlobalData({aggregateMetadata: docs});
}
}
}
async function createConfig() {
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'The Cloud Posse Reference Architecture',
tagline: 'The turnkey architecture for AWS, Datadog & GitHub Actions to get up and running quickly using the Atmos open source framework.',
url: 'https://docs.cloudposse.com',
baseUrl: '/',
trailingSlash: true,
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
onDuplicateRoutes: 'warn',
favicon: 'img/favicon.png',
organizationName: 'cloudposse',
projectName: 'docs',
deploymentBranch: 'master',
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
plugins: [
[
'@docusaurus/plugin-google-tag-manager',
{
containerId: process.env.GOOGLE_TAG_MANAGER || 'GTM-ABCD123'
},
],
[
'docusaurus-plugin-image-zoom', {},
],
[
'@docusaurus/plugin-ideal-image',
{
quality: 90,
max: 1030, // max resized image's size.
min: 640, // min resized image's size. if original is lower, use that size.
steps: 2, // the max number of images generated between min and max (inclusive)
disableInDev: false,
}
],
path.resolve(__dirname, 'plugins/custom-loaders'),
metadataPlugin,
[
"posthog-docusaurus",
{
apiKey: "phc_G3idXOACKt4vIzgRu2FVP8ORO1D2VlkeEwX9mE2jDvT",
appUrl: "https://us.i.posthog.com",
enableInDevelopment: false, // optional
},
],
[
'docusaurus-plugin-sentry',
{
DSN: '[email protected]/4507472203087872',
},
],
[
'@docusaurus/plugin-client-redirects',
{
id: 'static-redirects',
redirects: getStaticRedirects(),
},
],
redirectsPlugin,
],
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
routeBasePath: '/',
sidebarPath: require.resolve('./sidebars.js'),
editUrl: ({versionDocsDirPath, docPath, locale}) => {
return `https://github.com/cloudposse/docs/edit/master/content/docs/${docPath}`;
},
exclude: ['README.md'],
showLastUpdateTime: true,
showLastUpdateAuthor: true,
onInlineTags: 'warn',
tags: 'tags.yml'
},
theme: {
customCss: customCssFiles,
},
}),
],
],
scripts: [
{
src: "https://kit.fontawesome.com/3a9f2eb5b9.js",
},
],
markdown: {
mermaid: true,
},
themes: ['@docusaurus/theme-mermaid'],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
metadata: [{ name: 'google-site-verification', content: process.env.GOOGLE_SITE_VERIFICATION_ID || 'preview-local' }],
docs: {
sidebar: {
hideable: true,
autoCollapseCategories: true
},
},
navbar: {
title: '',
logo: {
alt: 'Cloud Posse Developer Hub',
src: 'img/logo.svg',
srcDark: 'img/logo-light.svg',
},
items: [
{
to: '/learn',
position: 'left',
label: 'Learn',
},
{
to: '/reference',
position: 'left',
label: 'Reference',
},
{
to: '/community',
label: 'Community',
position: 'left',
},
{
type: 'search',
position: 'right',
},
{
href: 'https://github.com/cloudposse/',
className: 'header-github-link',
position: 'right',
},
{
to: 'https://cloudposse.com/',
label: 'Get a Jumpstart',
position: 'right',
className: 'button button--primary navbar-cta-button'
},
],
},
announcementBar: {
id: 'new_docs',
content:
'We are in the process of updating our documentation. <a href="mailto:[email protected]">Please let us know what you think!</a>',
backgroundColor: 'var(--announcement-bar-background)',
textColor: 'var(--announcement-bar-text-color)',
isCloseable: true,
},
colorMode: {
// "light" | "dark"
defaultMode: 'dark',
// Hides the switch in the navbar
// Useful if you want to force a specific mode
disableSwitch: false,
// Should respect the user's color scheme preference
// "light" | "dark" | "system"
respectPrefersColorScheme: false,
},
algolia: {
appId: process.env.ALGOLIA_APP_ID || '32YOERUX83',
apiKey: process.env.ALGOLIA_SEARCH_API_KEY || '557985309adf0e4df9dcf3cb29c61928', // this is SEARCH ONLY API key and is not sensitive information
indexName: process.env.ALGOLIA_INDEX_NAME || 'docs.cloudposse.com',
externalUrlRegex: 'atmos\\.tools',
contextualSearch: false
},
footer: {
style: 'dark',
links: [{
title: 'Docs',
items: [
{
label: 'Learn',
to: '/learn/',
},
{
label: 'Reference',
to: '/reference/',
}
],
}, {
title: 'Community',
items: [
{
label: 'GitHub Discussions',
href: 'https://github.com/orgs/cloudposse/discussions',
},
{
label: 'Slack Community',
to: '/community/slack',
},
{
label: 'Slack Archives',
href: 'https://archive.sweetops.com/refarch/',
},
{
label: 'Office Hours',
to: '/community/office-hours/',
},
],
}, {
title: 'Contact Us',
items: [
{
label: 'Support',
to: '/support',
},
{
label: 'Our GitHub',
href: 'https://github.com/cloudposse/',
},
{
label: 'Contact Us',
to: '/community/contact-us/',
}],
}],
logo: {
alt: 'Cloud Posse',
src: '/img/logo-light.svg',
href: 'https://cloudposse.com/'
},
copyright: `© ${new Date().getFullYear()} Cloud Posse, LLC`,
},
mermaid: {
theme: {
light: 'neutral',
dark: 'dark',
},
options: {
flowchart: {
useMaxWidth: true,
curve: 'linear',
padding: 15,
diagramPadding: 20,
nodeSpacing: 40,
rankSpacing: 50,
ranksep: 100,
nodesep: 100,
titleTopMargin: 25,
titlePadding: 30,
labelPadding: 30,
subGraphTitleMargin: {
top: 5,
bottom: 5
}
},
themeVariables: {
mainBkg: '#6f72723b',
background: '#333',
clusterBkg: '#6f72723b'
}
}
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ['hcl', 'bash', 'rego'],
},
zoom: {
selector: '.markdown > img',
config: {
// options you can specify via https://github.com/francoischalifour/medium-zoom#usage
background: {
light: 'rgb(255, 255, 255)',
dark: 'rgb(50, 50, 50)'
}
}
}
}),
};
return config;
}
module.exports = createConfig();