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

WIP: Update playground dependencies to v0.9.X #345

Closed
wants to merge 1 commit into from

Conversation

sejas
Copy link
Collaborator

@sejas sejas commented Aug 1, 2024

What?

Let's update Playground dependencies to the latest version.

We may need to update other projects like Playground Plugin.

Why?

It will fix WBEP images, support curl and other fixes features introduced in these versions.

How?

  • We need to update the dependencies and adapt the breaking changes to use the new functions.

Testing Instructions

  • Run npx nx build wp-now && node dist/packages/wp-now/cli.js start
  • Observe Playground opens correctly in the browser.

@sejas sejas changed the title WIP: Update playground dependencies in package WIP: Update playground dependencies to v0.9.X Aug 1, 2024
@sejas sejas self-assigned this Aug 1, 2024
@swissspidy
Copy link
Member

Would love to be able to use the new version via wp-now 😊

@eliot-akira
Copy link
Contributor

eliot-akira commented Aug 23, 2024

I wanted to contribute to this pull request, and have started looking at what's needed to update Playground dependencies from 0.6.16 (current) to 0.9.31 (newest). I can try working on this if you could advise/review? @sejas @adamziel


After installing the new versions, there are 29 failing tests. From the error messages and studying the code/tests of PHP-WASM modules, I learned a few things.

My fork of this PR branch shows the progress so far.

update/playground-dependencies...eliot-akira:playground-tools:update/playground-dependencies

(I wasn't sure if I should create a new pull request, or if this current PR can have multiple authors. I'm guessing the latter is not possible since I don't have write access to the PR branch, update/playground-dependencies.)


The tests run a little further now (25 fails) but php.mount() is not working yet. It throws:

ErrnoError {
  name: 'ErrnoError',
  errno: 44,
  stack: '<generic error, no stack>'
}

One thing I noticed is, the php.mount() method is async (defined here in @php-wasm/universal) and I'm awaiting it - but elsewhere it's being used, like in this test for @php-wasm/node, it's always called without await.


There are a couple places where the code was previously applying a callback to all PHP instances, but the new PHPRequestHandler.processManager doesn't provide access to them. PHPProcessManager.allInstances is a private property, probably for a good reason - maybe it's no longer necessary (or possible) to manage the instances manually.


During the process I learned about Playground CLI (WordPress/wordpress-playground#1289) and the new Boot Protocol (WordPress/wordpress-playground#1390). I can see these are generalizing and modularizing some features of wp-now, as well as parts of the build process for the Playground itself.

The @wp-playground/cli module and bootWordPress() are good up-to-date references of how to use the PHP class properly. I'm comparing it with wp-now to understand what needs to be updated.

@adamziel
Copy link
Collaborator

@eliot-akira AFAIR you got all the major changes right. Here's a major non-breaking change that could help with managing workers:

WordPress/wordpress-playground#1669

@eliot-akira
Copy link
Contributor

Thank you, I'll keep chipping away at this. I've continued studying the source of @php-wasm/node, universal, and @wp-playground/wordpress. I think I can eventually figure out how to update wp-now and pass all existing tests.

@eliot-akira
Copy link
Contributor

OK, I got it down to 3 failing tests.

I created a new pull request from my forked branch, since the scope is narrower than this one (update wp-now only instead of all packages in playground-tools) and I wanted to show the test error messages.

@sejas
Copy link
Collaborator Author

sejas commented Sep 2, 2024

Great work @eliot-akira ! 🙌 , thanks for helping on this. I'm back from holidays and catching up. I'll review the PR in the next days.
The team has also updated the dependencies for Studio: Automattic/studio#491

@sejas sejas closed this Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants