@wp-playground/cli 3.1.36 → 3.1.39
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 +93 -20
- package/cli.cjs +1 -1
- package/cli.js +1 -1
- package/index.cjs +1 -1
- package/index.js +1 -1
- package/package.json +17 -16
- package/{run-cli-B5GdKs2V.js → run-cli-B6snvP5v.js} +3 -2
- package/{run-cli-B5GdKs2V.js.map → run-cli-B6snvP5v.js.map} +1 -1
- package/{run-cli-BCIvTpD9.cjs → run-cli-CsqeBu36.cjs} +3 -3
- package/{run-cli-BCIvTpD9.cjs.map → run-cli-CsqeBu36.cjs.map} +1 -1
- package/sqlite-database-integration.zip +0 -0
- package/worker-thread-v1.cjs +1 -1
- package/worker-thread-v1.js +1 -1
- package/worker-thread-v2.cjs +1 -1
- package/worker-thread-v2.js +1 -1
package/README.md
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
# WordPress Playground CLI
|
|
2
2
|
|
|
3
|
-
`@wp-playground/cli`
|
|
3
|
+
`@wp-playground/cli` runs WordPress locally with WordPress Playground. It is
|
|
4
|
+
the recommended replacement for the deprecated `@wp-now/wp-now` package: no
|
|
5
|
+
Docker, MySQL, or Apache are required.
|
|
4
6
|
|
|
5
7
|
# Table of contents
|
|
6
8
|
|
|
7
9
|
- [Requirements](#requirements)
|
|
8
10
|
- [Quickstart](#quickstart)
|
|
9
11
|
- [Usage](#usage)
|
|
12
|
+
- [Migrating from wp-now](#migrating-from-wp-now)
|
|
10
13
|
- [Working with Blueprints](#working-with-blueprints)
|
|
11
14
|
- [Contributing](#contributing)
|
|
12
15
|
|
|
@@ -16,45 +19,70 @@ The Playground CLI requires Node.js 20.18 or higher, which is the recommended Lo
|
|
|
16
19
|
|
|
17
20
|
## Quickstart
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
For most local development workflows, use the `start` command:
|
|
20
23
|
|
|
21
24
|
```bash
|
|
22
25
|
cd my-plugin-or-theme-directory
|
|
23
|
-
npx @wp-playground/cli
|
|
26
|
+
npx @wp-playground/cli@latest start
|
|
24
27
|
```
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
`start` automatically detects whether the current directory is a plugin, theme,
|
|
30
|
+
`wp-content` directory, or WordPress installation. It also persists the site
|
|
31
|
+
between runs and opens the browser by default.
|
|
32
|
+
|
|
33
|
+
Use `server` when you need explicit, low-level control over mounts, storage, or
|
|
34
|
+
CI setup:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx @wp-playground/cli@latest server --auto-mount
|
|
38
|
+
```
|
|
27
39
|
|
|
28
40
|
## Usage
|
|
29
41
|
|
|
30
42
|
You don't have to install `@wp-playground/cli`, you can run it directly with `npx`. This is the recommended way to use the CLI and requires no permanent installation. To run a vanilla WordPress website, you can run the command:
|
|
31
43
|
|
|
32
44
|
```bash
|
|
33
|
-
npx @wp-playground/cli@latest
|
|
45
|
+
npx @wp-playground/cli@latest start
|
|
34
46
|
```
|
|
35
47
|
|
|
36
|
-
> **_NOTE:_** You can also use the `@wp-playground/cli@latest` to load the latest version of playground.
|
|
37
|
-
|
|
38
48
|
### Choosing a WordPress Version
|
|
39
49
|
|
|
40
|
-
By default, the CLI loads the latest stable version of WordPress and PHP 8.
|
|
50
|
+
By default, the CLI loads the latest stable version of WordPress and PHP 8.3 due to its improved performance. To specify your preferred versions, you can use the flag `--wp=<version>` and `--php=<version>`:
|
|
41
51
|
|
|
42
52
|
```bash
|
|
43
|
-
|
|
53
|
+
npx @wp-playground/cli@latest start --wp=6.8 --php=8.4
|
|
44
54
|
```
|
|
45
55
|
|
|
56
|
+
### `start` and `server`
|
|
57
|
+
|
|
58
|
+
Playground CLI includes two commands for running WordPress locally:
|
|
59
|
+
|
|
60
|
+
- **`start`**: Recommended for day-to-day development. It auto-detects the
|
|
61
|
+
project type, persists the site in `~/.wordpress-playground/sites/<path-hash>/`,
|
|
62
|
+
enables login, and opens the browser.
|
|
63
|
+
- **`server`**: Advanced mode for explicit mounts, automation, and CI. Unless
|
|
64
|
+
you mount persistent storage yourself, `server` uses temporary directories
|
|
65
|
+
that are removed after they become stale.
|
|
66
|
+
|
|
46
67
|
### Mounting local Directories
|
|
47
68
|
|
|
48
69
|
`@wp-playground/cli` operates by mounting your local project files into a virtualized WordPress environment. This allows you to work on your plugin or theme with a live WordPress instance without any complex setup. You can do this automatically or manually.
|
|
49
70
|
|
|
71
|
+
The easiest option is automatic mounting:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
cd my-plugin-or-theme-directory
|
|
75
|
+
npx @wp-playground/cli@latest server --auto-mount
|
|
76
|
+
```
|
|
77
|
+
|
|
50
78
|
For full control, you can manually mount a local directory to a specific path inside the virtual WordPress installation. For example, to mount your current project folder into the plugins directory, use the `--mount` flag:
|
|
51
79
|
|
|
52
80
|
```shell
|
|
53
81
|
cd my-plugin-or-theme-directory
|
|
54
|
-
npx @wp-playground/cli@latest server --mount=.:/wordpress/wp-content/plugins/
|
|
82
|
+
npx @wp-playground/cli@latest server --mount=.:/wordpress/wp-content/plugins/my-plugin
|
|
55
83
|
```
|
|
56
84
|
|
|
57
|
-
Another helpful flag is `--mount-before-install
|
|
85
|
+
Another helpful flag is `--mount-before-install`. It lets you mount files before WordPress is installed, which is useful when the mounted directory already contains a WordPress site:
|
|
58
86
|
|
|
59
87
|
```shell
|
|
60
88
|
npx @wp-playground/cli@latest server --mount-before-install=./my-local-site:/wordpress
|
|
@@ -62,32 +90,77 @@ npx @wp-playground/cli@latest server --mount-before-install=./my-local-site:/wor
|
|
|
62
90
|
|
|
63
91
|
### Automatic Mounting with `--auto-mount`
|
|
64
92
|
|
|
65
|
-
The `--auto-mount` flag
|
|
93
|
+
The `--auto-mount` flag inspects the selected directory and mounts it to the correct location in the virtual WordPress site. These are the supported directory types and how they are detected:
|
|
66
94
|
|
|
67
95
|
- **Plugin Mode**: Presence of a PHP file with `Plugin Name:` in its header.
|
|
68
96
|
- **Theme Mode**: Presence of a style.css file with `Theme Name:` in its header.
|
|
69
|
-
- **wp-content Mode**: Presence of plugins
|
|
97
|
+
- **wp-content Mode**: Presence of plugins, themes, mu-plugins, or uploads subdirectories.
|
|
70
98
|
- **WordPress Mode**: Presence of a complete WordPress installation. The directory will be mounted to the root `/wordpress` folder.
|
|
71
99
|
|
|
100
|
+
## Migrating from wp-now
|
|
101
|
+
|
|
102
|
+
The deprecated `@wp-now/wp-now` package maps most directly to the `start`
|
|
103
|
+
command:
|
|
104
|
+
|
|
105
|
+
| wp-now | Playground CLI |
|
|
106
|
+
| ------------------------------------------------------- | ------------------------------------------------------------------ |
|
|
107
|
+
| `npx @wp-now/wp-now start` | `npx @wp-playground/cli@latest start` |
|
|
108
|
+
| `npx @wp-now/wp-now start --path=./plugin` | `cd ./plugin && npx @wp-playground/cli@latest start` |
|
|
109
|
+
| `npx @wp-now/wp-now start --wp=6.8 --php=8.3` | `npx @wp-playground/cli@latest start --wp=6.8 --php=8.3` |
|
|
110
|
+
| `npx @wp-now/wp-now start --blueprint=./blueprint.json` | `npx @wp-playground/cli@latest start --blueprint=./blueprint.json` |
|
|
111
|
+
| `npx @wp-now/wp-now start --skip-browser` | `npx @wp-playground/cli@latest start --skip-browser` |
|
|
112
|
+
| `npx @wp-now/wp-now start --reset` | `npx @wp-playground/cli@latest start --reset` |
|
|
113
|
+
|
|
114
|
+
The main workflow change is where the saved site lives:
|
|
115
|
+
|
|
116
|
+
- With `wp-now`, `--path=./plugin` picked the project and the saved site.
|
|
117
|
+
- With Playground CLI, `start` saves the site for the current directory. For
|
|
118
|
+
the closest match, `cd` into the project first, then run `start`.
|
|
119
|
+
- When Playground CLI creates WordPress for you, it keeps the WordPress files
|
|
120
|
+
in `~/.wordpress-playground/sites/<path-hash>/`.
|
|
121
|
+
- If you run it on a full WordPress directory, or mount a directory at
|
|
122
|
+
`/wordpress`, that directory is the WordPress site. Changes are written
|
|
123
|
+
there.
|
|
124
|
+
- `start --path=./plugin` still mounts that folder, but it does not make
|
|
125
|
+
`./plugin` the saved site. The saved site still belongs to the directory
|
|
126
|
+
where you ran the command.
|
|
127
|
+
|
|
128
|
+
Use `start` for the familiar wp-now-style flow. Use `server` only when you want
|
|
129
|
+
to spell out mounts, storage, or automation yourself.
|
|
130
|
+
|
|
72
131
|
## Command and Arguments
|
|
73
132
|
|
|
74
133
|
Playground CLI is simple, configurable, and unopinionated. You can set it up according
|
|
75
134
|
to your unique WordPress setup. With the Playground CLI, you can use the following top-level commands:
|
|
76
135
|
|
|
77
|
-
- **`
|
|
136
|
+
- **`start`**: Starts a local WordPress server with automatic project detection, site persistence, and browser opening.
|
|
137
|
+
- **`server`**: Starts a local WordPress server with full manual control over configuration.
|
|
78
138
|
- **`run-blueprint`**: Executes a Blueprint file without starting a web server.
|
|
79
139
|
- **`build-snapshot`**: Builds a ZIP snapshot of a WordPress site based on a Blueprint.
|
|
140
|
+
- **`php`**: Runs a PHP script.
|
|
141
|
+
|
|
142
|
+
The `start` command supports these common optional arguments. Run `npx @wp-playground/cli@latest start --help` for the full list:
|
|
143
|
+
|
|
144
|
+
- `--path=<path>`: Path to the project directory. Defaults to the current working directory.
|
|
145
|
+
- `--wp=<version>`: WordPress version to use. Defaults to the latest.
|
|
146
|
+
- `--php=<version>`: PHP version to use. Defaults to PHP 8.3.
|
|
147
|
+
- `--port=<port>`: The port number for the server to listen on. Defaults to 9400 when available.
|
|
148
|
+
- `--blueprint=<path>`: The path to a JSON Blueprint file to execute.
|
|
149
|
+
- `--login`: Automatically log the user in as an administrator. Defaults to true.
|
|
150
|
+
- `--skip-browser`: Do not open the site in your default browser.
|
|
151
|
+
- `--reset`: Delete the stored site directory and start fresh.
|
|
152
|
+
- `--no-auto-mount`: Disable automatic project detection.
|
|
80
153
|
|
|
81
|
-
The `server` command supports
|
|
154
|
+
The `server` command supports these common optional arguments. Run `npx @wp-playground/cli@latest server --help` for the full list:
|
|
82
155
|
|
|
83
156
|
- `--port=<port>`: The port number for the server to listen on. Defaults to 9400.
|
|
84
|
-
- `--outfile`: When building, write to this output file.
|
|
85
157
|
- `--wp=<version>`: The version of WordPress to use. Defaults to the latest.
|
|
158
|
+
- `--php=<version>`: PHP version to use. Defaults to PHP 8.3.
|
|
86
159
|
- `--auto-mount`: Automatically mount the current directory (plugin, theme, wp-content, etc.).
|
|
87
|
-
- `--mount=<mapping>`: Manually mount a directory (can be used multiple times). Format:
|
|
88
|
-
- `--mount-before-install`: Mount a directory to the PHP runtime before WordPress installation (can be used multiple times). Format:
|
|
89
|
-
- `--mount-dir`: Mount a directory to the PHP runtime (can be used multiple times). Format: `"/host/path"
|
|
90
|
-
- `--mount-dir-before-install`: Mount a directory before WordPress installation (can be used multiple times). Format: `"/host/path"
|
|
160
|
+
- `--mount=<mapping>`: Manually mount a directory (can be used multiple times). Format: `/host/path:/vfs/path`.
|
|
161
|
+
- `--mount-before-install`: Mount a directory to the PHP runtime before WordPress installation (can be used multiple times). Format: `/host/path:/vfs/path`.
|
|
162
|
+
- `--mount-dir`: Mount a directory to the PHP runtime (can be used multiple times). Format: `"/host/path" "/vfs/path"`.
|
|
163
|
+
- `--mount-dir-before-install`: Mount a directory before WordPress installation (can be used multiple times). Format: `"/host/path" "/vfs/path"`.
|
|
91
164
|
- `--blueprint=<path>`: The path to a JSON Blueprint file to execute.
|
|
92
165
|
- `--blueprint-may-read-adjacent-files`: Consent flag: Allow "bundled" resources in a local blueprint to read files in the same directory as the blueprint file.
|
|
93
166
|
- `--login`: Automatically log the user in as an administrator.
|
package/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const i=require("child_process");function t(){return!("Suspending"in WebAssembly||process.env.PLAYGROUND_NO_JSPI_RESPAWN||process.versions.bun||"Deno"in globalThis||process.execArgv.includes("--experimental-wasm-jspi")||parseInt(process.versions.node.split(".")[0],10)<23)}function o(){const r=process.argv.slice(2);Promise.resolve().then(()=>require("./run-cli-
|
|
1
|
+
"use strict";const i=require("child_process");function t(){return!("Suspending"in WebAssembly||process.env.PLAYGROUND_NO_JSPI_RESPAWN||process.versions.bun||"Deno"in globalThis||process.execArgv.includes("--experimental-wasm-jspi")||parseInt(process.versions.node.split(".")[0],10)<23)}function o(){const r=process.argv.slice(2);Promise.resolve().then(()=>require("./run-cli-CsqeBu36.cjs")).then(e=>e.runCli).then(({parseOptionsAndRunCLI:e})=>{e(r)})}if(t()){const r=Date.now(),e=i.spawn(process.execPath,["--experimental-wasm-jspi",...process.execArgv,...process.argv.slice(1)],{stdio:"inherit"});for(const s of["SIGINT","SIGTERM"])process.on(s,()=>e.kill(s));e.on("error",()=>{o()}),e.on("close",(s,n)=>{if(s!==0&&!n&&Date.now()-r<1e3){o();return}n?process.kill(process.pid,n):process.exit(s)})}else o();
|
|
2
2
|
//# sourceMappingURL=cli.cjs.map
|
package/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ function t() {
|
|
|
4
4
|
}
|
|
5
5
|
function o() {
|
|
6
6
|
const r = process.argv.slice(2);
|
|
7
|
-
import("./run-cli-
|
|
7
|
+
import("./run-cli-B6snvP5v.js").then((e) => e.d).then(({ parseOptionsAndRunCLI: e }) => {
|
|
8
8
|
e(r);
|
|
9
9
|
});
|
|
10
10
|
}
|
package/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./run-cli-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./run-cli-CsqeBu36.cjs");exports.LogVerbosity=e.LogVerbosity;exports.internalsKeyForTesting=e.internalsKeyForTesting;exports.mergeDefinedConstants=e.mergeDefinedConstants;exports.parseOptionsAndRunCLI=e.parseOptionsAndRunCLI;exports.resolveWorkerCount=e.resolveWorkerCount;exports.runCLI=e.runCLI;exports.spawnWorkerThread=e.spawnWorkerThread;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-playground/cli",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.39",
|
|
4
4
|
"description": "WordPress Playground CLI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,25 +34,25 @@
|
|
|
34
34
|
"bin": {
|
|
35
35
|
"wp-playground-cli": "wp-playground.js"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "8f2bada44eb41b231b9040a866432dc32f80117e",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"express": "4.22.
|
|
39
|
+
"express": "4.22.2",
|
|
40
40
|
"fs-extra": "11.1.1",
|
|
41
41
|
"tmp-promise": "3.0.3",
|
|
42
42
|
"wasm-feature-detect": "1.8.0",
|
|
43
43
|
"yargs": "17.7.2",
|
|
44
|
-
"@wp-playground/common": "3.1.
|
|
45
|
-
"@php-wasm/logger": "3.1.
|
|
46
|
-
"@php-wasm/progress": "3.1.
|
|
47
|
-
"@php-wasm/universal": "3.1.
|
|
48
|
-
"@wp-playground/blueprints": "3.1.
|
|
49
|
-
"@wp-playground/wordpress": "3.1.
|
|
50
|
-
"@php-wasm/node": "3.1.
|
|
51
|
-
"@php-wasm/util": "3.1.
|
|
52
|
-
"@php-wasm/cli-util": "3.1.
|
|
53
|
-
"@wp-playground/storage": "3.1.
|
|
54
|
-
"@php-wasm/xdebug-bridge": "3.1.
|
|
55
|
-
"@wp-playground/tools": "3.1.
|
|
44
|
+
"@wp-playground/common": "3.1.39",
|
|
45
|
+
"@php-wasm/logger": "3.1.39",
|
|
46
|
+
"@php-wasm/progress": "3.1.39",
|
|
47
|
+
"@php-wasm/universal": "3.1.39",
|
|
48
|
+
"@wp-playground/blueprints": "3.1.39",
|
|
49
|
+
"@wp-playground/wordpress": "3.1.39",
|
|
50
|
+
"@php-wasm/node": "3.1.39",
|
|
51
|
+
"@php-wasm/util": "3.1.39",
|
|
52
|
+
"@php-wasm/cli-util": "3.1.39",
|
|
53
|
+
"@wp-playground/storage": "3.1.39",
|
|
54
|
+
"@php-wasm/xdebug-bridge": "3.1.39",
|
|
55
|
+
"@wp-playground/tools": "3.1.39"
|
|
56
56
|
},
|
|
57
57
|
"packageManager": "npm@10.9.2",
|
|
58
58
|
"overrides": {
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"form-data": "^4.0.4",
|
|
66
66
|
"lodash": "^4.17.23",
|
|
67
67
|
"glob": "^9.3.0",
|
|
68
|
-
"webpackbar": "^7.0.0"
|
|
68
|
+
"webpackbar": "^7.0.0",
|
|
69
|
+
"ws": "8.21.0"
|
|
69
70
|
}
|
|
70
71
|
}
|
|
@@ -1628,7 +1628,8 @@ async function Ee(e) {
|
|
|
1628
1628
|
}
|
|
1629
1629
|
return e.xdebug && e.experimentalDevtools && (await ot({
|
|
1630
1630
|
phpInstance: t,
|
|
1631
|
-
phpRoot: "/wordpress"
|
|
1631
|
+
phpRoot: "/wordpress",
|
|
1632
|
+
excludedPaths: ["/internal"]
|
|
1632
1633
|
})).start(), {
|
|
1633
1634
|
playground: t,
|
|
1634
1635
|
server: f,
|
|
@@ -1825,4 +1826,4 @@ export {
|
|
|
1825
1826
|
xe as r,
|
|
1826
1827
|
$e as s
|
|
1827
1828
|
};
|
|
1828
|
-
//# sourceMappingURL=run-cli-
|
|
1829
|
+
//# sourceMappingURL=run-cli-B6snvP5v.js.map
|