1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-05 17:53:12 +02:00

Docs(feat): add generated rust SDK doc (replacing the link)

This commit is contained in:
Thomas Heartman 2023-01-03 15:12:02 +01:00
parent 902671739c
commit 4d61fa7edd
No known key found for this signature in database
GPG Key ID: 47CFBB2D87C87664
2 changed files with 51 additions and 5 deletions

View File

@ -1,3 +1,27 @@
// all SDK repos and what they map to for the sidebar.
//
// Each key should return an object that contains *at least* the
// `sidebarSdkName` property. This is the name that is placed before "SDK" in
// the sidebar. An object can also optionally define a `slugName`. This will be
// used to construct the slug. If no "slugName" is defined, the `sidebarSdkName`
// should be used to create the slug.
const readmeRepos = {
'unleash-client-rust': {
sidebarSdkName: 'Rust',
},
// as an example of when you'd use both
// 'unleash-android-proxy-sdk': {
// sidebarSdkName: 'Android',
// slugName: 'android-proxy',
// },
};
function getReadmeRepoData(filename) {
const repoName = filename.split('/')[0];
return readmeRepos[repoName] ?? { sdkName: repoName };
}
/** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = {
title: 'Unleash',
@ -557,6 +581,32 @@ module.exports = {
},
},
],
[
'docusaurus-plugin-remote-content',
{
// more info at https://github.com/rdilweb/docusaurus-plugin-remote-content#options
name: 'content-sdks',
sourceBaseUrl: 'https://raw.githubusercontent.com/Unleash/', // gets prepended to all of the documents when fetching
outDir: 'docs/reference/sdks', // the base directory to output to.
documents: Object.keys(readmeRepos).map(
(repo) => `${repo}/main/README.md`,
), // the file names to download
modifyContent: (filename, content) => {
const data = getReadmeRepoData(filename);
return {
filename: `${(
data.slugName ?? data.sidebarSdkName
).toLowerCase()}.md`,
content: `---
title: ${data.sidebarSdkName} SDK
---
${content}
`,
};
},
},
],
],
themes: ['docusaurus-theme-openapi-docs'], // Allows use of @theme/ApiItem and other components
};

View File

@ -237,11 +237,7 @@ module.exports = {
'reference/sdks/php',
'reference/sdks/python',
'reference/sdks/ruby',
{
type: 'link',
href: 'https://github.com/unleash/unleash-client-rust',
label: 'Rust SDK',
},
'reference/sdks/rust',
'reference/sdks/dotnet',
],
},