ci: add NPM packages publish (#13974)
Co-authored-by: Teffen Ellis <teffen@nirri.us>
This commit is contained in:
committed by
GitHub
parent
895cd23b57
commit
bf0235c113
70
packages/docusaurus-config/lib/common.js
Normal file
70
packages/docusaurus-config/lib/common.js
Normal file
@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @file Common Docusaurus configuration utilities.
|
||||
*
|
||||
* @import { Config as DocusaurusConfig } from "@docusaurus/types"
|
||||
* @import { UserThemeConfig } from "./theme.js"
|
||||
*/
|
||||
|
||||
import { deepmerge } from "deepmerge-ts";
|
||||
import { createThemeConfig } from "./theme.js";
|
||||
|
||||
//#region Types
|
||||
|
||||
/**
|
||||
* @typedef {Omit<DocusaurusConfig, 'themeConfig'>} DocusaurusConfigBase
|
||||
*
|
||||
* Represents the base configuration for Docusaurus, excluding the theme configuration.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef DocusaurusConfigBaseTheme
|
||||
* @property {UserThemeConfig} themeConfig The theme configuration.
|
||||
*
|
||||
* Represents a configuration object, only including the theme configuration.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Partial<DocusaurusConfigBase & DocusaurusConfigBaseTheme>} DocusaurusConfigInit
|
||||
*
|
||||
* The initial configuration for Docusaurus.
|
||||
*
|
||||
* @remarks
|
||||
* This type is the result of Docusaurs's less than ideal type definitions.
|
||||
* Much of the configuration is not strictly typed, however, this type
|
||||
* is a good starting point.
|
||||
*/
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Functions
|
||||
|
||||
/**
|
||||
* Create a Docusaurus configuration.
|
||||
*
|
||||
* @param {DocusaurusConfigInit} [overrides] The options to override.
|
||||
* @returns {DocusaurusConfig}
|
||||
*/
|
||||
export function createDocusaurusConfig({ themeConfig, ...overrides } = {}) {
|
||||
/**
|
||||
* @type {DocusaurusConfig}
|
||||
*/
|
||||
const config = {
|
||||
title: "authentik",
|
||||
tagline: "Bring all of your authentication into a unified platform.",
|
||||
url: "https://docs.goauthentik.io",
|
||||
baseUrl: "/",
|
||||
onBrokenLinks: "throw",
|
||||
onBrokenAnchors: "throw",
|
||||
favicon: "img/icon.png",
|
||||
organizationName: "Authentik Security Inc.",
|
||||
projectName: "authentik",
|
||||
markdown: {
|
||||
mermaid: true,
|
||||
},
|
||||
themeConfig: createThemeConfig(themeConfig),
|
||||
};
|
||||
|
||||
return deepmerge(config, overrides);
|
||||
}
|
||||
|
||||
//#endregion
|
||||
85
packages/docusaurus-config/lib/theme.js
Normal file
85
packages/docusaurus-config/lib/theme.js
Normal file
@ -0,0 +1,85 @@
|
||||
/**
|
||||
* @file Docusaurus theme configuration for the authentik website.
|
||||
*
|
||||
* @import { UserThemeConfig as UserThemeConfigCommon } from "@docusaurus/theme-common";
|
||||
* @import { UserThemeConfig as UserThemeConfigAlgolia } from "@docusaurus/theme-search-algolia";
|
||||
*/
|
||||
|
||||
import { deepmerge } from "deepmerge-ts";
|
||||
import { themes as prismThemes } from "prism-react-renderer";
|
||||
|
||||
//#region Types
|
||||
|
||||
/**
|
||||
* Combined theme configuration for Docusaurus and Algolia.
|
||||
*
|
||||
* @typedef {UserThemeConfigCommon & UserThemeConfigAlgolia} UserThemeConfig
|
||||
*/
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Functions
|
||||
|
||||
/**
|
||||
* @returns {string} The copyright string.
|
||||
*/
|
||||
export function formatCopyright() {
|
||||
return `Copyright © ${new Date().getFullYear()} Authentik Security Inc. Built with Docusaurus.`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Prisma configuration for Docusaurus.
|
||||
*
|
||||
* @param {Partial<UserThemeConfigCommon['prism']>} overrides - Overrides for the default Prisma configuration.
|
||||
* @returns {UserThemeConfigCommon['prism']}
|
||||
*/
|
||||
export function createPrismConfig(overrides = {}) {
|
||||
/**
|
||||
* @type {UserThemeConfigCommon['prism']}
|
||||
*/
|
||||
const prismConfig = {
|
||||
theme: prismThemes.oneLight,
|
||||
darkTheme: prismThemes.oneDark,
|
||||
additionalLanguages: [
|
||||
// ---
|
||||
"apacheconf",
|
||||
"diff",
|
||||
"http",
|
||||
"json",
|
||||
"nginx",
|
||||
"python",
|
||||
"bash",
|
||||
],
|
||||
};
|
||||
|
||||
return deepmerge(prismConfig, overrides);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a theme configuration for Docusaurus.
|
||||
*
|
||||
* @param {Partial<UserThemeConfig>} overrides - Overrides for the default theme configuration.
|
||||
* @returns {UserThemeConfig}
|
||||
*/
|
||||
export function createThemeConfig({ prism, ...overrides } = {}) {
|
||||
/**
|
||||
* @type {UserThemeConfig}
|
||||
*/
|
||||
const themeConfig = {
|
||||
image: "img/social.png",
|
||||
tableOfContents: {
|
||||
minHeadingLevel: 2,
|
||||
maxHeadingLevel: 3,
|
||||
},
|
||||
colorMode: {
|
||||
respectPrefersColorScheme: true,
|
||||
},
|
||||
algolia: {
|
||||
appId: "36ROD0O0FV",
|
||||
apiKey: "727db511300ca9aec5425645bbbddfb5",
|
||||
},
|
||||
prism: createPrismConfig(prism),
|
||||
};
|
||||
|
||||
return deepmerge(themeConfig, overrides);
|
||||
}
|
||||
Reference in New Issue
Block a user