mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-21 03:57:51 +02:00
refactor: move exported type definitions to declaration file (#6300)
* refactor: move exported type definitions to declaration file * fix * fix
This commit is contained in:
parent
9c0e659a44
commit
cf265c051e
53 changed files with 482 additions and 452 deletions
|
@ -12,21 +12,7 @@ import {
|
|||
FrontMatterTagsSchema,
|
||||
FrontMatterTOCHeadingLevels,
|
||||
} from '@docusaurus/utils-validation';
|
||||
import type {FrontMatterTag} from '@docusaurus/utils';
|
||||
|
||||
export type BlogPostFrontMatterAuthor = Record<string, unknown> & {
|
||||
key?: string;
|
||||
name?: string;
|
||||
imageURL?: string;
|
||||
url?: string;
|
||||
title?: string;
|
||||
};
|
||||
|
||||
// All the possible variants that the user can use for convenience
|
||||
export type BlogPostFrontMatterAuthors =
|
||||
| string
|
||||
| BlogPostFrontMatterAuthor
|
||||
| (string | BlogPostFrontMatterAuthor)[];
|
||||
import type {BlogPostFrontMatter} from '@docusaurus/plugin-content-blog';
|
||||
|
||||
const BlogPostFrontMatterAuthorSchema = Joi.object({
|
||||
key: Joi.string(),
|
||||
|
@ -38,37 +24,6 @@ const BlogPostFrontMatterAuthorSchema = Joi.object({
|
|||
.or('key', 'name')
|
||||
.rename('image_url', 'imageURL', {alias: true});
|
||||
|
||||
export type BlogPostFrontMatter = {
|
||||
id?: string;
|
||||
title?: string;
|
||||
description?: string;
|
||||
tags?: FrontMatterTag[];
|
||||
slug?: string;
|
||||
draft?: boolean;
|
||||
date?: Date | string; // Yaml automagically convert some string patterns as Date, but not all
|
||||
|
||||
authors?: BlogPostFrontMatterAuthors;
|
||||
|
||||
// We may want to deprecate those older author frontmatter fields later:
|
||||
author?: string;
|
||||
author_title?: string;
|
||||
author_url?: string;
|
||||
author_image_url?: string;
|
||||
|
||||
/** @deprecated */
|
||||
authorTitle?: string;
|
||||
/** @deprecated */
|
||||
authorURL?: string;
|
||||
/** @deprecated */
|
||||
authorImageURL?: string;
|
||||
|
||||
image?: string;
|
||||
keywords?: string[];
|
||||
hide_table_of_contents?: boolean;
|
||||
toc_min_heading_level?: number;
|
||||
toc_max_heading_level?: number;
|
||||
};
|
||||
|
||||
const FrontMatterAuthorErrorMessage =
|
||||
'{{#label}} does not look like a valid blog post author. Please use an author key or an author object (with a key and/or name).';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue