mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +02:00
fix(docusaurus-utils-validation): baseUrl + routeBasePath: allow empty string, normalized as "/" (#8258)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com> fix https://github.com/facebook/docusaurus/issues/8254
This commit is contained in:
parent
85d0b5674f
commit
e553ce7e59
12 changed files with 92 additions and 17 deletions
|
@ -42,7 +42,7 @@ describe('normalizeDocsPluginOptions', () => {
|
|||
it('accepts correctly defined user options', () => {
|
||||
const userOptions: Options = {
|
||||
path: 'my-docs', // Path to data on filesystem, relative to site dir.
|
||||
routeBasePath: 'my-docs', // URL Route.
|
||||
routeBasePath: '/my-docs', // URL Route.
|
||||
tagsBasePath: 'tags', // URL Tags Route.
|
||||
include: ['**/*.{md,mdx}'], // Extensions to include.
|
||||
exclude: GlobExcludeDefault,
|
||||
|
|
|
@ -11,6 +11,7 @@ import {
|
|||
RemarkPluginsSchema,
|
||||
RehypePluginsSchema,
|
||||
AdmonitionsSchema,
|
||||
RouteBasePathSchema,
|
||||
URISchema,
|
||||
} from '@docusaurus/utils-validation';
|
||||
import {GlobExcludeDefault} from '@docusaurus/utils';
|
||||
|
@ -73,10 +74,7 @@ const OptionsSchema = Joi.object<PluginOptions>({
|
|||
editUrl: Joi.alternatives().try(URISchema, Joi.function()),
|
||||
editCurrentVersion: Joi.boolean().default(DEFAULT_OPTIONS.editCurrentVersion),
|
||||
editLocalizedFiles: Joi.boolean().default(DEFAULT_OPTIONS.editLocalizedFiles),
|
||||
routeBasePath: Joi.string()
|
||||
// '' not allowed, see https://github.com/facebook/docusaurus/issues/3374
|
||||
// .allow('') ""
|
||||
.default(DEFAULT_OPTIONS.routeBasePath),
|
||||
routeBasePath: RouteBasePathSchema.default(DEFAULT_OPTIONS.routeBasePath),
|
||||
tagsBasePath: Joi.string().default(DEFAULT_OPTIONS.tagsBasePath),
|
||||
// @ts-expect-error: deprecated
|
||||
homePageId: Joi.any().forbidden().messages({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue