@wordpress/env 4.2.2 → 4.2.3-next.a55ed9455a.0
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 +78 -60
- package/lib/cli.js +2 -2
- package/lib/config/db-env.js +3 -3
- package/lib/init-config.js +3 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -223,13 +223,13 @@ You should only have to translate `port` and `pathMappings` to the format used b
|
|
|
223
223
|
|
|
224
224
|
```json
|
|
225
225
|
{
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
226
|
+
"name": "Listen for XDebug",
|
|
227
|
+
"type": "php",
|
|
228
|
+
"request": "launch",
|
|
229
|
+
"port": 9003,
|
|
230
|
+
"pathMappings": {
|
|
231
|
+
"/var/www/html/wp-content/plugins/gutenberg": "${workspaceFolder}/"
|
|
232
|
+
}
|
|
233
233
|
}
|
|
234
234
|
```
|
|
235
235
|
|
|
@@ -297,6 +297,24 @@ Positionals:
|
|
|
297
297
|
|
|
298
298
|
### `wp-env run [container] [command]`
|
|
299
299
|
|
|
300
|
+
The run command can be used to open shell sessions or invoke WP-CLI commands.
|
|
301
|
+
|
|
302
|
+
<div class="callout callout-alert">
|
|
303
|
+
To run a WP-CLI command that includes optional arguments, enclose the WP-CLI command in quotation marks; otherwise, the optional arguments are ignored. This is because flags are normally passed to `wp-env` itself, meaning that the flags are not considered part of the argument that specifies the WP-CLI command. With quotation marks, `wp-env` considers everything inside quotation marks the WP-CLI command argument.
|
|
304
|
+
|
|
305
|
+
For example, to list cron schedules with optional arguments that specify the fields returned and the format of the output:
|
|
306
|
+
|
|
307
|
+
```sh
|
|
308
|
+
wp-env run cli "wp cron schedule list --fields=name --format=csv"
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
Without the quotation marks, WP-CLI lists the schedule in its default format, ignoring the `fields` and `format` arguments.
|
|
312
|
+
</div>
|
|
313
|
+
|
|
314
|
+
Note that quotation marks are not required for a WP-CLI command that excludes optional arguments, although it does not hurt to include them. For example, the following command syntaxes return identical results: `wp-env run cli "wp cron schedule list"` or `wp-env run cli wp cron schedule list`.
|
|
315
|
+
|
|
316
|
+
For more information about all the available commands, see [WP-CLI Commands](https://developer.wordpress.org/cli/commands/).
|
|
317
|
+
|
|
300
318
|
```sh
|
|
301
319
|
wp-env run <container> [command..]
|
|
302
320
|
|
|
@@ -363,7 +381,7 @@ wp> ^C
|
|
|
363
381
|
#### Installing a plugin or theme on the development instance
|
|
364
382
|
|
|
365
383
|
```sh
|
|
366
|
-
wp-env run cli plugin install custom-post-type-ui
|
|
384
|
+
wp-env run cli wp plugin install custom-post-type-ui
|
|
367
385
|
|
|
368
386
|
Creating 500cd328b649d63e882d5c4695871d04_cli_run ... done
|
|
369
387
|
Installing Custom Post Type UI (1.9.2)
|
|
@@ -455,22 +473,22 @@ Additionally, the key `env` is available to override any of the above options on
|
|
|
455
473
|
|
|
456
474
|
```json
|
|
457
475
|
{
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
476
|
+
"plugins": ["."],
|
|
477
|
+
"config": {
|
|
478
|
+
"KEY_1": true,
|
|
479
|
+
"KEY_2": false
|
|
480
|
+
},
|
|
481
|
+
"env": {
|
|
482
|
+
"development": {
|
|
483
|
+
"themes": ["./one-theme"]
|
|
484
|
+
},
|
|
485
|
+
"tests": {
|
|
486
|
+
"config": {
|
|
487
|
+
"KEY_1": false
|
|
488
|
+
},
|
|
489
|
+
"port": 3000
|
|
490
|
+
}
|
|
491
|
+
}
|
|
474
492
|
}
|
|
475
493
|
```
|
|
476
494
|
|
|
@@ -511,8 +529,8 @@ This is useful for plugin development.
|
|
|
511
529
|
|
|
512
530
|
```json
|
|
513
531
|
{
|
|
514
|
-
|
|
515
|
-
|
|
532
|
+
"core": null,
|
|
533
|
+
"plugins": ["."]
|
|
516
534
|
}
|
|
517
535
|
```
|
|
518
536
|
|
|
@@ -522,8 +540,8 @@ This is useful for plugin development when upstream Core changes need to be test
|
|
|
522
540
|
|
|
523
541
|
```json
|
|
524
542
|
{
|
|
525
|
-
|
|
526
|
-
|
|
543
|
+
"core": "WordPress/WordPress#master",
|
|
544
|
+
"plugins": ["."]
|
|
527
545
|
}
|
|
528
546
|
```
|
|
529
547
|
|
|
@@ -535,8 +553,8 @@ If you are running a _build_ of `wordpress-develop`, point `core` to the `build`
|
|
|
535
553
|
|
|
536
554
|
```json
|
|
537
555
|
{
|
|
538
|
-
|
|
539
|
-
|
|
556
|
+
"core": "../wordpress-develop/build",
|
|
557
|
+
"plugins": ["."]
|
|
540
558
|
}
|
|
541
559
|
```
|
|
542
560
|
|
|
@@ -544,8 +562,8 @@ If you are running `wordpress-develop` in a dev mode (e.g. the watch command `de
|
|
|
544
562
|
|
|
545
563
|
```json
|
|
546
564
|
{
|
|
547
|
-
|
|
548
|
-
|
|
565
|
+
"core": "../wordpress-develop/src",
|
|
566
|
+
"plugins": ["."]
|
|
549
567
|
}
|
|
550
568
|
```
|
|
551
569
|
|
|
@@ -555,9 +573,9 @@ This is useful for integration testing: that is, testing how old versions of Wor
|
|
|
555
573
|
|
|
556
574
|
```json
|
|
557
575
|
{
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
576
|
+
"core": "WordPress/WordPress#5.2.0",
|
|
577
|
+
"plugins": ["WordPress/wp-lazy-loading", "WordPress/classic-editor"],
|
|
578
|
+
"themes": ["WordPress/theme-experiments"]
|
|
561
579
|
}
|
|
562
580
|
```
|
|
563
581
|
|
|
@@ -567,12 +585,12 @@ You can add mu-plugins via the mapping config. The mapping config also allows yo
|
|
|
567
585
|
|
|
568
586
|
```json
|
|
569
587
|
{
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
588
|
+
"plugins": ["."],
|
|
589
|
+
"mappings": {
|
|
590
|
+
"wp-content/mu-plugins": "./path/to/local/mu-plugins",
|
|
591
|
+
"wp-content/themes": "./path/to/local/themes",
|
|
592
|
+
"wp-content/themes/specific-theme": "./path/to/local/theme-1"
|
|
593
|
+
}
|
|
576
594
|
}
|
|
577
595
|
```
|
|
578
596
|
|
|
@@ -582,10 +600,10 @@ Since all plugins in the `plugins` key are activated by default, you should use
|
|
|
582
600
|
|
|
583
601
|
```json
|
|
584
602
|
{
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
603
|
+
"plugins": ["."],
|
|
604
|
+
"mappings": {
|
|
605
|
+
"wp-content/plugins/my-test-plugin": "./path/to/test/plugin"
|
|
606
|
+
}
|
|
589
607
|
}
|
|
590
608
|
```
|
|
591
609
|
|
|
@@ -595,12 +613,12 @@ If you need a plugin active in one environment but not the other, you can use `e
|
|
|
595
613
|
|
|
596
614
|
```json
|
|
597
615
|
{
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
616
|
+
"plugins": ["."],
|
|
617
|
+
"env": {
|
|
618
|
+
"tests": {
|
|
619
|
+
"plugins": [".", "path/to/test/plugin"]
|
|
620
|
+
}
|
|
621
|
+
}
|
|
604
622
|
}
|
|
605
623
|
```
|
|
606
624
|
|
|
@@ -610,13 +628,13 @@ You can tell `wp-env` to use a custom port number so that your instance does not
|
|
|
610
628
|
|
|
611
629
|
```json
|
|
612
630
|
{
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
631
|
+
"plugins": ["."],
|
|
632
|
+
"port": 4013,
|
|
633
|
+
"env": {
|
|
634
|
+
"tests": {
|
|
635
|
+
"port": 4012
|
|
636
|
+
}
|
|
637
|
+
}
|
|
620
638
|
}
|
|
621
639
|
```
|
|
622
640
|
|
|
@@ -626,8 +644,8 @@ You can tell `wp-env` to use a specific PHP version for compatibility and testin
|
|
|
626
644
|
|
|
627
645
|
```json
|
|
628
646
|
{
|
|
629
|
-
|
|
630
|
-
|
|
647
|
+
"phpVersion": "7.2",
|
|
648
|
+
"plugins": ["."]
|
|
631
649
|
}
|
|
632
650
|
```
|
|
633
651
|
|
package/lib/cli.js
CHANGED
|
@@ -14,14 +14,14 @@ const { execSync } = require( 'child_process' );
|
|
|
14
14
|
const env = require( './env' );
|
|
15
15
|
const parseXdebugMode = require( './parse-xdebug-mode' );
|
|
16
16
|
|
|
17
|
-
// Colors
|
|
17
|
+
// Colors.
|
|
18
18
|
const boldWhite = chalk.bold.white;
|
|
19
19
|
const wpPrimary = boldWhite.bgHex( '#00669b' );
|
|
20
20
|
const wpGreen = boldWhite.bgHex( '#4ab866' );
|
|
21
21
|
const wpRed = boldWhite.bgHex( '#d94f4f' );
|
|
22
22
|
const wpYellow = boldWhite.bgHex( '#f0b849' );
|
|
23
23
|
|
|
24
|
-
// Spinner
|
|
24
|
+
// Spinner.
|
|
25
25
|
const withSpinner = ( command ) => ( ...args ) => {
|
|
26
26
|
const spinner = ora().start();
|
|
27
27
|
args[ 0 ].spinner = spinner;
|
package/lib/config/db-env.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
// Username and password used in all databases
|
|
1
|
+
// Username and password used in all databases.
|
|
2
2
|
const credentials = {
|
|
3
3
|
WORDPRESS_DB_USER: 'root',
|
|
4
4
|
WORDPRESS_DB_PASSWORD: 'password',
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
// Environment for test database
|
|
7
|
+
// Environment for test database.
|
|
8
8
|
const tests = {
|
|
9
9
|
WORDPRESS_DB_NAME: 'tests-wordpress',
|
|
10
10
|
WORDPRESS_DB_HOST: 'tests-mysql',
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
// Environment for development database. DB host gets default value which is set
|
|
14
|
-
// elsewhere
|
|
14
|
+
// elsewhere.
|
|
15
15
|
const development = {
|
|
16
16
|
WORDPRESS_DB_NAME: 'wordpress',
|
|
17
17
|
};
|
package/lib/init-config.js
CHANGED
|
@@ -111,7 +111,7 @@ function checkXdebugPhpCompatibility( config ) {
|
|
|
111
111
|
const phpCompatibility = true;
|
|
112
112
|
|
|
113
113
|
// If PHP version is defined
|
|
114
|
-
// ensure it meets the Xdebug minimum compatibility requirment
|
|
114
|
+
// ensure it meets the Xdebug minimum compatibility requirment.
|
|
115
115
|
if ( config.env.development.phpVersion ) {
|
|
116
116
|
const versionTokens = config.env.development.phpVersion.split( '.' );
|
|
117
117
|
const majorVer = parseInt( versionTokens[ 0 ] );
|
|
@@ -124,7 +124,7 @@ function checkXdebugPhpCompatibility( config ) {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// Xdebug 3 supports 7.2 and higher
|
|
127
|
-
// Ensure user has specified a compatible PHP version
|
|
127
|
+
// Ensure user has specified a compatible PHP version.
|
|
128
128
|
if ( majorVer < 7 || ( majorVer === 7 && minorVer < 2 ) ) {
|
|
129
129
|
throw new Error( 'Cannot use XDebug 3 on PHP < 7.2.' );
|
|
130
130
|
}
|
|
@@ -142,7 +142,7 @@ function checkXdebugPhpCompatibility( config ) {
|
|
|
142
142
|
* @return {string} The dockerfile contents.
|
|
143
143
|
*/
|
|
144
144
|
function dockerFileContents( image, config ) {
|
|
145
|
-
// Don't install XDebug unless it is explicitly required
|
|
145
|
+
// Don't install XDebug unless it is explicitly required.
|
|
146
146
|
let shouldInstallXdebug = false;
|
|
147
147
|
|
|
148
148
|
if ( config.xdebug !== 'off' ) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/env",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.3-next.a55ed9455a.0",
|
|
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",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"scripts": {
|
|
52
52
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "c5108185851b824d531bce55991a3589947e8551"
|
|
55
55
|
}
|