@wp-playground/cli 1.0.27 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -0
- package/package.json +9 -9
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# WordPress Playground CLI
|
|
2
|
+
|
|
3
|
+
A CLI tool for running WordPress playground locally instead of in the browser:
|
|
4
|
+
|
|
5
|
+
```shell
|
|
6
|
+
$ bun packages/playground/cli/src/cli.ts server --wp=6.5
|
|
7
|
+
WordPress is running on http://127.0.0.1:9400
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Playground CLI is simple, configurable, and unopinionated. You can set it up
|
|
11
|
+
to your unique WordPress setup. For example, this command would run the documentation
|
|
12
|
+
workflow at https://github.com/adamziel/playground-docs-workflow:
|
|
13
|
+
|
|
14
|
+
```shell
|
|
15
|
+
bun --config=/Users/adam/.bunfig.toml \
|
|
16
|
+
./packages/playground/cli/src/cli.ts \
|
|
17
|
+
server \
|
|
18
|
+
--mount=./wp-content/plugins/wp-docs-plugin:/wordpress/wp-content/plugins/wp-docs-plugin \
|
|
19
|
+
--mount=./wp-content/html-pages:/wordpress/wp-content/html-pages \
|
|
20
|
+
--mount=./wp-content/uploads:/wordpress/wp-content/uploads \
|
|
21
|
+
--mount=./wp-content/themes/playground-docs:/wordpress/wp-content/themes/playground-docs \
|
|
22
|
+
--blueprint=./wp-content/blueprint-wp-now.json \
|
|
23
|
+
--wp=6.5
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
It is long, sure, but it is also very flexible. If you need a shorter version, you can alias
|
|
27
|
+
it or write a bash script. In the future, Blueprints might support relative path mappings,
|
|
28
|
+
at which point that command would get much shorter.
|
|
29
|
+
|
|
30
|
+
## Philosophy
|
|
31
|
+
|
|
32
|
+
The data flow is as follows:
|
|
33
|
+
|
|
34
|
+
- Start PHP
|
|
35
|
+
- Mount any local directories
|
|
36
|
+
- Put a fresh WordPress in the resulting virtual filesystem (unless you're mounting directly at /wordpress).
|
|
37
|
+
- Run the Blueprint
|
|
38
|
+
- Start a local server, accept requests
|
|
39
|
+
|
|
40
|
+
On each run, a fresh WordPress release is unzipped in the virtual filesystem. It is sourced
|
|
41
|
+
from a zip file cached at ~/.wordpress-playground/. If you mess up your site, just restart the
|
|
42
|
+
server and you'll get a fresh one, again unzipped. The CLI tool never modifies the zip file
|
|
43
|
+
so you can always be sure you're starting from a clean slate.
|
|
44
|
+
|
|
45
|
+
## Future work
|
|
46
|
+
|
|
47
|
+
The CLI tool will have the following commands:
|
|
48
|
+
|
|
49
|
+
- `server` - start a fresh WordPress playground server.
|
|
50
|
+
- `build-snapshot` - run a Blueprint and output a .zip file with the resulting WordPress instance.
|
|
51
|
+
- `run-blueprint` - run a Blueprint and output errors to the console if they occur.
|
|
52
|
+
|
|
53
|
+
It will also support:
|
|
54
|
+
|
|
55
|
+
- Loading Blueprints from URLs.
|
|
56
|
+
- Saving the running WordPress site and loading it later.
|
|
57
|
+
- Caching all remote resources referenced in Blueprints. Currently, say, plugins are downloaded on each run.
|
|
58
|
+
|
|
59
|
+
Conceptually, this isn't too different from Docker containers. There are images (zip files),
|
|
60
|
+
containers (running instances), and commands (Blueprints). Playground could support the same
|
|
61
|
+
concepts such as:
|
|
62
|
+
|
|
63
|
+
- Listing and managing available images and containers.
|
|
64
|
+
- Saving a running container and restoring it later
|
|
65
|
+
- Starting a container from a specific image (already supported via zip files)
|
|
66
|
+
- Running a command in a container (the `php` command)
|
|
67
|
+
- Building a new image from a Blueprint (the `build` command)
|
|
68
|
+
- Step-by-step cache for Blueprints so that only the changed steps are re-run.
|
|
69
|
+
|
|
70
|
+
## Interoperability
|
|
71
|
+
|
|
72
|
+
This CLI package is not just a useful tool. It drives interoperability between the in-browser
|
|
73
|
+
Playground, CLI packages, and the PHP Blueprints library. Once complete, it will reuse the
|
|
74
|
+
same internals as the website at https://playground.wordpress.org whether we're talking about
|
|
75
|
+
running PHP code, executing Blueprints, building snapshots, serving requests, or maintaining
|
|
76
|
+
multiple PHP instances
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-playground/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.28",
|
|
4
4
|
"description": "WordPress Playground CLI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"type": "module",
|
|
24
24
|
"main": "main.js",
|
|
25
25
|
"bin": "wp-playground.js",
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "ed7171a91717c70dd7162e3d93283f66d21c001d",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"ajv": "8.12.0",
|
|
29
29
|
"async-lock": "1.4.1",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"wasm-feature-detect": "1.8.0",
|
|
48
48
|
"ws": "8.18.0",
|
|
49
49
|
"yargs": "17.7.2",
|
|
50
|
-
"@php-wasm/universal": "1.0.
|
|
51
|
-
"@php-wasm/logger": "1.0.
|
|
52
|
-
"@wp-playground/blueprints": "1.0.
|
|
53
|
-
"@php-wasm/progress": "1.0.
|
|
54
|
-
"@php-wasm/node": "1.0.
|
|
55
|
-
"@wp-playground/common": "1.0.
|
|
56
|
-
"@wp-playground/wordpress": "1.0.
|
|
50
|
+
"@php-wasm/universal": "1.0.28",
|
|
51
|
+
"@php-wasm/logger": "1.0.28",
|
|
52
|
+
"@wp-playground/blueprints": "1.0.28",
|
|
53
|
+
"@php-wasm/progress": "1.0.28",
|
|
54
|
+
"@php-wasm/node": "1.0.28",
|
|
55
|
+
"@wp-playground/common": "1.0.28",
|
|
56
|
+
"@wp-playground/wordpress": "1.0.28"
|
|
57
57
|
}
|
|
58
58
|
}
|