mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-29 14:38:50 +02:00
refactor(content-docs): refactor sidebars, Joi validation, generator rework, expose config types (#5678)
This commit is contained in:
parent
543011c9d2
commit
8d92e9bcf5
41 changed files with 1806 additions and 1880 deletions
|
@ -5,20 +5,15 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {
|
||||
LoadedVersion,
|
||||
Sidebar,
|
||||
LoadedContent,
|
||||
Sidebars,
|
||||
SidebarItem,
|
||||
} from './types';
|
||||
import type {LoadedVersion, LoadedContent} from './types';
|
||||
import type {Sidebar, Sidebars} from './sidebars/types';
|
||||
|
||||
import {chain, mapValues, flatten, keyBy} from 'lodash';
|
||||
import {chain, mapValues, keyBy} from 'lodash';
|
||||
import {
|
||||
collectSidebarCategories,
|
||||
transformSidebarItems,
|
||||
collectSidebarLinks,
|
||||
} from './sidebars';
|
||||
} from './sidebars/utils';
|
||||
import {
|
||||
TranslationFileContent,
|
||||
TranslationFile,
|
||||
|
@ -131,7 +126,7 @@ function translateSidebar({
|
|||
sidebarName: string;
|
||||
sidebarsTranslations: TranslationFileContent;
|
||||
}): Sidebar {
|
||||
return transformSidebarItems(sidebar, (item: SidebarItem): SidebarItem => {
|
||||
return transformSidebarItems(sidebar, (item) => {
|
||||
if (item.type === 'category') {
|
||||
return {
|
||||
...item,
|
||||
|
@ -222,7 +217,7 @@ function translateVersion(
|
|||
function getVersionsTranslationFiles(
|
||||
versions: LoadedVersion[],
|
||||
): TranslationFiles {
|
||||
return flatten(versions.map(getVersionTranslationFiles));
|
||||
return versions.flatMap(getVersionTranslationFiles);
|
||||
}
|
||||
function translateVersions(
|
||||
versions: LoadedVersion[],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue