@goauthentik/docusaurus-config 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/common.js ADDED
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @file Common Docusaurus configuration utilities.
3
+ *
4
+ * @import { Config as DocusaurusConfig } from "@docusaurus/types"
5
+ * @import { UserThemeConfig } from "./theme.js"
6
+ */
7
+
8
+ import { deepmerge } from "deepmerge-ts";
9
+ import { createThemeConfig } from "./theme.js";
10
+
11
+ //#region Types
12
+
13
+ /**
14
+ * @typedef {Omit<DocusaurusConfig, 'themeConfig'>} DocusaurusConfigBase
15
+ *
16
+ * Represents the base configuration for Docusaurus, excluding the theme configuration.
17
+ */
18
+
19
+ /**
20
+ * @typedef DocusaurusConfigBaseTheme
21
+ * @property {UserThemeConfig} themeConfig The theme configuration.
22
+ *
23
+ * Represents a configuration object, only including the theme configuration.
24
+ */
25
+
26
+ /**
27
+ * @typedef {Partial<DocusaurusConfigBase & DocusaurusConfigBaseTheme>} DocusaurusConfigInit
28
+ *
29
+ * The initial configuration for Docusaurus.
30
+ *
31
+ * @remarks
32
+ * This type is the result of Docusaurs's less than ideal type definitions.
33
+ * Much of the configuration is not strictly typed, however, this type
34
+ * is a good starting point.
35
+ */
36
+
37
+ //#endregion
38
+
39
+ //#region Functions
40
+
41
+ /**
42
+ * Create a Docusaurus configuration.
43
+ *
44
+ * @param {DocusaurusConfigInit} [overrides] The options to override.
45
+ * @returns {DocusaurusConfig}
46
+ */
47
+ export function createDocusaurusConfig({ themeConfig, ...overrides } = {}) {
48
+ /**
49
+ * @type {DocusaurusConfig}
50
+ */
51
+ const config = {
52
+ title: "authentik",
53
+ tagline: "Bring all of your authentication into a unified platform.",
54
+ url: "https://docs.goauthentik.io",
55
+ baseUrl: "/",
56
+ onBrokenLinks: "throw",
57
+ onBrokenAnchors: "throw",
58
+ favicon: "img/icon.png",
59
+ organizationName: "Authentik Security Inc.",
60
+ projectName: "authentik",
61
+ markdown: {
62
+ mermaid: true,
63
+ },
64
+ themeConfig: createThemeConfig(themeConfig),
65
+ };
66
+
67
+ return deepmerge(config, overrides);
68
+ }
69
+
70
+ //#endregion
package/lib/theme.js ADDED
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @file Docusaurus theme configuration for the authentik website.
3
+ *
4
+ * @import { UserThemeConfig as UserThemeConfigCommon } from "@docusaurus/theme-common";
5
+ * @import { UserThemeConfig as UserThemeConfigAlgolia } from "@docusaurus/theme-search-algolia";
6
+ */
7
+
8
+ import { deepmerge } from "deepmerge-ts";
9
+ import { themes as prismThemes } from "prism-react-renderer";
10
+
11
+ //#region Types
12
+
13
+ /**
14
+ * Combined theme configuration for Docusaurus and Algolia.
15
+ *
16
+ * @typedef {UserThemeConfigCommon & UserThemeConfigAlgolia} UserThemeConfig
17
+ */
18
+
19
+ //#endregion
20
+
21
+ //#region Functions
22
+
23
+ /**
24
+ * @returns {string} The copyright string.
25
+ */
26
+ export function formatCopyright() {
27
+ return `Copyright © ${new Date().getFullYear()} Authentik Security Inc. Built with Docusaurus.`;
28
+ }
29
+
30
+ /**
31
+ * Creates a Prisma configuration for Docusaurus.
32
+ *
33
+ * @param {Partial<UserThemeConfigCommon['prism']>} overrides - Overrides for the default Prisma configuration.
34
+ * @returns {UserThemeConfigCommon['prism']}
35
+ */
36
+ export function createPrismConfig(overrides = {}) {
37
+ /**
38
+ * @type {UserThemeConfigCommon['prism']}
39
+ */
40
+ const prismConfig = {
41
+ theme: prismThemes.oneLight,
42
+ darkTheme: prismThemes.oneDark,
43
+ additionalLanguages: [
44
+ // ---
45
+ "apacheconf",
46
+ "diff",
47
+ "http",
48
+ "json",
49
+ "nginx",
50
+ "python",
51
+ "bash",
52
+ ],
53
+ };
54
+
55
+ return deepmerge(prismConfig, overrides);
56
+ }
57
+
58
+ /**
59
+ * Creates a theme configuration for Docusaurus.
60
+ *
61
+ * @param {Partial<UserThemeConfig>} overrides - Overrides for the default theme configuration.
62
+ * @returns {UserThemeConfig}
63
+ */
64
+ export function createThemeConfig({ prism, ...overrides } = {}) {
65
+ /**
66
+ * @type {UserThemeConfig}
67
+ */
68
+ const themeConfig = {
69
+ image: "img/social.png",
70
+ tableOfContents: {
71
+ minHeadingLevel: 2,
72
+ maxHeadingLevel: 3,
73
+ },
74
+ colorMode: {
75
+ respectPrefersColorScheme: true,
76
+ },
77
+ algolia: {
78
+ appId: "36ROD0O0FV",
79
+ apiKey: "727db511300ca9aec5425645bbbddfb5",
80
+ },
81
+ prism: createPrismConfig(prism),
82
+ };
83
+
84
+ return deepmerge(themeConfig, overrides);
85
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goauthentik/docusaurus-config",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "authentik's Docusaurus config",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -44,6 +44,7 @@
44
44
  "types": "./out/index.d.ts",
45
45
  "files": [
46
46
  "./index.js",
47
+ "lib/**/*",
47
48
  "css/**/*",
48
49
  "out/**/*"
49
50
  ],