mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-23 19:48:54 +02:00
test(v2): dogfooding: add huge sidebar for testing purposes (#5130)
* dogfoog: add huge sidebar for testing purposes * Add standalone doc + build-size tracking
This commit is contained in:
parent
dc9f104ccc
commit
f03479f69e
5 changed files with 59 additions and 6 deletions
|
@ -124,6 +124,7 @@ const isVersioningDisabled = !!process.env.DISABLE_VERSIONING || isI18nStaging;
|
|||
// Using a symlinked folder as source, test against https://github.com/facebook/docusaurus/issues/3272
|
||||
path: 'dogfooding/docs-tests-symlink',
|
||||
routeBasePath: 'docs-tests',
|
||||
sidebarPath: 'dogfooding/docs-tests-sidebars.js',
|
||||
},
|
||||
],
|
||||
|
||||
|
|
49
website/dogfooding/docs-tests-sidebars.js
Normal file
49
website/dogfooding/docs-tests-sidebars.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
sidebar: [
|
||||
{
|
||||
type: 'doc',
|
||||
id: 'index',
|
||||
label: 'Index',
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Huge sidebar category',
|
||||
items: generateHugeSidebarItems(4),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
function generateHugeSidebarItems() {
|
||||
const maxLevel = 4;
|
||||
const linksCount = 5;
|
||||
const categoriesCount = 5;
|
||||
|
||||
function generateRecursive(maxLevel, currentLevel = 0) {
|
||||
if (currentLevel === maxLevel) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const linkItems = [...Array(linksCount).keys()].map((index) => ({
|
||||
type: 'link',
|
||||
href: '/',
|
||||
label: `Link ${index} (level ${currentLevel + 1})`,
|
||||
}));
|
||||
|
||||
const categoryItems = [...Array(categoriesCount).keys()].map((index) => ({
|
||||
type: 'category',
|
||||
label: `Category ${index} (level ${currentLevel + 1})`,
|
||||
items: generateRecursive(maxLevel, currentLevel + 1),
|
||||
}));
|
||||
|
||||
return [...linkItems, ...categoryItems];
|
||||
}
|
||||
|
||||
return generateRecursive(maxLevel);
|
||||
}
|
3
website/dogfooding/docs-tests/standalone.md
Normal file
3
website/dogfooding/docs-tests/standalone.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Standalone doc
|
||||
|
||||
This doc is not in any sidebar, on purpose, to measure the build size impact of the huge sidebar
|
Loading…
Add table
Add a link
Reference in a new issue