mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-10 17:53:36 +02:00
Docs(feat): add generated rust SDK doc (replacing the link)
This commit is contained in:
parent
902671739c
commit
4d61fa7edd
@ -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
|
||||
};
|
||||
|
@ -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',
|
||||
],
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user