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

FSE: Run phpcbf on the synced files to fix text domain #43792

Merged
merged 3 commits into from
Jul 2, 2020

Conversation

akirk
Copy link
Member

@akirk akirk commented Jun 30, 2020

In the current FSE release we have gettext calls with the wrong text domain: https://plugins.trac.wordpress.org/browser/full-site-editing/trunk/newspack-blocks/synced-newspack-blocks/blocks/homepage-articles/view.php#L218

Changes proposed in this Pull Request

  • Fix the text domain of the synced newspack blocks

Testing instructions

cd apps/full-site-editing
yarn run sync:newspack-blocks --branch=master
grep "post author" full-site-editing-plugin/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/view.php

If you receive an error message like ERROR: Referenced sniff "PHPCompatibility" does not exist either put your vendor/bin directory into the path or make sure that you have installed the sniff (for example with composer global require phpcompatibility/php-compatibility).

This should show gettext calls with a parameter full-site-editing, not newspack-blocks.

@matticbot
Copy link
Contributor

@akirk akirk requested review from noahtallen and simison June 30, 2020 12:25
@matticbot
Copy link
Contributor

Caution: This PR affects files in the FSE Plugin on WordPress.com
Please ensure your changes work on WordPress.com before merging.

D45699-code has been created so you can easily test it on your sandbox. See this FieldGuide page about developing in the FSE Plugin for more info: PCYsg-ly5-p2

@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

@simison simison added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jun 30, 2020
@@ -126,6 +126,7 @@ cp -R $CODE/src/components $TARGET/

# Fix the text domain
npx eslint . --fix > /dev/null 2>&1
phpcbf $TARGET
Copy link
Member

@simison simison Jun 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually in bash I see variables like this wrapped with "" but I see that's not the case in lines above. 🙃

Just notion, no need changes.

@akirk akirk requested a review from yuliyan July 1, 2020 07:27
@simison simison requested a review from a team July 1, 2020 07:58
@simison
Copy link
Member

simison commented Jul 1, 2020

@obenland 👋 can you help with the Newspack sync script review?

Copy link
Member

@yuliyan yuliyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, works as described.

Copy link
Collaborator

@wp-desktop wp-desktop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WordPress Desktop CI Failure (ci/wp-desktop): @akirk please re-try this workflow ("Rerun Workflow from Failed") and/or review this PR for breaking changes. Please also ensure this branch is rebased off latest Calypso master.

@wp-desktop wp-desktop dismissed their stale review July 1, 2020 14:06

ci/wp-desktop passing, closing review

@akirk akirk merged commit cf47826 into master Jul 2, 2020
@akirk akirk deleted the fix/fse-php-textdomain branch July 2, 2020 06:24
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 2, 2020
@andrewserong
Copy link
Member

@akirk apologies I didn't catch this sooner, but while testing out the version bump for the FSE plugin in #43857 where I've rebased it to include this PR, it looks like the CI (Github Actions) build is failing on this call to phpcbf. This means that the synced diff doesn't include the change to the text domain. We can run phpcbf manually on the diff, of course, but it'd be good to fix it in CI so that we don't accidentally miss it, particularly if subsequent commits to a PR update the diff. It'd also be great to get failing phpcbf to fail the build, too if we can.

Here's the error I can see in the Build FSE Plugin > Build packages step for #43857:

image

@automattic/full-site-editing: $ check-npm-client && yarn run sync:newspack-blocks --nodemodules
@automattic/full-site-editing: $ check-npm-client && ./bin/sync-newspack-blocks.sh --nodemodules
@automattic/full-site-editing: Syncing files to FSE…
@automattic/full-site-editing: Fixing the text domains…
@automattic/full-site-editing: eslint --fix: done
@automattic/full-site-editing: ./bin/sync-newspack-blocks.sh: line 132: ../../vendor/bin/phpcbf: No such file or directory
@automattic/full-site-editing: phpcbf: !! There was an error executing phpcbf
@automattic/full-site-editing: Updated Newspack version 'v1.7.0'
@automattic/full-site-editing: Sync done.

From looking at the error message, it sounds like the ubuntu-latest environment we're using doesn't have it installed, but it has PHP and composer, so I wonder if we added a step to run composer install before building the packages, if that'd work? @noahtallen just pinging you because you have a lot more experience in this area and recently worked on the Run phpcs step — the challenge here is that we need to be able to use phpcbf well before we're currently using phpcs in the current build steps.

Also, for some reason, in the build for this PR, it looks like the Build packages step was skipped. This is the first time I've looked at the Github Actions for the FSE plugin, so all this is new to me! :)

@andrewserong
Copy link
Member

Update: Alex has resolved this in #43857 by adding the step to install composer in the Github Action before phpcbf is called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants