Skip to content
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

fix(gatsby-source-wordpress): Remove search and replace regex literal recommendation #31413

Merged
merged 4 commits into from
May 18, 2021
Merged

fix(gatsby-source-wordpress): Remove search and replace regex literal recommendation #31413

merged 4 commits into from
May 18, 2021

Conversation

jooola
Copy link
Contributor

@jooola jooola commented May 13, 2021

A regular expression literal generate a RegExp object at compile time. We need to allow string or object in the option schema.

EDIT: I decided to remove the documentation entry recommending a Regex literal, instead of the above solution.

Improvements can be made in the future.

cc @TylerBarnes

Related Issues

Fix #31411
Related to #31091

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 13, 2021
@jooola
Copy link
Contributor Author

jooola commented May 13, 2021

@TylerBarnes Using Joi.alternatives() does not play well with the documentation, what should we do ?

I could add some extra code in the docs generation script, or force somehow the type to be a String, but using trueType in the meta did not work.

Any ideas ? Thoughts ?

Maybe this should be a blocker, before the searchAndReplace feature is released to the public as stable.

@jooola
Copy link
Contributor Author

jooola commented May 13, 2021

Does gatsby generate a graphql schema for the plugin options, and make it accessible from graphql ? If yes this means we cannot use Joi.alternatives ?

Should we simply remove the sentence saying we recommend regex expression literal ?

@jooola jooola changed the title fix(gatsby-source-wordpress): Allow regexp object option fix(gatsby-source-wordpress): Remove regexp literal option May 13, 2021
@jooola
Copy link
Contributor Author

jooola commented May 13, 2021

I finally simply removed the documentation string saying a regular expression literal was recommended.

@jooola jooola changed the title fix(gatsby-source-wordpress): Remove regexp literal option fix(gatsby-source-wordpress): Remove search and replace regex literal recommendation May 13, 2021
@LekoArts LekoArts added topic: source-wordpress Related to Gatsby's integration with WordPress and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels May 17, 2021
@jooola
Copy link
Contributor Author

jooola commented May 17, 2021

Commited your change, rebased, should be good to go.

@TylerBarnes TylerBarnes merged commit 51bc94b into gatsbyjs:master May 18, 2021
@TylerBarnes
Copy link
Contributor

Thanks @jooola !

@jooola
Copy link
Contributor Author

jooola commented May 18, 2021

My pleasure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: source-wordpress Related to Gatsby's integration with WordPress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gatsby-source-wordpress searchAndReplace[0].search must be a string
3 participants