website: Docusaurus 3.8 shared fixes part 2 (#15155)
* website: Fix issue where files are ignored during build. * Update packages/docusaurus-config/lib/routing.js Co-authored-by: Dominic R <dominic@sdko.org> Signed-off-by: Teffen Ellis <592134+GirlBossRush@users.noreply.github.com> * website: Update paths. --------- Signed-off-by: Teffen Ellis <592134+GirlBossRush@users.noreply.github.com> Co-authored-by: Dominic R <dominic@sdko.org>
This commit is contained in:
110
packages/docusaurus-config/lib/navbar.js
Normal file
110
packages/docusaurus-config/lib/navbar.js
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
/**
|
||||||
|
* @file Docusaurus navbar configuration for the authentik website.
|
||||||
|
*
|
||||||
|
* @import { NavbarItem } from "@docusaurus/theme-common";
|
||||||
|
*/
|
||||||
|
import { DocusaurusURL, SocialURL } from "./routing.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The navbar items for the authentik website.
|
||||||
|
*
|
||||||
|
* @type {NavbarItem[]}
|
||||||
|
*/
|
||||||
|
export const SocialNavbarItems = /** @type {const} */ ([
|
||||||
|
{
|
||||||
|
"href": SocialURL.GitHub,
|
||||||
|
"data-icon": "github",
|
||||||
|
"aria-label": "GitHub",
|
||||||
|
"position": "right",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"href": SocialURL.Discord,
|
||||||
|
"data-icon": "discord",
|
||||||
|
"aria-label": "Discord",
|
||||||
|
"position": "right",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The navbar items for the authentik website.
|
||||||
|
*
|
||||||
|
* @satisfies {NavbarItem[]}
|
||||||
|
*/
|
||||||
|
export const NavbarItemsTemplate = /** @type {const} */ ([
|
||||||
|
{
|
||||||
|
to: "{{WWW_URL}}/features",
|
||||||
|
label: "Features",
|
||||||
|
position: "left",
|
||||||
|
target: "_self",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: "{{INTEGRATIONS_URL}}",
|
||||||
|
label: "Integrations",
|
||||||
|
target: "_self",
|
||||||
|
position: "left",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: "{{DOCS_URL}}",
|
||||||
|
|
||||||
|
label: "Documentation",
|
||||||
|
position: "left",
|
||||||
|
target: "_self",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: "{{WWW_URL}}/pricing/",
|
||||||
|
label: "Pricing",
|
||||||
|
position: "left",
|
||||||
|
target: "_self",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: "{{WWW_URL}}/blog",
|
||||||
|
label: "Blog",
|
||||||
|
position: "left",
|
||||||
|
target: "_self",
|
||||||
|
},
|
||||||
|
...SocialNavbarItems,
|
||||||
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} NavbarItemOverrides
|
||||||
|
*
|
||||||
|
* @prop {string} WWW_URL The URL for the WWW environment.
|
||||||
|
* @prop {string} DOCS_URL The URL for the documentation.
|
||||||
|
* @prop {string} INTEGRATIONS_URL The URL for the integrations.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const DEFAULT_NAVBAR_REPLACEMENTS = /** @type {const} */ ({
|
||||||
|
DOCS_URL: DocusaurusURL.Docs,
|
||||||
|
INTEGRATIONS_URL: DocusaurusURL.Integrations,
|
||||||
|
WWW_URL: DocusaurusURL.WWW,
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a navbar item array, replacing placeholders with the given replacements.
|
||||||
|
*
|
||||||
|
* @param {Partial<NavbarItemOverrides>} [overrides]
|
||||||
|
* @returns {NavbarItem[]}
|
||||||
|
*/
|
||||||
|
export function createNavbarItems(overrides) {
|
||||||
|
const replacements = {
|
||||||
|
...DEFAULT_NAVBAR_REPLACEMENTS,
|
||||||
|
...overrides,
|
||||||
|
};
|
||||||
|
|
||||||
|
return NavbarItemsTemplate.map((item) => {
|
||||||
|
if (typeof item.to !== "string") return item;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
to: item.to.replace(
|
||||||
|
/{{([^}]+)}}/g,
|
||||||
|
/**
|
||||||
|
* @param {keyof NavbarItemOverrides} key
|
||||||
|
*/
|
||||||
|
(_, key) => {
|
||||||
|
return replacements[key];
|
||||||
|
},
|
||||||
|
),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
35
packages/docusaurus-config/lib/routing.js
Normal file
35
packages/docusaurus-config/lib/routing.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* @file Docusaurus routing configuration.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {'production'|'development'} NodeEnvironment
|
||||||
|
*/
|
||||||
|
|
||||||
|
const NodeEnvironment = /** @type {NodeEnvironment} */ (process.env.NODE_ENV || "development");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @satisfies {Record<NodeEnvironment, Record<string, string>>}
|
||||||
|
*/
|
||||||
|
export const DocusaurusURLByEnvironment = /** @type {const} */ ({
|
||||||
|
development: {
|
||||||
|
Docs: "http://localhost:3000",
|
||||||
|
Integrations: "http://localhost:3001",
|
||||||
|
WWW: "http://localhost:3002",
|
||||||
|
},
|
||||||
|
production: {
|
||||||
|
Docs: "https://docs.goauthentik.io",
|
||||||
|
Integrations: "https://integrations.goauthentik.io",
|
||||||
|
WWW: "https://goauthentik.io",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const DocusaurusURL = DocusaurusURLByEnvironment[NodeEnvironment];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @satisfies {Record<string, string>}
|
||||||
|
*/
|
||||||
|
export const SocialURL = /** @type {const} */ ({
|
||||||
|
Discord: "https://goauthentik.io/discord",
|
||||||
|
GitHub: "https://github.com/goauthentik/authentik",
|
||||||
|
});
|
||||||
4
packages/docusaurus-config/package-lock.json
generated
4
packages/docusaurus-config/package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@goauthentik/docusaurus-config",
|
"name": "@goauthentik/docusaurus-config",
|
||||||
"version": "2.1.0",
|
"version": "2.1.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@goauthentik/docusaurus-config",
|
"name": "@goauthentik/docusaurus-config",
|
||||||
"version": "2.1.0",
|
"version": "2.1.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"deepmerge-ts": "^7.1.5",
|
"deepmerge-ts": "^7.1.5",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@goauthentik/docusaurus-config",
|
"name": "@goauthentik/docusaurus-config",
|
||||||
"version": "2.1.0",
|
"version": "2.1.1",
|
||||||
"description": "authentik's Docusaurus config",
|
"description": "authentik's Docusaurus config",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user