Skip to content

Remote.html: Use Playground CLI to produce minified WordPress build - #1416

Closed
adamziel wants to merge 3 commits into
trunkfrom
produce-minified-build-using-playground-cli
Closed

Remote.html: Use Playground CLI to produce minified WordPress build#1416
adamziel wants to merge 3 commits into
trunkfrom
produce-minified-build-using-playground-cli

Conversation

@adamziel

@adamziel adamziel commented May 16, 2024

Copy link
Copy Markdown
Collaborator

Do not merge – explorations in progress

Changes

Uses Playground CLI to produce a minified WordPress build, replacing the custom bash-based WordPres installation flow that relied on wget, unzip, sed, wp-cli etc.

This is to dogfood Playground CLI and put the boot protocol to a practical use. With this PR, CLI Playground produces a minified WordPress version that is later used to boot the web Playground. Eventually, the minification logic could be just a Blueprint instead of a Dockerfile. For now, though, I didn't explore that.

This PR also:

  • in BasePHP, it ensures /internal/shared/auto_prepend_file.php is loaded even when evaling a code snippet and not a file – it turns out that wasn't the case before!
  • Preloads the SQLite integration plugin from /internal in remote.html to avoid polluting the site
  • Runs the WordPress installation wizard if needed

The WordPress installation wizard could likely be punted to another PR to keep the scope smaller.

Remaining work

  • Test the ZIP export/import flow
  • Test the OPFS (browser storage) export/import flow
  • Test the NativeFS export/import flow
  • Test the GitHub export/import flow

Testing instructions

Rebuild the latest WordPress with

rm -rf packages/playground/wordpress-builds/public/wp-6.5
npx nx bundle-wordpress:major-and-beta playground-wordpress-builds

Then run npm run dev and confirm the local Playground loads without any issues.

Related: #1398

@adamziel adamziel mentioned this pull request May 16, 2024
1 task
Base automatically changed from cli-support-custom-wordpress-url to trunk May 17, 2024 08:08
adamziel added 3 commits May 17, 2024 10:09
Do not merge – explorations in progress

Uses Playground CLI to produce a minified WordPress build, replacing
the custom bash-based WordPres installation flow that relied on wget,
unzip, sed, wp-cli etc.

This is to dogfood Playground CLI and put the boot protocol to a
practical use.

With this PR, CLI Playground produces a minified WordPress version that is
later used to boot the web Playground.

Eventually, the minification logic could be just a Blueprint instead of
a Dockerfile. For now, though, I didn't explore that.

 ## Remaining work

To ship this PR, remote.html needs to use the same boot logic as the CLI
Playground and, e.g., install the SQLite integration plugin in the `/internal`
directory. In its current state, this PR just ships a minified WordPress
without that plugin.

 ## Testing instructions

Rebuild the latest WordPress with

```shell
rm -rf packages/playground/wordpress-builds/public/wp-6.5
npx nx bundle-wordpress:major-and-beta playground-wordpress-builds
```

Then run `npm run dev` and confirm the local Playground loads without
any issues.

Related: #1398
@adamziel

Copy link
Copy Markdown
Collaborator Author

Superseded by a series of smaller PRs

@adamziel adamziel closed this May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment