-
Notifications
You must be signed in to change notification settings - Fork 800
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
Synced Newspack Blocks: Update to 4.5.2 #40636
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! Mu Wpcom plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Wpcomsh plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
@@ -61,7 +61,10 @@ then | |||
|
|||
if [[ "$CURRENT_VERSION" == "$NAME" ]]; then | |||
echo "The current version $CURRENT_VERSION of the newspack-blocks is synced." | |||
exit 0 | |||
read -rp "Do you want to proceed anyway? (y/N): " proceed |
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.
If you want you could source the file from the monorepo root tools/includes/proceed_p.sh
to use our fancy function for doing prompts like 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.
Any advantage of sourcing vs a simple read
? :^)
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.
The proceed_p
function handles a bunch of edge cases. It doesn't matter a whole lot though. 🤷
# Warn about the need to use ENT_COMPAT. | ||
echo "Please ensure htmlentities and html_entity_decode use 'ENT_COMPAT'!" | ||
ent_compat_needed=$(grep -rino 'html_entity_decode\|htmlentities' --include="$TARGET/*.php") | ||
if [[ -n $ent_compat_needed ]]; then | ||
echo 'Detected the below instances:' | ||
echo "$ent_compat_needed" | ||
fi |
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.
Won't this be a bunch of noise, since it doesn't actually check if ENT_COMPAT
is already in use?
Ideally we'd let PHPCompatibility.ParameterValues.NewHTMLEntitiesFlagsDefault
detect it, but first they'd have to release a version of PHPCompatibility that contains that rule. 🙁
OTOH, will the .phpcsignore
take care of ignoring that too during the CI run? Is that the only reason this is here?
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.
a bunch of noise
As far as I can see, it's only ever been one line to change, so I don't think it's too much noise. It's in there because the README said it was important to check for, and I figured it'd be helpful to point out places to check vs. assume the user knows what to look for. 🤷
will the
.phpcsignore
take care of ignoring that too during the CI run?
Yeah, the synced folder will be ignored by CI, so it's a manual fix we need to be aware of (though I'm open to alternatives).
That said, I wonder if this is an issue upstream too, at which point a patch there would remove the need to fix it here... 🤔
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.
Yeah, if it needs fixing, the fix really should be upstreamed.
The consequences of not fixing it are that behavior will differ depending on the PHP version, PHP <8.1 vs 8.1+.
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.
Put in a PR upstream: Automattic/newspack-blocks#2010
Once that's merged, I'll remove that task from the script/README. :^)
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.
Removed now instead of waiting: bc7ac12
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.
One issue, and one comment that I thought could use rewording. Otherwise looks reasonable to me.
I didn't review the synced code or the changes to the README.md.
|
||
# Warn about the need to use ENT_COMPAT. | ||
echo "Please ensure htmlentities and html_entity_decode use 'ENT_COMPAT'!" | ||
ent_compat_needed=$(grep -rino 'html_entity_decode\|htmlentities' --include="$TARGET/*.php") |
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.
This doesn't seem to work.
ent_compat_needed=$(grep -rino 'html_entity_decode\|htmlentities' --include="$TARGET/*.php") | |
ent_compat_needed=$(grep -rino 'html_entity_decode\|htmlentities' --include="*.php" "$TARGET") |
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.
Works for me:
--snip--
Please ensure htmlentities and html_entity_decode use 'ENT_COMPAT'!
Detected the below instances:
./src/features/newspack-blocks/synced-newspack-blocks/class-newspack-blocks.php:1104:html_entity_decode
./src/features/newspack-blocks/synced-newspack-blocks/class-newspack-blocks.php:1104:htmlentities
Sync done.
That said, it'll only detect files directly in said folder.
Either way, it should soon be a non-issue.
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.
Upon further thought, no need to wait to remove this: bc7ac12
Co-authored-by: Brad Jorsch <[email protected]>
This updates the synced Newspack Blocks from 4.0.1 to 4.5.2:
https://github.com/Automattic/newspack-blocks/releases/tag/v4.5.2
It also does the following:
README.md
(e.g checks forENT_COMPAT
, Phan baseline updates).eslint.config.mjs
so we only lint the@wordpress/i18n-text-domain
rule..phpcsignore
to the package root so the synced blocks aren't auto-formatted by the pre-commit hook.Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
ENT_COMPAT
check catches as many appropriate matches as possible../bin/sync-newspack-blocks.sh --release=v4.5.2
matches the checked-in files of this branch, with oneENT_COMPAT
exception.