@wordpress/env 11.0.1-next.v.202602200903.0 → 11.0.1
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 +4 -5
- package/lib/config/parse-config.js +1 -13
- package/lib/config/test/__snapshots__/config-integration.js.snap +0 -8
- package/lib/config/test/parse-config.js +0 -34
- package/lib/runtime/docker/index.js +5 -5
- package/lib/runtime/docker/wordpress.js +0 -5
- package/lib/runtime/playground/index.js +8 -40
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ $ wp-env start --runtime=playground
|
|
|
41
41
|
| Requires Docker | Yes | No |
|
|
42
42
|
| Xdebug | Yes | Yes |
|
|
43
43
|
| SPX profiling | Yes | No |
|
|
44
|
-
| phpMyAdmin | Yes |
|
|
44
|
+
| phpMyAdmin | Yes | No |
|
|
45
45
|
| MySQL database | Yes | No (SQLite) |
|
|
46
46
|
| Multisite | Yes | Yes |
|
|
47
47
|
| Custom PHP version | Yes | Yes |
|
|
@@ -488,7 +488,7 @@ Success: Installed 1 of 1 plugins.
|
|
|
488
488
|
|
|
489
489
|
#### Changing the permalink structure
|
|
490
490
|
|
|
491
|
-
|
|
491
|
+
You might want to do this to enable access to the REST API (`wp-env/wp/v2/`) endpoint in your wp-env environment. The endpoint is not available with plain permalinks.
|
|
492
492
|
|
|
493
493
|
**Examples**
|
|
494
494
|
|
|
@@ -596,8 +596,7 @@ You can customize the WordPress installation, plugins and themes that the develo
|
|
|
596
596
|
| `"config"` | `Object` | See below. | Mapping of wp-config.php constants to their desired values. |
|
|
597
597
|
| `"mappings"` | `Object` | `"{}"` | Mapping of WordPress directories to local directories to be mounted in the WordPress instance. |
|
|
598
598
|
| `"mysqlPort"` | `integer` | `null` (randomly assigned) | The MySQL port number to expose. |
|
|
599
|
-
| `"
|
|
600
|
-
| `"phpmyadminPort"` | `integer` | `null` (randomly assigned) | The port number for phpMyAdmin (Docker only). Setting this also enables phpMyAdmin. |
|
|
599
|
+
| `"phpmyadminPort"` | `integer` | `null` | The port number for phpMyAdmin. If provided, you'll access phpMyAdmin through: http://localhost:<port> |
|
|
601
600
|
| `"multisite"` | `boolean` | `false` | Whether to set up a multisite installation. |
|
|
602
601
|
| `"lifecycleScripts"` | `Object` | `"{}"` | Mapping of commands that should be executed at certain points in the lifecycle. |
|
|
603
602
|
|
|
@@ -786,7 +785,7 @@ You can tell `wp-env` to use a custom port number so that your instance does not
|
|
|
786
785
|
These can also be set via environment variables:
|
|
787
786
|
|
|
788
787
|
- `WP_ENV_PORT` to override the web server's port.
|
|
789
|
-
- phpMyAdmin is not enabled by default
|
|
788
|
+
- phpMyAdmin is not enabled by default, but its port can also be overridden via `WP_ENV_PHPMYADMIN_PORT`.
|
|
790
789
|
- By default, MySQL isn't exposed to the host, which means no chance of port conflicts. But this can also be overridden via `WP_ENV_MYSQL_PORT`.
|
|
791
790
|
|
|
792
791
|
### Specific PHP Version
|
|
@@ -51,8 +51,7 @@ const mergeConfigs = require( './merge-configs' );
|
|
|
51
51
|
* @property {WPSource[]} themeSources Themes to load in the environment.
|
|
52
52
|
* @property {number} port The port to use.
|
|
53
53
|
* @property {number} mysqlPort The port to use for MySQL. Random if empty.
|
|
54
|
-
* @property {
|
|
55
|
-
* @property {number} phpmyadminPort The port to use for phpMyAdmin. Random if empty.
|
|
54
|
+
* @property {number} phpmyadminPort The port to use for phpMyAdmin. If empty, disabled phpMyAdmin.
|
|
56
55
|
* @property {boolean} multisite Whether to set up a multisite installation.
|
|
57
56
|
* @property {Object} config Mapping of wp-config.php constants to their desired values.
|
|
58
57
|
* @property {Object.<string, WPSource>} mappings Mapping of WordPress directories to local directories which should be mounted.
|
|
@@ -90,7 +89,6 @@ const DEFAULT_ENVIRONMENT_CONFIG = {
|
|
|
90
89
|
port: 8888,
|
|
91
90
|
testsPort: 8889,
|
|
92
91
|
mysqlPort: null,
|
|
93
|
-
phpmyadmin: false,
|
|
94
92
|
phpmyadminPort: null,
|
|
95
93
|
multisite: false,
|
|
96
94
|
mappings: {},
|
|
@@ -308,7 +306,6 @@ function getEnvironmentVarOverrides( cacheDirectoryPath ) {
|
|
|
308
306
|
if ( overrides.phpmyadminPort ) {
|
|
309
307
|
overrideConfig.env.development.phpmyadminPort =
|
|
310
308
|
overrides.phpmyadminPort;
|
|
311
|
-
overrideConfig.env.development.phpmyadmin = true;
|
|
312
309
|
}
|
|
313
310
|
|
|
314
311
|
if ( overrides.testsPort ) {
|
|
@@ -499,17 +496,8 @@ async function parseEnvironmentConfig(
|
|
|
499
496
|
parsedConfig.mysqlPort = config.mysqlPort;
|
|
500
497
|
}
|
|
501
498
|
|
|
502
|
-
if ( config.phpmyadmin !== undefined ) {
|
|
503
|
-
parsedConfig.phpmyadmin = config.phpmyadmin;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
499
|
if ( config.phpmyadminPort !== undefined ) {
|
|
507
500
|
parsedConfig.phpmyadminPort = config.phpmyadminPort;
|
|
508
|
-
// Backward compat: setting phpmyadminPort implies phpmyadmin: true
|
|
509
|
-
// unless phpmyadmin was explicitly set.
|
|
510
|
-
if ( config.phpmyadmin === undefined ) {
|
|
511
|
-
parsedConfig.phpmyadmin = true;
|
|
512
|
-
}
|
|
513
501
|
}
|
|
514
502
|
|
|
515
503
|
if ( config.multisite !== undefined ) {
|
|
@@ -33,7 +33,6 @@ exports[`Config Integration should load local and override configuration files 1
|
|
|
33
33
|
"multisite": false,
|
|
34
34
|
"mysqlPort": 23306,
|
|
35
35
|
"phpVersion": null,
|
|
36
|
-
"phpmyadmin": false,
|
|
37
36
|
"phpmyadminPort": null,
|
|
38
37
|
"pluginSources": [],
|
|
39
38
|
"port": 999,
|
|
@@ -65,7 +64,6 @@ exports[`Config Integration should load local and override configuration files 1
|
|
|
65
64
|
"multisite": false,
|
|
66
65
|
"mysqlPort": 23307,
|
|
67
66
|
"phpVersion": null,
|
|
68
|
-
"phpmyadmin": false,
|
|
69
67
|
"phpmyadminPort": null,
|
|
70
68
|
"pluginSources": [],
|
|
71
69
|
"port": 456,
|
|
@@ -118,7 +116,6 @@ exports[`Config Integration should load local configuration file 1`] = `
|
|
|
118
116
|
"multisite": false,
|
|
119
117
|
"mysqlPort": 13306,
|
|
120
118
|
"phpVersion": null,
|
|
121
|
-
"phpmyadmin": false,
|
|
122
119
|
"phpmyadminPort": null,
|
|
123
120
|
"pluginSources": [],
|
|
124
121
|
"port": 123,
|
|
@@ -150,7 +147,6 @@ exports[`Config Integration should load local configuration file 1`] = `
|
|
|
150
147
|
"multisite": false,
|
|
151
148
|
"mysqlPort": 23307,
|
|
152
149
|
"phpVersion": null,
|
|
153
|
-
"phpmyadmin": false,
|
|
154
150
|
"phpmyadminPort": null,
|
|
155
151
|
"pluginSources": [],
|
|
156
152
|
"port": 8889,
|
|
@@ -203,7 +199,6 @@ exports[`Config Integration should use default configuration 1`] = `
|
|
|
203
199
|
"multisite": false,
|
|
204
200
|
"mysqlPort": null,
|
|
205
201
|
"phpVersion": null,
|
|
206
|
-
"phpmyadmin": false,
|
|
207
202
|
"phpmyadminPort": null,
|
|
208
203
|
"pluginSources": [],
|
|
209
204
|
"port": 8888,
|
|
@@ -235,7 +230,6 @@ exports[`Config Integration should use default configuration 1`] = `
|
|
|
235
230
|
"multisite": false,
|
|
236
231
|
"mysqlPort": null,
|
|
237
232
|
"phpVersion": null,
|
|
238
|
-
"phpmyadmin": false,
|
|
239
233
|
"phpmyadminPort": null,
|
|
240
234
|
"pluginSources": [],
|
|
241
235
|
"port": 8889,
|
|
@@ -288,7 +282,6 @@ exports[`Config Integration should use environment variables over local and over
|
|
|
288
282
|
"multisite": false,
|
|
289
283
|
"mysqlPort": 23306,
|
|
290
284
|
"phpVersion": null,
|
|
291
|
-
"phpmyadmin": false,
|
|
292
285
|
"phpmyadminPort": null,
|
|
293
286
|
"pluginSources": [],
|
|
294
287
|
"port": 12345,
|
|
@@ -321,7 +314,6 @@ exports[`Config Integration should use environment variables over local and over
|
|
|
321
314
|
"multisite": false,
|
|
322
315
|
"mysqlPort": 23307,
|
|
323
316
|
"phpVersion": null,
|
|
324
|
-
"phpmyadmin": false,
|
|
325
317
|
"phpmyadminPort": null,
|
|
326
318
|
"pluginSources": [],
|
|
327
319
|
"port": 61234,
|
|
@@ -22,7 +22,6 @@ const DEFAULT_CONFIG = {
|
|
|
22
22
|
port: 8888,
|
|
23
23
|
testsPort: 8889,
|
|
24
24
|
mysqlPort: null,
|
|
25
|
-
phpmyadmin: false,
|
|
26
25
|
phpmyadminPort: null,
|
|
27
26
|
multisite: false,
|
|
28
27
|
phpVersion: null,
|
|
@@ -417,7 +416,6 @@ describe( 'parseConfig', () => {
|
|
|
417
416
|
},
|
|
418
417
|
env: {
|
|
419
418
|
development: {
|
|
420
|
-
phpmyadmin: true,
|
|
421
419
|
phpmyadminPort: 9001,
|
|
422
420
|
},
|
|
423
421
|
},
|
|
@@ -430,38 +428,6 @@ describe( 'parseConfig', () => {
|
|
|
430
428
|
const expected = {
|
|
431
429
|
development: {
|
|
432
430
|
...DEFAULT_CONFIG.env.development,
|
|
433
|
-
phpmyadmin: true,
|
|
434
|
-
phpmyadminPort: 9001,
|
|
435
|
-
},
|
|
436
|
-
tests: DEFAULT_CONFIG.env.tests,
|
|
437
|
-
};
|
|
438
|
-
expect( parsed.env ).toEqual( expected );
|
|
439
|
-
} );
|
|
440
|
-
|
|
441
|
-
it( 'should infer phpmyadmin: true when phpmyadminPort is set', async () => {
|
|
442
|
-
readRawConfigFile.mockImplementation( async ( configFile ) => {
|
|
443
|
-
if ( configFile === '/test/gutenberg/.wp-env.json' ) {
|
|
444
|
-
return {
|
|
445
|
-
core: 'WordPress/WordPress#Test',
|
|
446
|
-
phpVersion: '1.0',
|
|
447
|
-
lifecycleScripts: {
|
|
448
|
-
afterStart: 'test',
|
|
449
|
-
},
|
|
450
|
-
env: {
|
|
451
|
-
development: {
|
|
452
|
-
phpmyadminPort: 9001,
|
|
453
|
-
},
|
|
454
|
-
},
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
} );
|
|
458
|
-
|
|
459
|
-
const parsed = await parseConfig( '/test/gutenberg', '/cache' );
|
|
460
|
-
|
|
461
|
-
const expected = {
|
|
462
|
-
development: {
|
|
463
|
-
...DEFAULT_CONFIG.env.development,
|
|
464
|
-
phpmyadmin: true,
|
|
465
431
|
phpmyadminPort: 9001,
|
|
466
432
|
},
|
|
467
433
|
tests: DEFAULT_CONFIG.env.tests,
|
|
@@ -241,7 +241,7 @@ class DockerRuntime {
|
|
|
241
241
|
: [],
|
|
242
242
|
} );
|
|
243
243
|
|
|
244
|
-
if ( fullConfig.env.development.
|
|
244
|
+
if ( fullConfig.env.development.phpmyadminPort ) {
|
|
245
245
|
await dockerCompose.upOne( 'phpmyadmin', {
|
|
246
246
|
...dockerComposeConfig,
|
|
247
247
|
commandOptions: shouldConfigureWp
|
|
@@ -250,7 +250,7 @@ class DockerRuntime {
|
|
|
250
250
|
} );
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
if ( testsEnabled && fullConfig.env.tests.
|
|
253
|
+
if ( testsEnabled && fullConfig.env.tests.phpmyadminPort ) {
|
|
254
254
|
await dockerCompose.upOne( 'tests-phpmyadmin', {
|
|
255
255
|
...dockerComposeConfig,
|
|
256
256
|
commandOptions: shouldConfigureWp
|
|
@@ -312,7 +312,7 @@ class DockerRuntime {
|
|
|
312
312
|
dockerComposeConfig
|
|
313
313
|
);
|
|
314
314
|
|
|
315
|
-
const phpmyadminPort = fullConfig.env.development.
|
|
315
|
+
const phpmyadminPort = fullConfig.env.development.phpmyadminPort
|
|
316
316
|
? await this._getPublicDockerPort(
|
|
317
317
|
'phpmyadmin',
|
|
318
318
|
80,
|
|
@@ -335,7 +335,7 @@ class DockerRuntime {
|
|
|
335
335
|
3306,
|
|
336
336
|
dockerComposeConfig
|
|
337
337
|
);
|
|
338
|
-
const testsPhpmyadminPort = fullConfig.env.tests.
|
|
338
|
+
const testsPhpmyadminPort = fullConfig.env.tests.phpmyadminPort
|
|
339
339
|
? await this._getPublicDockerPort(
|
|
340
340
|
'tests-phpmyadmin',
|
|
341
341
|
80,
|
|
@@ -726,7 +726,7 @@ class DockerRuntime {
|
|
|
726
726
|
);
|
|
727
727
|
isRunning = true;
|
|
728
728
|
|
|
729
|
-
if ( fullConfig.env.development.
|
|
729
|
+
if ( fullConfig.env.development.phpmyadminPort ) {
|
|
730
730
|
phpmyadminPort = await this._getPublicDockerPort(
|
|
731
731
|
'phpmyadmin',
|
|
732
732
|
80,
|
|
@@ -86,11 +86,6 @@ async function configureWordPress( environment, config, spinner ) {
|
|
|
86
86
|
'set -eo pipefail',
|
|
87
87
|
cliConfigCommand,
|
|
88
88
|
installCommand,
|
|
89
|
-
// Enable pretty permalinks by default to match what WordPress core
|
|
90
|
-
// does on a fresh install. The loopback test that WordPress normally
|
|
91
|
-
// uses to verify pretty permalinks fails in Docker because the CLI
|
|
92
|
-
// container can't reach the WordPress container at the site URL.
|
|
93
|
-
`wp rewrite structure '/%year%/%monthnum%/%day%/%postname%/' --hard`,
|
|
94
89
|
];
|
|
95
90
|
|
|
96
91
|
// Bootstrap .htaccess for multisite
|
|
@@ -48,7 +48,7 @@ class PlaygroundRuntime {
|
|
|
48
48
|
testsEnvironment: false, // Single environment only
|
|
49
49
|
xdebug: true, // Supported via --xdebug flag
|
|
50
50
|
spx: false, // Not supported in WebAssembly
|
|
51
|
-
phpMyAdmin:
|
|
51
|
+
phpMyAdmin: false, // Supported on playground.wordpress.net but not in CLI yet
|
|
52
52
|
multisite: true, // Supported via Blueprint
|
|
53
53
|
customPhpVersion: true, // Supported via --php flag
|
|
54
54
|
persistentDatabase: false, // Could be supported via mounts (not yet implemented)
|
|
@@ -170,10 +170,6 @@ class PlaygroundRuntime {
|
|
|
170
170
|
cliArgs.push( '--verbosity', 'debug' );
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
if ( envConfig.phpmyadmin ) {
|
|
174
|
-
cliArgs.push( '--phpmyadmin' );
|
|
175
|
-
}
|
|
176
|
-
|
|
177
173
|
if ( xdebug ) {
|
|
178
174
|
cliArgs.push( '--xdebug' );
|
|
179
175
|
}
|
|
@@ -188,27 +184,12 @@ class PlaygroundRuntime {
|
|
|
188
184
|
// Create write stream for log file
|
|
189
185
|
const logFileStream = await fs.open( logFile, 'w' );
|
|
190
186
|
|
|
191
|
-
// Resolve the CLI binary directly so that it is found even when
|
|
192
|
-
// the package is nested inside workspace node_modules (where npx
|
|
193
|
-
// cannot discover it).
|
|
194
|
-
const cliPackageJson = require.resolve(
|
|
195
|
-
'@wp-playground/cli/package.json'
|
|
196
|
-
);
|
|
197
|
-
const cliEntryPoint = path.join(
|
|
198
|
-
path.dirname( cliPackageJson ),
|
|
199
|
-
'wp-playground.js'
|
|
200
|
-
);
|
|
201
|
-
|
|
202
187
|
return new Promise( ( resolve, reject ) => {
|
|
203
|
-
const child = spawn(
|
|
204
|
-
|
|
205
|
-
[
|
|
206
|
-
{
|
|
207
|
-
|
|
208
|
-
stdio: [ 'ignore', logFileStream.fd, logFileStream.fd ],
|
|
209
|
-
env: { ...process.env, FORCE_COLOR: '0' },
|
|
210
|
-
}
|
|
211
|
-
);
|
|
188
|
+
const child = spawn( 'npx', [ '@wp-playground/cli', ...cliArgs ], {
|
|
189
|
+
detached: true,
|
|
190
|
+
stdio: [ 'ignore', logFileStream.fd, logFileStream.fd ],
|
|
191
|
+
env: { ...process.env, FORCE_COLOR: '0' },
|
|
192
|
+
} );
|
|
212
193
|
|
|
213
194
|
// Store child process reference
|
|
214
195
|
this.serverProcess = child;
|
|
@@ -260,17 +241,8 @@ class PlaygroundRuntime {
|
|
|
260
241
|
.then( async () => {
|
|
261
242
|
spinner.text = `WordPress Playground started at ${ siteUrl }`;
|
|
262
243
|
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
: null;
|
|
266
|
-
|
|
267
|
-
const message = [
|
|
268
|
-
'WordPress development site started at ' + siteUrl,
|
|
269
|
-
phpmyadminUrl &&
|
|
270
|
-
`phpMyAdmin started at ${ phpmyadminUrl }`,
|
|
271
|
-
]
|
|
272
|
-
.filter( Boolean )
|
|
273
|
-
.join( '\n' );
|
|
244
|
+
const message =
|
|
245
|
+
'WordPress development site started at ' + siteUrl;
|
|
274
246
|
|
|
275
247
|
resolve( {
|
|
276
248
|
message,
|
|
@@ -477,10 +449,6 @@ class PlaygroundRuntime {
|
|
|
477
449
|
runtime: 'playground',
|
|
478
450
|
urls: {
|
|
479
451
|
development: isRunning ? `http://localhost:${ port }` : null,
|
|
480
|
-
phpmyadmin:
|
|
481
|
-
isRunning && envConfig.phpmyadmin
|
|
482
|
-
? `http://localhost:${ port }/phpmyadmin`
|
|
483
|
-
: null,
|
|
484
452
|
},
|
|
485
453
|
ports: {
|
|
486
454
|
development: port,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/env",
|
|
3
|
-
"version": "11.0.1
|
|
3
|
+
"version": "11.0.1",
|
|
4
4
|
"description": "A zero-config, self contained local WordPress environment for development and testing.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@inquirer/prompts": "^7.2.0",
|
|
47
|
-
"@wp-playground/cli": "^3.0.
|
|
47
|
+
"@wp-playground/cli": "^3.0.0",
|
|
48
48
|
"chalk": "^4.0.0",
|
|
49
49
|
"copy-dir": "^1.3.0",
|
|
50
50
|
"cross-spawn": "^7.0.6",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"scripts": {
|
|
65
65
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "adb6623c9f32490cfc73c7ac7f122578c1f10c65"
|
|
68
68
|
}
|