Skip to content

Remove raw WordPress files from this repository #16

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

Closed
adamziel opened this issue Sep 22, 2022 · 1 comment
Closed

Remove raw WordPress files from this repository #16

adamziel opened this issue Sep 22, 2022 · 1 comment

Comments

@adamziel
Copy link
Collaborator

adamziel commented Sep 22, 2022

There is a few different copies of WordPress shipped in this repo. Let's remove the physical copies and download these files as a part of the build/bundle pipeline.

In particular:

  • src/node/wordpress – this can be generated when missing during the initial npm run dev:node
  • dist-node/wordpress – this can be bundled during the node build process
  • Optionally: dist/wordpress-* – these are WordPress static files required to use the browser version via npm run dev. There should be a universal way to regenerate them on npm run dev:web.

However, let's leave dist/wp.data and dist/wp.js in place. Regenerating these files requires a docker setup and could be a significant speed bump for new developers trying to just clone and run this repo.

@adamziel adamziel mentioned this issue Oct 22, 2022
adamziel added a commit that referenced this issue Oct 22, 2022
Restructures the repository as monorepo and separates the PHP implementation from the WordPress-specific bits. The new packages:

* **php-wasm** – low-level WASM PHP primitives
    * A configurable PHP build pipeline for different targets (web, node.js, standalone)
    * A low-level `PHP` JavaScript class with `eval` for executing PHP code and FS utils like `writeFile` for runtime managing the
    * A `PHPServer` JavaScript class for dispatching HTTP requests – both to run the PHP files AND to download static files
    * A `PHPBrowser` JavaScript class to consume the above using an iframe
* **php-wasm-browser** – a high-level layer to efficiently run `php-wasm` in the browser
    * `service-worker` utilities to redirect the browser traffic to `PHPServer`
    * `worker-thread` utilities to offload the `PHPServer` to a separate process. Three backends are available: Iframe, Webworker, SharedWorker.
    * A messaging layer and setup helpers to connect the above.
    * Server utilities to serve the correct headers for the `wasm` files via `.htaccess`.
* **wordpress-wasm** – WordPress-specific WASM PHP bindings for web and node.js
    * The required WordPress-specific setup like constants and filters
    * `wp.data` bundling pipeline for the web configurable to bundle custom code
    * WordPress API to ease common tasks like login, install a plugin, start a block editor with specific settings and content
    * A `fetch`-based transport for HTTP requests
    * An example app demonstrating WordPress in the browser. Let's eventually extract it into a separate package or at least a directory.

Other, general notes:

* Pre-built binaries are shipped in the global `build` directory – it would be nice to either move them to their specific packages, or remove them from the repo completely and download them from somewhere on the initial build.
* `esbuild` is used to build each packages and then the entire app.
* Gulp is used for orchestration. Perhaps https://nx.dev/ would make a good replacement in the future.
* There is no package publishing process yet. Perhaps Lerna would make a good one?

Solves #51 and #16
@adamziel
Copy link
Collaborator Author

Done in #57

@adamziel adamziel changed the title Remove WordPress files from this repository Remove raw WordPress files from this repository Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant