feat(gatsby): release plugin option validation#27437
Conversation
This will make Gatsby prompt users on old versions of gatsby that don't support the API to upgrade to the new version.
|
|
||
| /** | ||
| * Called during `gatsby develop` bootstrap to get and validate a plugins options schema | ||
| * @gatsbyVersion 2.24.69 |
There was a problem hiding this comment.
Oh wow, is the PR only that size? How is it working under the hood?
There was a problem hiding this comment.
Oh wow, this is an incredible feature! Thanks for pointing the PR, will study on that 🚀
There was a problem hiding this comment.
Sorry, I'm not quite following... How are users meant to upgrade to 2.25.0 if it doesn't exist yet? 🤔
There was a problem hiding this comment.
Oh -- I mean bump the version locally and then ship this 🚀
There was a problem hiding this comment.
Let's bump that version after we land #27381 and set the minimum version to that!
|
|
||
| /** | ||
| * Called during `gatsby develop` bootstrap to get and validate a plugins options schema | ||
| * @gatsbyVersion 2.24.69 |
There was a problem hiding this comment.
Note that this is going to need to be bumped to whatever version is the first to include the .default()s support from #27381 (which isn't merged yet).
|
This is ready to go! Will need to publish this as |
| ) | ||
| .description(`This plugin resolves url() paths relative to the entry SCSS/Sass file not – as might be expected – the location relative to the declaration. Under the hood, it makes use of sass-loader and this is documented in the readme. | ||
| const MATCH_ALL_KEYS = /^/ | ||
| exports.pluginOptionsSchema = function ({ Joi }) { |
There was a problem hiding this comment.
Isn't this missing the cssLoader validation?
There was a problem hiding this comment.
Great catch! Would appreciate if you open an issue 🙏
|
Any specific reason that My Gatsby projects broke today, due to these changes. |
| if (process.env.GATSBY_EXPERIMENTAL_PLUGIN_OPTION_VALIDATION) { | ||
| await validateConfigPluginsOptions(config, rootDir) | ||
| } | ||
| await validateConfigPluginsOptions(config, rootDir) |
There was a problem hiding this comment.
@mxstbr Isn't this technically a breaking change for all plugins when they remove the feature flag? 🤔
Since these plugins won't work anymore with older gatsby versions, because it now errors out with the message to upgrade.
So if that's correct, the peerDependency of all plugins that remove the feature flag should be updated to gatsby@^2.25.0 (which is a breaking change) or am I forgetting something?
| quality: Joi.number() | ||
| .default(50) | ||
| .description(`The quality level of the generated files.`), | ||
| withWebp: Joi.boolean() |
There was a problem hiding this comment.
It looks like we can no longer pass an object with quality config for withWebp option?
There was a problem hiding this comment.
Woops, it looks something that we missed here. I'll make it back :)
* chore(gatsby): add @gatsbyVersion pragma to pluginOptionsSchema Node API This will make Gatsby prompt users on old versions of gatsby that don't support the API to upgrade to the new version. * 2.25.0! * Remove GATSBY_EXPERIMENTAL_PLUGIN_OPTION_VALIDATION feature flag * Fix incorrect option in gatsby-admin; * Fix tests * Remove obsolete snapshots * Trigger Build * Remove flag from remark-autolink-headers * Fix gatsby-plugin-mdx default
Merging and publishing this PR releases plugin option validation once we're ready! 🎉
gatsby@2.25.0, i.e. a minor version.