Skip to content

Serve the Playground client.js library on playground.wordpress.net #778

@adamziel

Description

@adamziel

This is an attempt to develop a strategy for consuming Playground.

  • Using the latest @wp-playground/client package from unpkg.com might break the existing sites when the methods change.
  • Using a fixed version might break the existing sites if the remote API changes.
  • Versioning the remote.html API seems like an overly complex maintenance burden.

Let's just have Playground ship its own API client that's compatible with the current version of Playground. It still doesn't address breaking API changes, but that is a separate discussion involving defining stable and unstable APIs.

This will involve an adjustment to the playground.wordpress.net build pipeline:

"build:wasm-wordpress-net": {
"executor": "nx:run-commands",
"options": {
"commands": [
"rimraf --no-preserve-root ./wasm-wordpress-net",
"mkdir ./wasm-wordpress-net",
"cp -r ./blueprints/blueprint-schema.json ./wasm-wordpress-net/",
"cp -r ./remote/* ./wasm-wordpress-net/",
"cp -r ./website/* ./wasm-wordpress-net/",
"cat ./remote/.htaccess > ./wasm-wordpress-net/.htaccess"
],
"cwd": "dist/packages/playground",
"parallel": false
},

Done is:

  • Running nx build:wasm-wordpress-net playground-website yields a build where the client.js library is exposed
  • Any references to client.js coming from unpkg in this repo are updated to talk about https://playground.wordpress.net/client.js instead.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions