mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-24 05:28:01 +02:00
feat(v2): blog + docs multi-instance plugins (#3204)
* stable createData namespacing + second-blog dogfooding * Docs: support multi-instance + make community docs a separate instance * tests: add 2nd docs instance to versioned site * fix docs version cli tests * fix docs versioning cli * typo * team: add link to my site * better extendCli integration * fix metadata tests * tests for versioned site with second docs instance * move some validation code to utils-validation * fix missing dependency * fix bad compiled output due to importing constants in ./client folder * make docs tests easier to maintain * refactors * prevent lodash imports in client bundle * redirect old community docs to new urls
This commit is contained in:
parent
e944f35640
commit
59f705ee66
67 changed files with 2025 additions and 2059 deletions
|
@ -1,45 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`validation schemas AdmonitionsSchema 1`] = `"\\"value\\" must be of type object"`;
|
||||
|
||||
exports[`validation schemas AdmonitionsSchema 2`] = `"\\"value\\" must be of type object"`;
|
||||
|
||||
exports[`validation schemas AdmonitionsSchema 3`] = `"\\"value\\" must be of type object"`;
|
||||
|
||||
exports[`validation schemas AdmonitionsSchema 4`] = `"\\"value\\" must be of type object"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema 1`] = `"\\"value\\" must be an array"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema 2`] = `"\\"value\\" must be an array"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema 3`] = `"\\"value\\" must be an array"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema 4`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema 5`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema 6`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema 7`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema 8`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema 9`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema 1`] = `"\\"value\\" must be an array"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema 2`] = `"\\"value\\" must be an array"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema 3`] = `"\\"value\\" must be an array"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema 4`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema 5`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema 6`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema 7`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema 8`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema 9`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
|
@ -0,0 +1,61 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`validation schemas AdmonitionsSchema: for value=[] 1`] = `"\\"value\\" must be of type object"`;
|
||||
|
||||
exports[`validation schemas AdmonitionsSchema: for value=3 1`] = `"\\"value\\" must be of type object"`;
|
||||
|
||||
exports[`validation schemas AdmonitionsSchema: for value=null 1`] = `"\\"value\\" must be of type object"`;
|
||||
|
||||
exports[`validation schemas AdmonitionsSchema: for value=true 1`] = `"\\"value\\" must be of type object"`;
|
||||
|
||||
exports[`validation schemas PluginIdSchema: for value="/docs" 1`] = `"\\"value\\" with value \\"/docs\\" fails to match the required pattern: /^[a-zA-Z_\\\\-]+$/"`;
|
||||
|
||||
exports[`validation schemas PluginIdSchema: for value="do cs" 1`] = `"\\"value\\" with value \\"do cs\\" fails to match the required pattern: /^[a-zA-Z_\\\\-]+$/"`;
|
||||
|
||||
exports[`validation schemas PluginIdSchema: for value="do/cs" 1`] = `"\\"value\\" with value \\"do/cs\\" fails to match the required pattern: /^[a-zA-Z_\\\\-]+$/"`;
|
||||
|
||||
exports[`validation schemas PluginIdSchema: for value="docs/" 1`] = `"\\"value\\" with value \\"docs/\\" fails to match the required pattern: /^[a-zA-Z_\\\\-]+$/"`;
|
||||
|
||||
exports[`validation schemas PluginIdSchema: for value=[] 1`] = `"\\"value\\" must be a string"`;
|
||||
|
||||
exports[`validation schemas PluginIdSchema: for value=3 1`] = `"\\"value\\" must be a string"`;
|
||||
|
||||
exports[`validation schemas PluginIdSchema: for value=null 1`] = `"\\"value\\" must be a string"`;
|
||||
|
||||
exports[`validation schemas PluginIdSchema: for value=true 1`] = `"\\"value\\" must be a string"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema: for value=[[]] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema: for value=[[null,null]] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema: for value=[[null,true]] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema: for value=[3] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema: for value=[false] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema: for value=[null] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema: for value=3 1`] = `"\\"value\\" must be an array"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema: for value=false 1`] = `"\\"value\\" must be an array"`;
|
||||
|
||||
exports[`validation schemas RehypePluginsSchema: for value=null 1`] = `"\\"value\\" must be an array"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema: for value=[[]] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema: for value=[[null,null]] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema: for value=[[null,true]] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema: for value=[3] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema: for value=[false] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema: for value=[null] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema: for value=3 1`] = `"\\"value\\" must be an array"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema: for value=false 1`] = `"\\"value\\" must be an array"`;
|
||||
|
||||
exports[`validation schemas RemarkPluginsSchema: for value=null 1`] = `"\\"value\\" must be an array"`;
|
|
@ -11,7 +11,8 @@ import {
|
|||
AdmonitionsSchema,
|
||||
RehypePluginsSchema,
|
||||
RemarkPluginsSchema,
|
||||
} from '../index';
|
||||
PluginIdSchema,
|
||||
} from '../validationSchemas';
|
||||
|
||||
function createTestHelpers({
|
||||
schema,
|
||||
|
@ -25,7 +26,10 @@ function createTestHelpers({
|
|||
}
|
||||
|
||||
function testFail(value: unknown) {
|
||||
expect(() => Joi.attempt(value, schema)).toThrowErrorMatchingSnapshot();
|
||||
expect(() => Joi.attempt(value, schema)).toThrowErrorMatchingSnapshot(
|
||||
// @ts-expect-error: seems ok at runtime, but bad typedef
|
||||
`for value=${JSON.stringify(value)}`,
|
||||
);
|
||||
}
|
||||
|
||||
return {testOK, testFail};
|
||||
|
@ -58,6 +62,27 @@ function testMarkdownPluginSchemas(schema: Joi.SchemaLike) {
|
|||
}
|
||||
|
||||
describe('validation schemas', () => {
|
||||
test('PluginIdSchema', () => {
|
||||
const {testOK, testFail} = createTestHelpers({
|
||||
schema: PluginIdSchema,
|
||||
defaultValue: 'default',
|
||||
});
|
||||
|
||||
testOK(undefined);
|
||||
testOK('docs');
|
||||
testOK('default');
|
||||
testOK('plugin-id_with-simple-special-chars');
|
||||
|
||||
testFail('/docs');
|
||||
testFail('docs/');
|
||||
testFail('do/cs');
|
||||
testFail('do cs');
|
||||
testFail(null);
|
||||
testFail(3);
|
||||
testFail(true);
|
||||
testFail([]);
|
||||
});
|
||||
|
||||
test('AdmonitionsSchema', () => {
|
||||
const {testOK, testFail} = createTestHelpers({
|
||||
schema: AdmonitionsSchema,
|
Loading…
Add table
Add a link
Reference in a new issue