-
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-source-wordpress): Add searchAndReplace #31091
feat(gatsby-source-wordpress): Add searchAndReplace #31091
Conversation
Also the format function in the main |
Great @jooola! Thanks for transferring it to the main repo. |
The
|
All credits should go to @philmuze, I just cherry picked his work at gatsbyjs/gatsby-source-wordpress-experimental#129
Just rebased on master and formatted code. |
packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/process-node.js
Outdated
Show resolved
Hide resolved
packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/process-node.js
Show resolved
Hide resolved
I replaced the regex literal with a string because prettier could not handle it and Joi does not have a Literal expression type.
If a rebase is need on my side, simply ping me, I'll do it asap. |
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.
Awesome work here :D just a couple tiny changes and then LGTM!
packages/gatsby-source-wordpress/__tests__/process-node.test.js
Outdated
Show resolved
Hide resolved
packages/gatsby-source-wordpress/__tests__/process-node.test.js
Outdated
Show resolved
Hide resolved
packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/process-node.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Tyler Barnes <tylerdbarnes@gmail.com>
Filters are run in order one at a time and if we run it at the end we'll have already done a bunch of image/file processing and manipulation of the node data. Putting this at the end means we wont be able to rewrite our WP URL to a CDN url before Gatsby pulls all the images in from WP.
@TylerBarnes I added a small note about using regular expression literal in the documentation, but somehow I feel this it not enough. So I think it is ready to be merged, but might need some documentation improvement in the future regarding using regular expression literal. |
…_search_replace_links
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.
Thanks for making those changes :) LGTM
packages/gatsby-source-wordpress/__tests__/process-node.test.js
Outdated
Show resolved
Hide resolved
@TylerBarnes I missed some useless escape chars, so lint failed again. I just fixed it. |
packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/process-node.js
Outdated
Show resolved
Hide resolved
The failing tests appear to be unrelated to this PR. Thanks @jooola and @philmuze for this! |
Co-authored-by: Tyler Barnes <tylerdbarnes@gmail.com> Co-authored-by: gatsbybot <mathews.kyle+gatsbybot@gmail.com>
All credits should go to @philmuze, I just cherry picked his work at gatsbyjs/gatsby-source-wordpress-experimental#129
But I don't know how to properly test this feature, didn't see any obvious testing framework.
Description
Add a search and replace feature to replace strings or regex rule with a substitute string.
Documentation
See changes in the
docs/
folder.Related Issues
gatsbyjs/gatsby-source-wordpress-experimental#129