Autogenerate sidebar

Also add intro to research section
This commit is contained in:
fryorcraken.eth 2024-02-19 15:01:44 +11:00
parent c72dc2d62b
commit e2f6fab9f0
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
3 changed files with 26 additions and 16 deletions

10
docs/research/index.md Normal file
View File

@ -0,0 +1,10 @@
---
title: Research
hide_table_of_contents: true
sidebar_position: 1
---
**Research and Studies**: protocol simulations and theoretical analysis to support the design
of Waku protocols. The protocol definitions can be found on the [Vac RFC](https://rfc.vac.dev/) website.
**Benchmarks**: Results of implementations and engineering related benchmarks for Waku clients.

View File

@ -63,17 +63,25 @@ const repositories = [
{
baseUrl: 'https://api.github.com/repos/waku-org/nwaku/contents/docs/benchmarks',
baseSavePath: '/docs/research/benchmarks/',
prefixToRemove: 'docs/benchmarks/'
prefixToRemove: "docs/benchmarks/",
categoryFileContent: "{ \"label\": \"Benchmarks\", \"collapsed\": false }"
},
{
baseUrl: 'https://api.github.com/repos/waku-org/research/contents/docs',
baseSavePath: '/docs/research/research-and-studies/',
prefixToRemove: 'docs/'
prefixToRemove: "docs/",
categoryFileContent: "{ \"label\": \"Research and Studies\", \"collapsed\": false }"
}
];
fs.rmSync('docs/research/', { recursive: true, force: true });
repositories.forEach(repo => {
fs.rmSync(path.join(__dirname, repo.baseSavePath), { recursive: true, force: true });
});
repositories.forEach(repo => {
fetchDirectoryContents(repo.baseUrl, repo.baseSavePath, repo.prefixToRemove);
});
fetchDirectoryContents(repo.baseUrl, repo.baseSavePath, repo.prefixToRemove, repo.categoryFileContent).then(() => {
const dir = path.join(__dirname, repo.baseSavePath);
fs.mkdirSync(dir, { recursive: true });
fs.writeFileSync(path.join(dir, "_category_.json"), repo.categoryFileContent);
});
});

View File

@ -87,18 +87,10 @@ const sidebars = {
],
research: [
{
type: "category",
label: "Research and Studies",
collapsed: false,
items: ["research/research-and-studies/incentivisation"],
},
{
type: "category",
label: "Nwaku Benchmarks",
collapsed: false,
items: ["research/benchmarks/postgres-adoption"],
type: 'autogenerated',
dirName: 'research', // '.' means the current docs folder
},
],
};
module.exports = sidebars;
module.exports = sidebars;