Skip to content

Commit 6ba5d63

Browse files
authoredOct 16, 2020
chore(gatsby-plugin-manifest): add pluginOptionsSchema (#27421)
* chore(gatsby-plugin-manifest): add pluginOptionsSchema * Add documentation for localize option
1 parent 1496bf1 commit 6ba5d63

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
 

‎packages/gatsby-plugin-manifest/src/gatsby-node.js

+41
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,49 @@ async function checkCache(cache, icon, srcIcon, srcIconDigest, callback) {
5858
}
5959
}
6060

61+
if (process.env.GATSBY_EXPERIMENTAL_PLUGIN_OPTION_VALIDATION) {
62+
exports.pluginOptionsSchema = ({ Joi }) => {
63+
Joi.object({
64+
name: Joi.string(),
65+
short_name: Joi.string(),
66+
description: Joi.string(),
67+
lang: Joi.string(),
68+
localize: Joi.array().items(
69+
Joi.object({
70+
start_url: Joi.string(),
71+
name: Joi.string(),
72+
short_name: Joi.string(),
73+
description: Joi.string(),
74+
lang: Joi.string(),
75+
})
76+
),
77+
start_url: Joi.string(),
78+
background_color: Joi.string(),
79+
theme_color: Joi.string(),
80+
display: Joi.string(),
81+
legacy: Joi.boolean(),
82+
include_favicon: Joi.boolean(),
83+
icon: Joi.string(),
84+
theme_color_in_head: Joi.boolean(),
85+
crossOrigin: Joi.string().valid(`use-credentials`, `anonymous`),
86+
cache_busting_mode: Joi.string().valid(`query`, `name`, `none`),
87+
icons: Joi.array().items(
88+
Joi.object({
89+
src: Joi.string(),
90+
sizes: Joi.string(),
91+
type: Joi.string(),
92+
})
93+
),
94+
icon_options: Joi.object({
95+
purpose: Joi.string(),
96+
}),
97+
})
98+
}
99+
}
100+
61101
/**
62102
* Setup pluginOption defaults
103+
* TODO: Remove once pluginOptionsSchema is stable
63104
*/
64105
exports.onPreInit = (_, pluginOptions) => {
65106
pluginOptions.cache_busting_mode = pluginOptions.cache_busting_mode ?? `query`

0 commit comments

Comments
 (0)
Please sign in to comment.