mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-22 13:37:05 +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
|
@ -40,7 +40,7 @@ describe('validateOptions', () => {
|
|||
...defaultOptions,
|
||||
feedOptions: {type: 'rss' as const, title: 'myTitle'},
|
||||
path: 'not_blog',
|
||||
routeBasePath: 'myBlog',
|
||||
routeBasePath: '/myBlog',
|
||||
postsPerPage: 5,
|
||||
include: ['api/*', 'docs/*'],
|
||||
};
|
||||
|
@ -53,7 +53,7 @@ describe('validateOptions', () => {
|
|||
it('accepts valid user options', () => {
|
||||
const userOptions: Options = {
|
||||
...defaultOptions,
|
||||
routeBasePath: 'myBlog',
|
||||
routeBasePath: '/myBlog',
|
||||
beforeDefaultRemarkPlugins: [],
|
||||
beforeDefaultRehypePlugins: [markdownPluginsFunctionStub],
|
||||
remarkPlugins: [[markdownPluginsFunctionStub, {option1: '42'}]],
|
||||
|
|
|
@ -10,6 +10,7 @@ import {
|
|||
RemarkPluginsSchema,
|
||||
RehypePluginsSchema,
|
||||
AdmonitionsSchema,
|
||||
RouteBasePathSchema,
|
||||
URISchema,
|
||||
} from '@docusaurus/utils-validation';
|
||||
import {GlobExcludeDefault} from '@docusaurus/utils';
|
||||
|
@ -56,10 +57,7 @@ const PluginOptionSchema = Joi.object<PluginOptions>({
|
|||
archiveBasePath: Joi.string()
|
||||
.default(DEFAULT_OPTIONS.archiveBasePath)
|
||||
.allow(null),
|
||||
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),
|
||||
include: Joi.array().items(Joi.string()).default(DEFAULT_OPTIONS.include),
|
||||
exclude: Joi.array().items(Joi.string()).default(DEFAULT_OPTIONS.exclude),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue