mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 23:57:22 +02:00
refactor(content-docs): read category metadata files before autogenerating (#6586)
* refactor(content-docs): read category metadata files before autogenerating * fix tests * fix Windows... * warn user when behavior is undetermined * oops * fix typo
This commit is contained in:
parent
b03431f139
commit
1ca07f8466
9 changed files with 120 additions and 128 deletions
|
@ -19,6 +19,7 @@ import type {
|
|||
NormalizedSidebarItemCategory,
|
||||
SidebarItemCategory,
|
||||
SidebarItemAutogenerated,
|
||||
CategoryMetadataFile,
|
||||
} from './types';
|
||||
import {transformSidebarItems} from './utils';
|
||||
import {DefaultSidebarItemsGenerator} from './generator';
|
||||
|
@ -39,6 +40,7 @@ export type SidebarProcessorParams = {
|
|||
version: VersionMetadata;
|
||||
categoryLabelSlugger: Slugger;
|
||||
sidebarOptions: SidebarOptions;
|
||||
categoriesMetadata: Record<string, CategoryMetadataFile>;
|
||||
};
|
||||
|
||||
function toSidebarItemsGeneratorDoc(
|
||||
|
@ -72,6 +74,7 @@ async function processSidebar(
|
|||
docs,
|
||||
version,
|
||||
sidebarOptions,
|
||||
categoriesMetadata,
|
||||
} = params;
|
||||
|
||||
// Just a minor lazy transformation optimization
|
||||
|
@ -101,6 +104,7 @@ async function processSidebar(
|
|||
isCategoryIndex,
|
||||
...getSidebarItemsGeneratorDocsAndVersion(),
|
||||
options: sidebarOptions,
|
||||
categoriesMetadata,
|
||||
});
|
||||
// TODO validate generated items: user can generate bad items
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue