-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docusaurus.config.ts
428 lines (386 loc) · 12.3 KB
/
docusaurus.config.ts
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
// DO NOT EDIT!
// Automatically generated from docusaurus-template-liquid/templates/docusaurus.
import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
// import logger from '@docusaurus/logger';
import util from 'node:util';
import {customDocsNavbarItem} from './navbar-docs-items'
import {redirects} from './docusaurus-config-redirects'
// The node.js modules cannot be used in modules imported in browser code:
// webpack < 5 used to include polyfills for node.js core modules by default.
// so the entire initialisation code must be in this file, that is
// not processed by webpack.
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import fs from 'node:fs';
// ----------------------------------------------------------------------------
function getCustomFields() {
const pwd = fileURLToPath(import.meta.url);
// console.log(pwd);
// First get the version from the top package.json.
const topFilePath = path.join(path.dirname(path.dirname(pwd)), 'package.json');
// console.log(filePath);
const topFileContent = fs.readFileSync(topFilePath);
const topPackageJson = JSON.parse(topFileContent.toString());
const releaseVersion = topPackageJson.version.replace(/[.-]pre/, '');
console.log(`package version: ${topPackageJson.version}`);
const enginesNodeVersion = topPackageJson.engines.node.replace(/[^0-9]*/, '') || '';
const enginesNodeVersionMajor = enginesNodeVersion.replace(/[.].*/, '');
const customFields = {
enginesNodeVersion,
enginesNodeVersionMajor
}
return {
releaseVersion,
docusaurusVersion: require('@docusaurus/core/package.json').version,
buildTime: new Date().getTime(),
...customFields,
}
}
// ----------------------------------------------------------------------------
const customFields = getCustomFields();
console.log('customFields: ' + util.inspect(customFields));
// ----------------------------------------------------------------------------
const config: Config = {
title: 'The xPack Reproducible Build Framework' +
((process.env.DOCUSAURUS_IS_PREVIEW === 'true') ? ' (preview)' : ''),
tagline: 'Tools to manage, configure and build complex, package based, multi-target projects, in a reproducible way',
favicon: 'img/favicon.ico',
// Set the production url of your site here
url: 'https://xpack.github.io/',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: process.env.DOCUSAURUS_BASEURL ??
'/',
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'xpack', // Usually your GitHub org/user name.
projectName: 'xpack.github.io', // Usually your repo name.
onBrokenAnchors: 'throw',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
onDuplicateRoutes: 'throw',
// Useful for the sitemap.xml, to avoid redirects, since
// GitHub redirects all to trailing slash.
trailingSlash: true,
// Even if you don't use internationalization, 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'],
},
plugins: [
[
'@docusaurus/plugin-content-docs',
{
sidebarPath: './sidebars.ts',
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: 'https://github.com/xpack/xpack.github.io/edit/master/website/',
// showLastUpdateAuthor: true,
showLastUpdateTime: true,
},
],
[
// https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog
'@docusaurus/plugin-content-blog',
{
showReadingTime: true,
feedOptions: {
type: ['rss', 'atom'],
xslt: true,
},
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: 'https://github.com/xpack/xpack.github.io/edit/master/website/',
// Useful options to enforce blogging best practices
onInlineTags: 'warn',
onInlineAuthors: 'warn',
onUntruncatedBlogPosts: 'warn',
},
],
[
'@docusaurus/plugin-content-pages',
{}
],
[
// https://docusaurus.io/docs/next/api/plugins/@docusaurus/plugin-client-redirects#redirects
'@docusaurus/plugin-client-redirects',
redirects,
],
[
'@docusaurus/plugin-debug',
{}
],
[
// https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-google-gtag
// https://tagassistant.google.com
'@docusaurus/plugin-google-gtag',
{
trackingID: 'G-8WX9T80JEK',
anonymizeIP: false,
}
],
[
// https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-sitemap
// https://cronica-it.github.io/sitemap.xml
'@docusaurus/plugin-sitemap',
{
// https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-sitemap
changefreq: 'weekly',
priority: 0.5,
// ignorePatterns: ['/tags/**'],
filename: 'sitemap.xml',
}
],
[
'@docusaurus/plugin-ideal-image',
{
quality: 70,
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,
},
],
// Local plugins.
'./src/plugins/SelectReleasesPlugin',
],
themes: [
[
'@docusaurus/theme-classic',
{
customCss: './src/css/custom.css',
}
],
[
// https://docusaurus.io/docs/search#using-algolia-docsearch
'@docusaurus/theme-search-algolia',
{
}
],
],
// https://docusaurus.io/docs/api/docusaurus-config#headTags
headTags: [
{
tagName: 'link',
attributes: {
rel: 'icon',
type: 'image/png',
href: '/favicons/favicon-48x48.png',
sizes: '48x48'
}
},
{
tagName: 'link',
attributes: {
rel: 'icon',
type: 'image/svg+xml',
href: '/favicons/favicon.svg'
}
},
{
tagName: 'link',
attributes: {
rel: 'shortcut icon',
href: '/favicons/favicon.ico'
}
},
{
// This might also go to themeConfig.metadata.
tagName: 'meta',
attributes: {
name: 'apple-mobile-web-app-title',
content: 'xPack'
}
},
{
tagName: 'link',
attributes: {
rel: 'manifest',
href: '/favicons/site.webmanifest'
}
}
],
// No longer needed.
// themes: [ '@docusaurus/theme-search-algolia' ],
themeConfig: {
// The project's social card, og:image, twitter:image, 1200x630
image: 'img/sunrise-og-image.jpg',
metadata: [
{
name: 'keywords',
content: 'xpack, project, manage, build, test, dependencies, xpm, npm, reproducibility'
}
],
navbar: {
// Overriden by i18n/en/docusaurus-theme-classic.
title: 'The xPack Project',
logo: {
alt: 'xPack Logo',
src: 'img/components-256.png',
href: 'https://xpack.github.io/',
},
items: [
{
to: '/',
// label: 'Home',
className: 'header-home-link',
position: 'left'
},
customDocsNavbarItem,
{
type: 'dropdown',
to: '/blog',
label: 'Blog',
position: 'left',
items: [
{
label: 'Recent',
to: '/blog'
},
{
label: 'Archive',
to: '/blog/archive'
},
{
label: 'Tags',
to: '/blog/tags'
},
]
},
{
href: 'https://github.com/xpack/xpack.github.io/',
position: 'right',
className: 'header-github-link',
'aria-label': 'GitHub repository',
},
{
type: 'dropdown',
href: 'https://github.com/xpack/xpack.github.io/',
position: 'right',
label: 'GitHub',
items: [
{
label: `xpack.github.io`,
href: `https://github.com/xpack/xpack.github.io/`,
},
{
label: 'xpack org',
href: 'https://github.com/xpack/',
},
{
label: 'xpack-dev-tools org',
href: 'https://github.com/xpack-dev-tools/',
},
]
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Pages',
items: [
{
label: 'Getting Started',
to: '/docs/getting-started',
},
{
label: 'About',
to: '/docs/project/about',
},
{
label: 'Blog',
to: '/blog',
},
],
},
{
title: 'Community',
items: [
{
label: 'GitHub Discussions',
href: 'https://github.com/xpack/xpack.github.io/discussions',
},
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/xpack',
},
{
label: 'Discord',
href: 'https://discord.com/invite/kbzWaJerFG',
},
{
label: 'X/Twitter',
href: 'https://twitter.com/xpack_project',
},
],
},
{
title: 'More',
items: [
{
label: 'Donate via PayPal',
href: 'https://www.paypal.com/donate/?hosted_button_id=5MFRG9ZRBETQ8',
},
{
label: 'GitHub xpack.github.io',
href: 'https://github.com/xpack/xpack.github.io/',
},
{
label: 'GitHub xpack org',
href: 'https://github.com/xpack/',
},
{
label: 'GitHub xpack-dev-tools org',
href: 'https://github.com/xpack-dev-tools/',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Liviu Ionescu. Built with Docusaurus v${customFields.docusaurusVersion} on ${new Date(customFields.buildTime).toDateString()}.`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
// https://docusaurus.io/docs/search#using-algolia-docsearch
// https://docsearch.algolia.com/docs/docsearch-v3/
algolia: {
// The application ID provided by Algolia
appId: "KIDD7R4CL1",
// Public API key: it is safe to commit it
apiKey: "ca2ffc431941284609f2d50202fc5506",
indexName: "xpackio",
// It ensures that search results are relevant to the current
// language and version. Enabled by default.
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',
externalUrlRegex: 'xpack\\.github\\.io|xpack-dev-tools\\.github\\.io',
// 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',
// Optional: whether the insights feature is enabled or not on Docsearch (`false` by default)
insights: false,
},
} satisfies Preset.ThemeConfig,
customFields: customFields,
};
export default config;