UNPKG

gatsby-plugin-utils

Version:
28 lines (26 loc) 984 B
import joi from "joi" import { PluginOptionsSchemaJoi } from "./utils/plugin-options-schema-joi-type" export * from "./utils/plugin-options-schema-joi-type" export const Joi: PluginOptionsSchemaJoi = joi.extend({ // This tells Joi to extend _all_ types with .dotenv(), see // https://github.com/sideway/joi/commit/03adf22eb1f06c47d1583617093edee3a96b3873 // @ts-ignore Joi types weren't updated with that commit, PR: https://github.com/sideway/joi/pull/2477 type: /^s/, rules: { // NOTE(@mxstbr): Disabled until we decide on the necessity for this API. // dotenv: { // args: [`name`], // validate(value, helpers, args): void { // if (!args.name) { // return helpers.error( // `any.dotenv requires the environment variable name` // ) // } // return value // }, // method(name): Schema { // return this.$_addRule({ name: `dotenv`, args: { name } }) // }, // }, }, })