@wordpress/env 4.1.1-next.5df0cd52b7.0 → 4.1.4-next.33ec3857e2.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/CHANGELOG.md +6 -0
- package/README.md +35 -1
- package/lib/config/parse-config.js +1 -1
- package/lib/config/test/config.js +2 -2
- package/lib/init-config.js +44 -14
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -220,7 +220,7 @@ You should only have to translate `port` and `pathMappings` to the format used b
|
|
|
220
220
|
"request": "launch",
|
|
221
221
|
"port": 9003,
|
|
222
222
|
"pathMappings": {
|
|
223
|
-
"/var/www/html/wp-content/plugins/gutenberg": "${
|
|
223
|
+
"/var/www/html/wp-content/plugins/gutenberg": "${workspaceFolder}/"
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
```
|
|
@@ -350,6 +350,29 @@ wp> ^C
|
|
|
350
350
|
✔ Ran `wp shell` in 'tests-cli'. (in 16s 400ms)
|
|
351
351
|
```
|
|
352
352
|
|
|
353
|
+
#### Installing a plugin or theme on the development instance
|
|
354
|
+
|
|
355
|
+
```sh
|
|
356
|
+
wp-env run cli plugin install custom-post-type-ui
|
|
357
|
+
|
|
358
|
+
Creating 500cd328b649d63e882d5c4695871d04_cli_run ... done
|
|
359
|
+
Installing Custom Post Type UI (1.9.2)
|
|
360
|
+
Downloading installation package from https://downloads.wordpress.org/plugin/custom-post-type-ui.zip...
|
|
361
|
+
The authenticity of custom-post-type-ui.zip could not be verified as no signature was found.
|
|
362
|
+
Unpacking the package...
|
|
363
|
+
Installing the plugin...
|
|
364
|
+
Plugin installed successfully.
|
|
365
|
+
Success: Installed 1 of 1 plugins.
|
|
366
|
+
✔ Ran `plugin install custom-post-type-ui` in 'cli'. (in 6s 483ms)
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
**NOTE**: Depending on your host OS, you may experience errors when trying to install plugins or themes (e.g. `Warning: Could not create directory.`). This is typically because the user ID used within the container does not have write access to the mounted directories created by `wp-env`. To resolve this, run the `docker-compose` command directly from the directory created by `wp-env` and add `-u $(id -u)` and `-e HOME=/tmp` the `run` command as options:
|
|
370
|
+
|
|
371
|
+
```sh
|
|
372
|
+
$ cd ~/wp-env/500cd328b649d63e882d5c4695871d04
|
|
373
|
+
$ docker-compose run --rm -u $(id -u) -e HOME=/tmp cli [plugin|theme] install <plugin|theme>
|
|
374
|
+
```
|
|
375
|
+
|
|
353
376
|
### `wp-env destroy`
|
|
354
377
|
|
|
355
378
|
```sh
|
|
@@ -486,6 +509,8 @@ This is useful for plugin development when upstream Core changes need to be test
|
|
|
486
509
|
|
|
487
510
|
This is useful for working on plugins and WordPress Core at the same time.
|
|
488
511
|
|
|
512
|
+
If you are running a _build_ of `wordpress-develop`, point `core` to the `build` directory.
|
|
513
|
+
|
|
489
514
|
```json
|
|
490
515
|
{
|
|
491
516
|
"core": "../wordpress-develop/build",
|
|
@@ -493,6 +518,15 @@ This is useful for working on plugins and WordPress Core at the same time.
|
|
|
493
518
|
}
|
|
494
519
|
```
|
|
495
520
|
|
|
521
|
+
If you are running `wordpress-develop` in a dev mode (e.g. the watch command `dev` or the dev build `build:dev`), then point `core` to the `src` directory.
|
|
522
|
+
|
|
523
|
+
```json
|
|
524
|
+
{
|
|
525
|
+
"core": "../wordpress-develop/src",
|
|
526
|
+
"plugins": [ "." ]
|
|
527
|
+
}
|
|
528
|
+
```
|
|
529
|
+
|
|
496
530
|
#### A complete testing environment
|
|
497
531
|
|
|
498
532
|
This is useful for integration testing: that is, testing how old versions of WordPress and different combinations of plugins and themes impact each other.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* eslint-disable jest/no-
|
|
1
|
+
/* eslint-disable jest/no-conditional-expect */
|
|
2
2
|
/**
|
|
3
3
|
* External dependencies
|
|
4
4
|
*/
|
|
@@ -1128,4 +1128,4 @@ async function testPortNumberValidation( portName, value, envText = '' ) {
|
|
|
1128
1128
|
}
|
|
1129
1129
|
jest.clearAllMocks();
|
|
1130
1130
|
}
|
|
1131
|
-
/* eslint-enable jest/no-
|
|
1131
|
+
/* eslint-enable jest/no-conditional-expect */
|
package/lib/init-config.js
CHANGED
|
@@ -98,6 +98,41 @@ module.exports = async function initConfig( {
|
|
|
98
98
|
return config;
|
|
99
99
|
};
|
|
100
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Checks the configured PHP version
|
|
103
|
+
* against the minimum version supported by Xdebug
|
|
104
|
+
*
|
|
105
|
+
* @param {WPConfig} config
|
|
106
|
+
* @return {boolean} Whether the PHP version is supported by Xdebug
|
|
107
|
+
*/
|
|
108
|
+
function checkXdebugPhpCompatibility( config ) {
|
|
109
|
+
// By default, an undefined phpVersion uses the version on the docker image,
|
|
110
|
+
// which is supported by Xdebug 3.
|
|
111
|
+
const phpCompatibility = true;
|
|
112
|
+
|
|
113
|
+
// If PHP version is defined
|
|
114
|
+
// ensure it meets the Xdebug minimum compatibility requirment
|
|
115
|
+
if ( config.env.development.phpVersion ) {
|
|
116
|
+
const versionTokens = config.env.development.phpVersion.split( '.' );
|
|
117
|
+
const majorVer = parseInt( versionTokens[ 0 ] );
|
|
118
|
+
const minorVer = parseInt( versionTokens[ 1 ] );
|
|
119
|
+
|
|
120
|
+
if ( isNaN( majorVer ) || isNaN( minorVer ) ) {
|
|
121
|
+
throw new Error(
|
|
122
|
+
'Something went wrong when parsing the PHP version.'
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Xdebug 3 supports 7.2 and higher
|
|
127
|
+
// Ensure user has specified a compatible PHP version
|
|
128
|
+
if ( majorVer < 7 || ( majorVer === 7 && minorVer < 2 ) ) {
|
|
129
|
+
throw new Error( 'Cannot use XDebug 3 on PHP < 7.2.' );
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return phpCompatibility;
|
|
134
|
+
}
|
|
135
|
+
|
|
101
136
|
/**
|
|
102
137
|
* Generates the Dockerfile used by wp-env's development instance.
|
|
103
138
|
*
|
|
@@ -107,20 +142,14 @@ module.exports = async function initConfig( {
|
|
|
107
142
|
* @return {string} The dockerfile contents.
|
|
108
143
|
*/
|
|
109
144
|
function dockerFileContents( image, config ) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if ( config.
|
|
114
|
-
const
|
|
115
|
-
const majorVersion = parseInt( versionTokens[ 0 ] );
|
|
116
|
-
const minorVersion = parseInt( versionTokens[ 1 ] );
|
|
117
|
-
if ( isNaN( majorVersion ) || isNaN( minorVersion ) ) {
|
|
118
|
-
throw new Error( 'Something went wrong parsing the php version.' );
|
|
119
|
-
}
|
|
145
|
+
// Don't install XDebug unless it is explicitly required
|
|
146
|
+
let shouldInstallXdebug = false;
|
|
147
|
+
|
|
148
|
+
if ( config.xdebug !== 'off' ) {
|
|
149
|
+
const usingCompatiblePhp = checkXdebugPhpCompatibility( config );
|
|
120
150
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
shouldInstallXdebug = false;
|
|
151
|
+
if ( usingCompatiblePhp ) {
|
|
152
|
+
shouldInstallXdebug = true;
|
|
124
153
|
}
|
|
125
154
|
}
|
|
126
155
|
|
|
@@ -140,7 +169,8 @@ function installXdebug( enableXdebug ) {
|
|
|
140
169
|
|
|
141
170
|
return `
|
|
142
171
|
# Install Xdebug:
|
|
143
|
-
RUN pecl
|
|
172
|
+
RUN if [ -z "$(pecl list | grep xdebug)" ] ; then pecl install xdebug ; fi
|
|
173
|
+
RUN docker-php-ext-enable xdebug
|
|
144
174
|
RUN echo 'xdebug.start_with_request=yes' >> /usr/local/etc/php/php.ini
|
|
145
175
|
RUN echo 'xdebug.mode=${ enableXdebug }' >> /usr/local/etc/php/php.ini
|
|
146
176
|
RUN echo '${ clientDetectSettings }' >> /usr/local/etc/php/php.ini
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/env",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.4-next.33ec3857e2.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": "51c7917ea7fac72953702f24d6daac87d99e7617"
|
|
55
55
|
}
|