This repository has been archived by the owner on Dec 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: Requires Node@>=12.13.x BREAKING CHANGE: Requires Gatsby@^3.x
- Loading branch information
1 parent
7684232
commit 8432152
Showing
4 changed files
with
29 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,26 @@ | ||
if (process.env.GATSBY_EXPERIMENTAL_PLUGIN_OPTION_VALIDATION) { | ||
const getDeprecatedOptions = ({ Joi }) => | ||
["round", "tall"].reduce( | ||
(allOptions, option) => ({ | ||
...allOptions, | ||
[option]: Joi.boolean() | ||
.forbidden() | ||
.messages({ | ||
"any.unknown": `'${option}' is no longer supported. Use 'saveButton.${option}' instead by setting it to the same value you had before on '${option}'.`, | ||
}), | ||
}), | ||
{}, | ||
); | ||
const getDeprecatedOptions = ({ Joi }) => | ||
["round", "tall"].reduce( | ||
(allOptions, option) => ({ | ||
...allOptions, | ||
[option]: Joi.boolean() | ||
.forbidden() | ||
.messages({ | ||
"any.unknown": `'${option}' is no longer supported. Use 'saveButton.${option}' instead by setting it to the same value you had before on '${option}'.`, | ||
}), | ||
}), | ||
{}, | ||
); | ||
|
||
exports.pluginOptionsSchema = ({ Joi }) => | ||
Joi.object({ | ||
...getDeprecatedOptions({ Joi }), | ||
saveButton: Joi.alternatives() | ||
.try( | ||
Joi.boolean(), | ||
Joi.object({ | ||
round: Joi.boolean().default(false), | ||
tall: Joi.boolean().default(true), | ||
}), | ||
) | ||
.default(false), | ||
}); | ||
} else { | ||
const deprecationWarning = `[gatsby-plugin-pinterest] From now on, you should use the 'saveButton' option to show Pinterest's save button on images. | ||
See https://github.com/robinmetral/gatsby-plugin-pinterest#usage`; | ||
|
||
exports.onPreInit = ({ reporter }, { round, tall } = {}) => { | ||
if (round || tall) { | ||
reporter.warn(deprecationWarning); | ||
} | ||
}; | ||
} | ||
exports.pluginOptionsSchema = ({ Joi }) => | ||
Joi.object({ | ||
...getDeprecatedOptions({ Joi }), | ||
saveButton: Joi.alternatives() | ||
.try( | ||
Joi.boolean(), | ||
Joi.object({ | ||
round: Joi.boolean().default(false), | ||
tall: Joi.boolean().default(true), | ||
}), | ||
) | ||
.default(false), | ||
}); |
This file was deleted.
Oops, something went wrong.