mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-31 15:29:32 +02:00
fix(v2): fix theme validation for prism field and add tests (#3210)
* fix(v2): fix theme validation for prism field * chore(v2): minor changes * chore(v2): remove unused dependencies
This commit is contained in:
parent
0d7314a6f7
commit
8f0c00f3d4
4 changed files with 131 additions and 63 deletions
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
|
||||
const path = require('path');
|
||||
const Joi = require('@hapi/joi');
|
||||
|
||||
module.exports = function () {
|
||||
return {
|
||||
|
@ -30,21 +29,3 @@ module.exports = function () {
|
|||
},
|
||||
};
|
||||
};
|
||||
|
||||
const ThemeConfigSchema = Joi.object({
|
||||
prism: Joi.object({
|
||||
theme: Joi.object({
|
||||
plain: Joi.alternatives().try(Joi.array(), Joi.object()).required(),
|
||||
styles: Joi.alternatives().try(Joi.array(), Joi.object()).required(),
|
||||
}),
|
||||
darkTheme: Joi.object({
|
||||
plain: Joi.alternatives().try(Joi.array(), Joi.object()).required(),
|
||||
styles: Joi.alternatives().try(Joi.array(), Joi.object()).required(),
|
||||
}),
|
||||
defaultLanguage: Joi.string(),
|
||||
}),
|
||||
});
|
||||
|
||||
module.exports.validateThemeConfig = ({validate, themeConfig}) => {
|
||||
return validate(ThemeConfigSchema, themeConfig);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue