mirror of
https://github.com/Unleash/unleash.git
synced 2025-11-24 20:06:55 +01:00
V3 is aliiiiiiiive
This commit is contained in:
parent
74b13374d7
commit
22abe8d286
@ -1,3 +0,0 @@
|
||||
module.exports = {
|
||||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
|
||||
};
|
||||
@ -15,7 +15,9 @@
|
||||
// the bits that are specific to the generation source we use, and make the docs
|
||||
// easier to use. In particular, removing the leading `/ushosted` is likely to
|
||||
// save us loooots of questions.
|
||||
const replace = require('replace-in-file');
|
||||
const replaceInFileSync = require('replace-in-file');
|
||||
|
||||
console.log(replaceInFileSync);
|
||||
|
||||
const options = {
|
||||
files: 'docs/reference/api/**/*.api.mdx',
|
||||
@ -27,4 +29,4 @@ const options = {
|
||||
to: ['', '"<your-unleash-url>"', '"path":['],
|
||||
};
|
||||
|
||||
replace(options);
|
||||
replaceInFileSync(options);
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
const { sdks } = require('./remote-content/sdks');
|
||||
const { docs: edgeAndProxy } = require('./remote-content/edge-proxy');
|
||||
import type { Config } from '@docusaurus/types';
|
||||
|
||||
import { sdks } from './remote-content/sdks';
|
||||
import { docs as edgeAndProxy } from './remote-content/edge-proxy';
|
||||
import pluginNpm2Yarn from '@docusaurus/remark-plugin-npm2yarn';
|
||||
|
||||
// for a given redirect object, modify it's `from` property such that for every
|
||||
// path that doesn't start with `/docs/`, a corresponding path that _does_ start
|
||||
@ -38,8 +41,8 @@ const addDocsRoutePrefix = ({ from, ...rest }) => {
|
||||
from: addDocs(from),
|
||||
};
|
||||
};
|
||||
/** @type {import('@docusaurus/types').DocusaurusConfig} */
|
||||
module.exports = {
|
||||
|
||||
const config: Config = {
|
||||
title: 'Unleash',
|
||||
tagline: 'The enterprise ready feature flag service',
|
||||
url: 'https://docs.getunleash.io',
|
||||
@ -169,20 +172,20 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
},
|
||||
prism: {
|
||||
theme: require('prism-react-renderer/themes/oceanicNext'),
|
||||
additionalLanguages: [
|
||||
'csharp',
|
||||
'dart',
|
||||
'http',
|
||||
'java',
|
||||
'kotlin',
|
||||
'php',
|
||||
'ruby',
|
||||
'rust',
|
||||
'swift',
|
||||
],
|
||||
},
|
||||
// prism: {
|
||||
// theme: require("prism-react-renderer/themes/oceanicNext"),
|
||||
// additionalLanguages: [
|
||||
// "csharp",
|
||||
// "dart",
|
||||
// "http",
|
||||
// "java",
|
||||
// "kotlin",
|
||||
// "php",
|
||||
// "ruby",
|
||||
// "rust",
|
||||
// "swift",
|
||||
// ],
|
||||
// },
|
||||
languageTabs: [
|
||||
{
|
||||
highlight: 'bash',
|
||||
@ -290,22 +293,15 @@ module.exports = {
|
||||
'@docusaurus/preset-classic',
|
||||
{
|
||||
docs: {
|
||||
sidebarPath: require.resolve('./sidebars.js'),
|
||||
// Please change this to your repo.
|
||||
editUrl:
|
||||
'https://github.com/Unleash/unleash/edit/main/website/',
|
||||
routeBasePath: '/',
|
||||
remarkPlugins: [
|
||||
[
|
||||
require('@docusaurus/remark-plugin-npm2yarn'),
|
||||
{ sync: true },
|
||||
],
|
||||
],
|
||||
docLayoutComponent: '@theme/DocPage',
|
||||
remarkPlugins: [[pluginNpm2Yarn, { sync: true }]],
|
||||
docItemComponent: '@theme/ApiItem',
|
||||
},
|
||||
theme: {
|
||||
customCss: require.resolve('./src/css/custom.css'),
|
||||
customCss: './src/css/custom.css',
|
||||
},
|
||||
googleAnalytics: {
|
||||
trackingID: 'UA-134882379-1',
|
||||
@ -928,5 +924,7 @@ module.exports = {
|
||||
defer: true,
|
||||
},
|
||||
],
|
||||
clientModules: [require.resolve('./global.js')],
|
||||
clientModules: ['./global.js'],
|
||||
};
|
||||
|
||||
export default config;
|
||||
@ -20,41 +20,25 @@
|
||||
"test": "NODE_ENV=test node --trace-warnings ../node_modules/.bin/jest remote-content"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.3.1",
|
||||
"@docusaurus/plugin-client-redirects": "2.3.1",
|
||||
"@docusaurus/plugin-google-analytics": "2.3.1",
|
||||
"@docusaurus/preset-classic": "2.3.1",
|
||||
"@docusaurus/core": "^3.5.2",
|
||||
"@docusaurus/plugin-client-redirects": "^3.5.2",
|
||||
"@docusaurus/plugin-google-analytics": "^3.5.2",
|
||||
"@docusaurus/preset-classic": "^3.5.2",
|
||||
"@docusaurus/remark-plugin-npm2yarn": "2.3.1",
|
||||
"@docusaurus/theme-mermaid": "2.3.1",
|
||||
"@mdx-js/react": "1.6.22",
|
||||
"@docusaurus/theme-mermaid": "^3.5.2",
|
||||
"@mdx-js/react": "^3.0.1",
|
||||
"@svgr/webpack": "8.1.0",
|
||||
"browserslist": "^4.16.5",
|
||||
"docusaurus-plugin-openapi-docs": "4.1.0",
|
||||
"docusaurus-plugin-remote-content": "^3.1.0",
|
||||
"docusaurus-theme-openapi-docs": "2.0.0-beta.2",
|
||||
"docusaurus-plugin-openapi-docs": "^4.1.0",
|
||||
"docusaurus-plugin-remote-content": "^4.0.0",
|
||||
"docusaurus-theme-openapi-docs": "^4.1.0",
|
||||
"git-url-parse": "^14.0.0",
|
||||
"plugin-image-zoom": "flexanalytics/plugin-image-zoom",
|
||||
"prism-react-renderer": "^2.4.0",
|
||||
"prism-svelte": "^0.5.0",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "18.3.1",
|
||||
"url-loader": "4.1.1"
|
||||
},
|
||||
"resolutions": {
|
||||
"axios": "^0.28.0",
|
||||
"async": "^3.2.4",
|
||||
"trim": "^1.0.0",
|
||||
"got": "^13.0.0",
|
||||
"glob-parent": "^6.0.0",
|
||||
"browserslist": "^4.16.5",
|
||||
"set-value": "^4.0.1",
|
||||
"ansi-regex": "^5.0.1",
|
||||
"nth-check": "^2.0.1",
|
||||
"minimatch": "^5.0.0",
|
||||
"decode-uri-component": "^0.4.0",
|
||||
"qs": "^6.9.7",
|
||||
"ws": "^8.18.0",
|
||||
"semver": "^7.5.3",
|
||||
"joi": "17.13.3"
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"replace-in-file": "^8.2.0"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
@ -70,12 +54,10 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.25.8",
|
||||
"@docusaurus/module-type-aliases": "2.3.1",
|
||||
"@docusaurus/module-type-aliases": "^3.5.2",
|
||||
"@docusaurus/types": "^3.5.2",
|
||||
"@tsconfig/docusaurus": "2.0.3",
|
||||
"babel-loader": "9.1.3",
|
||||
"enhanced-resolve": "5.17.1",
|
||||
"react-router": "6.26.2",
|
||||
"replace-in-file": "7.2.0",
|
||||
"@types/react": "^18.3.11",
|
||||
"typescript": "5.4.5"
|
||||
},
|
||||
"packageManager": "yarn@4.4.1"
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
const {
|
||||
import {
|
||||
enrich,
|
||||
mapObject,
|
||||
modifyContent,
|
||||
getRepoData,
|
||||
getUrls,
|
||||
} = require('./shared');
|
||||
} from './shared';
|
||||
|
||||
const DOCS = mapObject(enrich)({
|
||||
'unleash-proxy': {
|
||||
@ -46,7 +46,7 @@ const modifyContent2 = modifyContent({
|
||||
getAdditionalAdmonitions: getAdmonitions,
|
||||
});
|
||||
|
||||
module.exports.docs = {
|
||||
export const docs = {
|
||||
urls: getUrls(DOCS),
|
||||
modifyContent: modifyContent2,
|
||||
};
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
const {
|
||||
import {
|
||||
enrichAdditional,
|
||||
modifyContent,
|
||||
getRepoData,
|
||||
getUrls,
|
||||
} = require('./shared');
|
||||
} from './shared';
|
||||
|
||||
// Type definitions
|
||||
//
|
||||
@ -44,9 +44,9 @@ const serverSideSdks = {
|
||||
'unleash-client-ruby': {
|
||||
sidebarName: 'Ruby',
|
||||
},
|
||||
'unleash-client-rust': {
|
||||
sidebarName: 'Rust',
|
||||
},
|
||||
// 'unleash-client-rust': {
|
||||
// sidebarName: 'Rust',
|
||||
// },
|
||||
'unleash-client-dotnet': {
|
||||
sidebarName: '.NET',
|
||||
slugName: 'dotnet',
|
||||
@ -117,7 +117,7 @@ const modifyContent2 = modifyContent({
|
||||
getAdditionalAdmonitions: getAdmonitions,
|
||||
});
|
||||
|
||||
module.exports.sdks = {
|
||||
export const sdks = {
|
||||
urls: getUrls(SDKS),
|
||||
modifyContent: modifyContent2,
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
const { docs } = require('./edge-proxy');
|
||||
import { docs } from './edge-proxy';
|
||||
|
||||
test('Should get all sub pages', () => {
|
||||
expect(docs.urls).toStrictEqual([
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
const path = require('path');
|
||||
import path from 'node:path';
|
||||
|
||||
module.exports.mapObject = (fn) => (o) =>
|
||||
export const mapObject = (fn) => (o) =>
|
||||
Object.fromEntries(Object.entries(o).map(fn));
|
||||
|
||||
module.exports.enrichAdditional =
|
||||
export const enrichAdditional =
|
||||
(additionalProperties) =>
|
||||
([repoName, repoData]) => {
|
||||
const repoUrl = `https://github.com/Unleash/${repoName}`;
|
||||
@ -17,9 +17,10 @@ module.exports.enrichAdditional =
|
||||
{ ...repoData, repoUrl, slugName, branch, ...additionalProperties },
|
||||
];
|
||||
};
|
||||
module.exports.enrich = module.exports.enrichAdditional({});
|
||||
|
||||
module.exports.getRepoData = (documents) => (filename) => {
|
||||
export const enrich = enrichAdditional({});
|
||||
|
||||
export const getRepoData = (documents) => (filename) => {
|
||||
const repoName = filename.split('/')[0];
|
||||
|
||||
const repoData = documents[repoName];
|
||||
@ -80,7 +81,7 @@ const replaceLinks = ({ content, repo }) => {
|
||||
.replaceAll(imageSrcLink, replaceImageSrcLink);
|
||||
};
|
||||
|
||||
module.exports.modifyContent =
|
||||
export const modifyContent =
|
||||
({
|
||||
getRepoDataFn,
|
||||
filePath = () => {},
|
||||
@ -128,11 +129,15 @@ module.exports.modifyContent =
|
||||
content: `---
|
||||
title: ${subpage?.sidebarName ?? data.sidebarName}
|
||||
slug: ${processedSlug}
|
||||
custom_edit_url: ${data.repoUrl}/edit/${data.branch}/${subpage ? subpageKey : 'README.md'}
|
||||
custom_edit_url: ${data.repoUrl}/edit/${data.branch}/${
|
||||
subpage ? subpageKey : 'README.md'
|
||||
}
|
||||
---
|
||||
|
||||
:::info Generated content
|
||||
This document was generated from ${subpage ? subpageKey : 'README.md'} in the [${data.sidebarName} GitHub repository](${data.repoUrl}).
|
||||
This document was generated from ${
|
||||
subpage ? subpageKey : 'README.md'
|
||||
} in the [${data.sidebarName} GitHub repository](${data.repoUrl}).
|
||||
:::
|
||||
|
||||
${additionalAdmonitions}
|
||||
@ -152,7 +157,7 @@ This content was generated on <time dateTime="${generationTime.toISOString()}">$
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.getUrls = (documents) =>
|
||||
export const getUrls = (documents) =>
|
||||
Object.entries(documents).flatMap(([repo, { branch, subPages }]) => [
|
||||
`${repo}/${branch}/README.md`,
|
||||
...(Object.keys(subPages ?? {}).map(
|
||||
|
||||
@ -9,10 +9,11 @@
|
||||
Create as many sidebars as you want.
|
||||
*/
|
||||
|
||||
// TODO: Add warning to legacy API docs - but generated items
|
||||
// TODO: Continue to clean URLs & redirects - but wait for SEO results first
|
||||
import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
|
||||
|
||||
module.exports = {
|
||||
import docsSidebar from './docs/reference/api/unleash/sidebar.ts';
|
||||
|
||||
const sidebars: SidebarsConfig = {
|
||||
academy: [
|
||||
{
|
||||
label: 'Unleash Academy',
|
||||
@ -382,7 +383,7 @@ module.exports = {
|
||||
slug: '/reference/api/unleash',
|
||||
},
|
||||
items: [
|
||||
require('./docs/reference/api/unleash/sidebar.ts'),
|
||||
docsSidebar,
|
||||
{
|
||||
'System API': [
|
||||
'reference/api/legacy/unleash/internal/prometheus',
|
||||
@ -688,3 +689,5 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default sidebars;
|
||||
6250
website/yarn.lock
6250
website/yarn.lock
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user