-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
@@ -431,6 +431,7 @@ export const onCreateDevServer = true | |||
|
|||
/** | |||
* Called during `gatsby develop` bootstrap to get and validate a plugins options schema | |||
* @gatsbyVersion 2.24.69 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wow, is the PR only that size? How is it working under the hood?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wow, this is an incredible feature! Thanks for pointing the PR, will study on that 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh -- I mean bump the version locally and then ship this 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's bump that version after we land #27381 and set the minimum version to that!
@@ -431,6 +431,7 @@ export const onCreateDevServer = true | |||
|
|||
/** | |||
* Called during `gatsby develop` bootstrap to get and validate a plugins options schema | |||
* @gatsbyVersion 2.24.69 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this missing the cssLoader validation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mxstbr Any thoughts on this? 🤔
quality: Joi.number() | ||
.default(50) | ||
.description(`The quality level of the generated files.`), | ||
withWebp: Joi.boolean() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we can no longer pass an object with quality config for withWebp
option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woops, it looks something that we missed here. I'll make it back :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Available in #27944 😊
* 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.