@docusaurus/plugin-content-docs 0.0.0-4247 → 0.0.0-4252
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/.tsbuildinfo +1 -1
- package/lib/docs.js +8 -17
- package/lib/options.js +3 -7
- package/lib/types.d.ts +0 -2
- package/package.json +8 -8
- package/src/__tests__/__fixtures__/simple-site/docs/hello.md +1 -0
- package/src/__tests__/__fixtures__/site-with-doc-label/docs/hello-1.md +1 -0
- package/src/__tests__/__fixtures__/versioned-site/docs/hello.md +3 -0
- package/src/__tests__/__fixtures__/versioned-site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md +3 -0
- package/src/__tests__/__fixtures__/versioned-site/i18n/fr/docusaurus-plugin-content-docs/version-1.0.0/hello.md +3 -0
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-1.0.0/hello.md +3 -0
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-1.0.1/hello.md +3 -0
- package/src/__tests__/__snapshots__/docs.test.ts.snap +2 -2
- package/src/__tests__/__snapshots__/index.test.ts.snap +11 -39
- package/src/__tests__/__snapshots__/translations.test.ts.snap +0 -15
- package/src/__tests__/docs.test.ts +42 -141
- package/src/__tests__/index.test.ts +7 -33
- package/src/__tests__/options.test.ts +0 -1
- package/src/__tests__/translations.test.ts +0 -1
- package/src/docs.ts +8 -20
- package/src/options.ts +5 -12
- package/src/types.ts +0 -2
package/src/options.ts
CHANGED
|
@@ -30,7 +30,6 @@ export const DEFAULT_OPTIONS: Omit<PluginOptions, 'id' | 'sidebarPath'> = {
|
|
|
30
30
|
path: 'docs', // Path to data on filesystem, relative to site dir.
|
|
31
31
|
routeBasePath: 'docs', // URL Route.
|
|
32
32
|
tagsBasePath: 'tags', // URL Tags Route.
|
|
33
|
-
homePageId: undefined, // TODO remove soon, deprecated
|
|
34
33
|
include: ['**/*.{md,mdx}'], // Extensions to include.
|
|
35
34
|
exclude: GlobExcludeDefault,
|
|
36
35
|
sidebarItemsGenerator: DefaultSidebarItemsGenerator,
|
|
@@ -79,7 +78,11 @@ export const OptionsSchema = Joi.object({
|
|
|
79
78
|
// .allow('') ""
|
|
80
79
|
.default(DEFAULT_OPTIONS.routeBasePath),
|
|
81
80
|
tagsBasePath: Joi.string().default(DEFAULT_OPTIONS.tagsBasePath),
|
|
82
|
-
homePageId: Joi.
|
|
81
|
+
homePageId: Joi.any().forbidden().messages({
|
|
82
|
+
'any.unknown':
|
|
83
|
+
'The docs plugin option homePageId is not supported anymore. To make a doc the "home", please add "slug: /" in its front matter. See: https://docusaurus.io/docs/next/docs-introduction#home-page-docs',
|
|
84
|
+
}),
|
|
85
|
+
|
|
83
86
|
include: Joi.array().items(Joi.string()).default(DEFAULT_OPTIONS.include),
|
|
84
87
|
exclude: Joi.array().items(Joi.string()).default(DEFAULT_OPTIONS.exclude),
|
|
85
88
|
sidebarPath: Joi.alternatives().try(
|
|
@@ -165,16 +168,6 @@ export function validateOptions({
|
|
|
165
168
|
}
|
|
166
169
|
}
|
|
167
170
|
|
|
168
|
-
// TODO remove homePageId before end of 2020
|
|
169
|
-
// "slug: /" is better because the home doc can be different across versions
|
|
170
|
-
if (options.homePageId) {
|
|
171
|
-
console.log(
|
|
172
|
-
chalk.red(
|
|
173
|
-
`The docs plugin option homePageId=${options.homePageId} is deprecated. To make a doc the "home", prefer frontmatter: "slug: /"`,
|
|
174
|
-
),
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
171
|
const normalizedOptions = validate(OptionsSchema, options);
|
|
179
172
|
|
|
180
173
|
if (normalizedOptions.admonitions) {
|
package/src/types.ts
CHANGED
|
@@ -50,7 +50,6 @@ export type EditUrlFunction = (editUrlParams: {
|
|
|
50
50
|
|
|
51
51
|
export type MetadataOptions = {
|
|
52
52
|
routeBasePath: string;
|
|
53
|
-
homePageId?: string;
|
|
54
53
|
editUrl?: string | EditUrlFunction;
|
|
55
54
|
editCurrentVersion: boolean;
|
|
56
55
|
editLocalizedFiles: boolean;
|
|
@@ -144,7 +143,6 @@ export type DocMetadataBase = LastUpdateData & {
|
|
|
144
143
|
id: string; // TODO legacy versioned id => try to remove
|
|
145
144
|
unversionedId: string; // TODO new unversioned id => try to rename to "id"
|
|
146
145
|
version: VersionName;
|
|
147
|
-
isDocsHomePage: boolean;
|
|
148
146
|
title: string;
|
|
149
147
|
description: string;
|
|
150
148
|
source: string; // @site aliased source => "@site/docs/folder/subFolder/subSubFolder/myDoc.md"
|