-
Notifications
You must be signed in to change notification settings - Fork 304
Add @wp-playground/wordpress package – a new home for WordPress builds #837
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It seems to be working!
I'll let it sit for a bit. If noone spots any blockers, let's rebase and merge 🤞 |
To use real WordPress in unit tests, we need to import it from somewhere. At the moment, there is no easy way to do it without running into a circular dependency problem. This PR adds a new module that has no explicit import dependencies to solve that problem. It still does have an implicit path-based dependency on the remote package, which isn't ideal. Perhaps the build WordPress files could be moved to yet another dependency-free module such as wp-playground/wordpress and the remote package would use those files in its build process.
…etWordPressModule() works
…w wordpress package
…d in the final build
f4c8b2c
to
3964449
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Tests
[Type] Enhancement
New feature or request
[Type] Reliability
Playground uptime, reliability, not crashing
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Important
Don't be scared by the File Changed: 5,000+ message at the top. This PR can be reviewed just fine.
Most of the updates refer to moved WordPress static assets. The actual relevant changes proposed in this PR are small configuration updates in about 50 files.
Moves WordPress data modules to a new dependency-free module
@wp-playground/wordpress
. Now every Playground module may import WordPress data modules and, e.g., use them in unit tests.Before this PR, WordPress data modules lived in the
@wp-playground/remote
package. They couldn't be easily imported, and even if they could, that would often create a circular dependency problem.Related to #463
Implementation details
@wp-playground/remote
public directory is now set topackages/playground/wordpress/public
as that's where all the WordPress files live. Theremote
package ships no public assets of its own, except for the .htaccess file which is now handled by a dedicated plugin.RecommendedPHPVersion = '8.0'
to help avoid hardcoding a version number in unit tests shipped by other Playground packages.@wp-playground/wordpress
has abundle-wordpress
nx task that bundles WordPress. It's deliberately not calledbuild
so that nx does not mistake it for a build dependency (which would trigger it on everynpm run dev
).@php-wasm/node
by implementing thegetPreloadedPackage
Emscripten handler. The handler runs a few safety checks and then reads the data module from the disk viareadFileSync
.setSiteOptions()
Blueprint step has been added to confirm that WordPress is actually correctly loaded in Node.js.Remaining tasks
bundle
task to confirm it creates the correct WordPress files in the correct directories.setSiteOption
test)Testing instructions
Confirm the CI tests pass. E2E tests will confirm the playground.wordpress.net website still loads all the supported WordPress versions, and the unit tests will confirm that WordPress is correctly loaded in Node.js.