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

Add jetpack-composer-plugin to wpcomsh and mu-wpcom-plugin #41185

Merged

Conversation

anomiex
Copy link
Contributor

@anomiex anomiex commented Jan 20, 2025

Proposed changes:

The wp i18n command ignores files under vendor/, on the assumption that Composer packages probably aren't using WordPress's i18n functions. This doesn't hold true for many of our packages, such as jetpack-mu-wpcom.

Our workaround for that is a Composer plugin that installs "jetpack-library" packages under jetpack_vendor/ instead, which wp i18n does not ignore.

See Problem 5 at
https://developer.wordpress.com/2022/01/06/wordpress-plugin-i18n-webpack-and-composer/ for details.

Presumably we don't need to worry about Problem 6 for these plugins, as they're only used on WordPress.com and we'd presumably have heard about it already if that problem wasn't worked around somehow at the platform level there.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

p1737162933817909-slack-C05Q5HSS013
Related to p58i-jdp-p2 and 170251-ghe-Automattic/wpcom

Does this pull request change what data or activity we track or use?

No

Testing instructions:

  • CI happy?
  • Check build artifacts. Files should be moved from vendor/ to jetpack_vendor/.
  • Stuff should work the same as it did before.

The `wp i18n` command ignores files under `vendor/`, on the assumption
that Composer packages probably aren't using WordPress's i18n functions.
This doesn't hold true for many of our packages, such as
`jetpack-mu-wpcom`.

Our workaround for that is a Composer plugin that installs
"jetpack-library" packages under `jetpack_vendor/` instead, which
`wp i18n` does not ignore.

See Problem 5 at
https://developer.wordpress.com/2022/01/06/wordpress-plugin-i18n-webpack-and-composer/
for details.

Presumably we don't need to worry about Problem 6 for these plugins, as
they're only used on WordPress.com and we'd presumably have heard about
it already if that problem wasn't worked around somehow at the platform
level there.
@anomiex anomiex added [Type] Bug When a feature is broken and / or not performing as intended [Status] Needs Review A Jetpack Crew expert's review is needed. Typically for significant changes to core functionality. [Pri] Normal labels Jan 20, 2025
@anomiex anomiex requested a review from a team January 20, 2025 16:03
@anomiex anomiex self-assigned this Jan 20, 2025
@github-actions github-actions bot added [Plugin] mu wpcom jetpack-mu-wpcom plugin [Plugin] Wpcomsh labels Jan 20, 2025
Copy link
Contributor

github-actions bot commented Jan 20, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Choose a review path based on your changes:
    • A. Team Review: add the "[Status] Needs Team Review" label
      • For most changes, including minor cross-team impacts.
      • Example: Updating a team-specific component or a small change to a shared library.
    • B. Crew Review: add the "[Status] Needs Review" label
      • For significant changes to core functionality.
      • Example: Major updates to a shared library or complex features.
    • C. Both: Start with Team, then request Crew
      • For complex changes or when you need extra confidence.
      • Example: Refactor affecting multiple systems.
  3. Get at least one approval before merging.

Still unsure? Reach out in #jetpack-developers for guidance!


Mu Wpcom plugin:

  • Next scheduled release: WordPress.com Simple releases happen semi-continuously (PCYsg-Jjm-p2).

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Wpcomsh plugin:

  • Next scheduled release: Atomic deploys happen twice daily on weekdays (p9o2xV-2EN-p2).

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@anomiex
Copy link
Contributor Author

anomiex commented Jan 20, 2025

Looks like deploying this one to Simple may be a pain. I'll probably want to add in the following:

  • In the update diff, create symlinks from vendor/automattic/* to jetpack_vendor/automattic/*. And vice versa in the active directory.
  • In the switch diff, also update a bunch of require_onces to look in jetpack_vendor/. The symlinks should prevent any mid-upgrade fatals.

Copy link
Contributor

@tbradsha tbradsha left a comment

Choose a reason for hiding this comment

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

Looks like a reasonable iteration toward the goal. I'm not sure I understand the failed WP.com tests, though...e.g. why would linting be complaining?

@anomiex
Copy link
Contributor Author

anomiex commented Jan 23, 2025

All the wpcom test failures are because of files like wp-content/mu-plugins/masterbar.php that are doing like

require_once JETPACK_MU_WPCOM_PLUGIN_LOADER_PATH . '/vendor/automattic/jetpack-masterbar/src/wp-posts-list/bootstrap.php';

which will need to be changed to /jetpack_vendor/ (i.e. the second bullet in my comment above).

@anomiex anomiex merged commit cac5e60 into trunk Jan 23, 2025
59 of 60 checks passed
@anomiex anomiex deleted the add/jetpack-composer-plugin-to-wpcomsh-and-mu-wpcom-plugin branch January 23, 2025 19:11
@github-actions github-actions bot removed the [Status] Needs Review A Jetpack Crew expert's review is needed. Typically for significant changes to core functionality. label Jan 23, 2025
lezama pushed a commit that referenced this pull request Jan 24, 2025
)

The `wp i18n` command ignores files under `vendor/`, on the assumption
that Composer packages probably aren't using WordPress's i18n functions.
This doesn't hold true for many of our packages, such as
`jetpack-mu-wpcom`.

Our workaround for that is a Composer plugin that installs
"jetpack-library" packages under `jetpack_vendor/` instead, which
`wp i18n` does not ignore.

See Problem 5 at
https://developer.wordpress.com/2022/01/06/wordpress-plugin-i18n-webpack-and-composer/
for details.

Presumably we don't need to worry about Problem 6 for these plugins, as
they're only used on WordPress.com and we'd presumably have heard about
it already if that problem wasn't worked around somehow at the platform
level there.
coder-karen pushed a commit that referenced this pull request Jan 24, 2025
)

The `wp i18n` command ignores files under `vendor/`, on the assumption
that Composer packages probably aren't using WordPress's i18n functions.
This doesn't hold true for many of our packages, such as
`jetpack-mu-wpcom`.

Our workaround for that is a Composer plugin that installs
"jetpack-library" packages under `jetpack_vendor/` instead, which
`wp i18n` does not ignore.

See Problem 5 at
https://developer.wordpress.com/2022/01/06/wordpress-plugin-i18n-webpack-and-composer/
for details.

Presumably we don't need to worry about Problem 6 for these plugins, as
they're only used on WordPress.com and we'd presumably have heard about
it already if that problem wasn't worked around somehow at the platform
level there.
CodeyGuyDylan pushed a commit that referenced this pull request Jan 28, 2025
)

The `wp i18n` command ignores files under `vendor/`, on the assumption
that Composer packages probably aren't using WordPress's i18n functions.
This doesn't hold true for many of our packages, such as
`jetpack-mu-wpcom`.

Our workaround for that is a Composer plugin that installs
"jetpack-library" packages under `jetpack_vendor/` instead, which
`wp i18n` does not ignore.

See Problem 5 at
https://developer.wordpress.com/2022/01/06/wordpress-plugin-i18n-webpack-and-composer/
for details.

Presumably we don't need to worry about Problem 6 for these plugins, as
they're only used on WordPress.com and we'd presumably have heard about
it already if that problem wasn't worked around somehow at the platform
level there.
d-alleyne added a commit that referenced this pull request Feb 18, 2025
A recent change renamed `vendor/` to `jetpack_vendor/`, causing mismatches
in generated MD5 hashes and resulting in missing translation JSON files.
#41185
d-alleyne added a commit that referenced this pull request Feb 18, 2025
* Fix: Ensure correct MD5 hash lookup for script translation files

A recent change renamed `vendor/` to `jetpack_vendor/`, causing mismatches
in generated MD5 hashes and resulting in missing translation JSON files.
#41185
matticbot pushed a commit to Automattic/jetpack-storybook that referenced this pull request Feb 18, 2025
* Fix: Ensure correct MD5 hash lookup for script translation files

A recent change renamed `vendor/` to `jetpack_vendor/`, causing mismatches
in generated MD5 hashes and resulting in missing translation JSON files.
Automattic/jetpack#41185

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/13396644819

Upstream-Ref: Automattic/jetpack@e8cf9c2
matticbot pushed a commit to Automattic/jetpack-mu-wpcom that referenced this pull request Feb 18, 2025
* Fix: Ensure correct MD5 hash lookup for script translation files

A recent change renamed `vendor/` to `jetpack_vendor/`, causing mismatches
in generated MD5 hashes and resulting in missing translation JSON files.
Automattic/jetpack#41185

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/13396644819

Upstream-Ref: Automattic/jetpack@e8cf9c2
matticbot pushed a commit to Automattic/jetpack-mu-wpcom-plugin that referenced this pull request Feb 18, 2025
* Fix: Ensure correct MD5 hash lookup for script translation files

A recent change renamed `vendor/` to `jetpack_vendor/`, causing mismatches
in generated MD5 hashes and resulting in missing translation JSON files.
Automattic/jetpack#41185

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/13396644819

Upstream-Ref: Automattic/jetpack@e8cf9c2
matticbot pushed a commit to Automattic/wpcom-site-helper that referenced this pull request Feb 18, 2025
* Fix: Ensure correct MD5 hash lookup for script translation files

A recent change renamed `vendor/` to `jetpack_vendor/`, causing mismatches
in generated MD5 hashes and resulting in missing translation JSON files.
Automattic/jetpack#41185

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/13396644819

Upstream-Ref: Automattic/jetpack@e8cf9c2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] mu wpcom jetpack-mu-wpcom plugin [Plugin] Wpcomsh [Pri] Normal [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants