refactor(content-docs): deduplicate types, JSDoc for some APIs (#7027)

* refactor(content-docs): deduplicate types, JSDoc for some APIs

* little refactor
This commit is contained in:
Joshua Chen 2022-03-27 12:57:15 +08:00 committed by GitHub
parent b842197ac6
commit 2bcac29cd4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 715 additions and 521 deletions

View file

@ -5,13 +5,12 @@
* LICENSE file in the root directory of this source tree.
*/
import type {LoadedVersion, VersionTag, DocMetadata} from './types';
import type {LoadedVersion, VersionTag} from './types';
import type {
SidebarItemDoc,
SidebarItem,
SidebarItemCategory,
SidebarItemCategoryLink,
PropVersionDocs,
} from './sidebars/types';
import type {
PropSidebars,
@ -21,6 +20,8 @@ import type {
PropTagDocList,
PropTagDocListDoc,
PropSidebarItemLink,
PropVersionDocs,
DocMetadata,
} from '@docusaurus/plugin-content-docs';
import _ from 'lodash';
import {createDocsByIdIndex} from './docs';
@ -119,10 +120,10 @@ export function toVersionMetadataProp(
return {
pluginId,
version: loadedVersion.versionName,
label: loadedVersion.versionLabel,
banner: loadedVersion.versionBanner,
badge: loadedVersion.versionBadge,
className: loadedVersion.versionClassName,
label: loadedVersion.label,
banner: loadedVersion.banner,
badge: loadedVersion.badge,
className: loadedVersion.className,
isLast: loadedVersion.isLast,
docsSidebars: toSidebarsProp(loadedVersion),
docs: toVersionDocsProp(loadedVersion),
@ -153,7 +154,7 @@ export function toTagDocListProp({
}
return {
name: tag.name,
name: tag.label,
permalink: tag.permalink,
docs: toDocListProp(),
allTagsPath,