Skip to content

Extract Blueprint v1-specific parts of Playground CLI - #2392

Merged
adamziel merged 8 commits into
trunkfrom
support-blueprints-v2-part1
Jul 21, 2025
Merged

Extract Blueprint v1-specific parts of Playground CLI#2392
adamziel merged 8 commits into
trunkfrom
support-blueprints-v2-part1

Conversation

@adamziel

@adamziel adamziel commented Jul 21, 2025

Copy link
Copy Markdown
Collaborator

Motivation for the change, related issues

This PR sets the stage for integrating Blueprints v2. All the Blueprints v1-specific parts are moved to a new class called BlueprintsV1Handler. This opens the door to implementing BlueprintsV2Handler.

A part of #2223

Testing Instructions (or ideally a Blueprint)

This PR mostly moves code around without changing the logic. Just run a smoke test:

  • Confirm CI is green
  • Run a few CLI commands and confirm they still work, e.g.
PHP=7.4 node --experimental-wasm-jspi --stack-trace-limit=100 --loader=./packages/meta/src/node-es-module-loader/loader.mts ./packages/playground/cli/src/cli.ts server --wp=6.8 --php=8.4

PHP=7.4 node --experimental-wasm-jspi --stack-trace-limit=100 --loader=./packages/meta/src/node-es-module-loader/loader.mts ./packages/playground/cli/src/cli.ts server --mount=.:/wordpress/wp-content/plugins/MY-PLUGIN-DIRECTORY

PHP=7.4 node --experimental-wasm-jspi --stack-trace-limit=100 --loader=./packages/meta/src/node-es-module-loader/loader.mts ./packages/playground/cli/src/cli.ts server --blueprint=my-blueprint.json

And a few others from https://wordpress.github.io/wordpress-playground/developers/local-development/wp-playground-cli

@adamziel
adamziel force-pushed the support-blueprints-v2-part1 branch from 7d64e6d to 76c3dc5 Compare July 21, 2025 18:33
@adamziel
adamziel marked this pull request as ready for review July 21, 2025 18:38
@adamziel
adamziel merged commit 4ca1be9 into trunk Jul 21, 2025
24 of 25 checks passed
@adamziel
adamziel deleted the support-blueprints-v2-part1 branch July 21, 2025 22:31
adamziel added a commit that referenced this pull request Jul 22, 2025
## Motivation for the change, related issues

Adds Blueprints v2 support to Playground CLI via the
`--experimental-blueprints-v2-runner` flag.

A part of #2223

## Implementation details

Following the structure set up in
#2392, this PR
adds:

* A separate worker script `worker-thread-v2.ts` for starting workers
relying on Blueprints V2
* A `BlueprintsV2Handler` class that enables using the new worker from
the main CLI thread

## Testing Instructions (or ideally a Blueprint)

Confirm the `--experimental-blueprints-v2-runner` flag yields output
similar to this – it's produced by the Blueprints v2 runner:

```
$ PHP=7.4 node --loader=./packages/meta/src/node-es-module-loader/loader.mts ./packages/playground/cli/src/cli.ts server --experimental-blueprints-v2-runner --blueprint=https://raw.githubusercontent.com/wordpress/blueprints/refs/heads/trunk/blueprints/custom-post/blueprint.json

Running WP-CLI command: wp post create --post_type=gbtbooks --post_title='WordPress Styling with Blocks, Patterns, Templates, and Themes' --post_content='<!-- wp:paragraph --><p>Explore WordPress styl
Complete – 100.00%
Booted!
WordPress is running on http://127.0.0.1:9400
```

Confirm the CLI still works without the `--experimental-blueprints-v2`
flag:

```
$ PHP=7.4 node --loader=./packages/meta/src/node-es-module-loader/loader.mts ./packages/playground/cli/src/cli.ts server  --blueprint=https://raw.githubusercontent.com/wordpress/blueprints/refs/heads/trunk/blueprints/custom-post/blueprint.json

Starting a PHP server...
Setting up WordPress latest
Resolved WordPress release URL: https://downloads.w.org/release/wordpress-6.8.2.zip
Fetching SQLite integration plugin...
Booting WordPress...
Booted!
Running the Blueprint...
Logging in – 100%
Finished running the blueprint
WordPress is running on http://127.0.0.1:9400
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment