@wordpress/env 4.2.0 → 4.2.2
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 +18 -2
- package/lib/commands/start.js +11 -0
- package/lib/wordpress.js +14 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ Then modify your package.json and add an extra command to npm `scripts` (https:/
|
|
|
51
51
|
When installing `wp-env` in this way, all `wp-env` commands detailed in these docs must be prefixed with `npm run`, for example:
|
|
52
52
|
|
|
53
53
|
```sh
|
|
54
|
-
# You must add another dash to pass the "update" flag to wp-env
|
|
54
|
+
# You must add another double dash to pass the "update" flag to wp-env
|
|
55
55
|
$ npm run wp-env start -- --update
|
|
56
56
|
```
|
|
57
57
|
|
|
@@ -203,6 +203,14 @@ wp-env start
|
|
|
203
203
|
wp-env start --xdebug=profile,trace,debug
|
|
204
204
|
```
|
|
205
205
|
|
|
206
|
+
When you're running `wp-env` using `npm run`, like when working in the Gutenberg repo or when having `wp-env` as a local project dependency, don't forget to add an extra double dash before the `--xdebug` command:
|
|
207
|
+
|
|
208
|
+
```sh
|
|
209
|
+
npm run wp-env start -- --xdebug
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
If you forget about that, the `--xdebug` parameter will be passed to NPM instead of the `wp-env start` command and it will be ignored.
|
|
213
|
+
|
|
206
214
|
You can see a reference on each of the Xdebug modes and what they do in the [Xdebug documentation](https://xdebug.org/docs/all_settings#mode).
|
|
207
215
|
|
|
208
216
|
_Since we are only installing Xdebug 3, Xdebug is only supported for PHP versions greater than or equal to 7.2 (the default). Xdebug won't be installed if `phpVersion` is set to a legacy version._
|
|
@@ -225,6 +233,8 @@ You should only have to translate `port` and `pathMappings` to the format used b
|
|
|
225
233
|
}
|
|
226
234
|
```
|
|
227
235
|
|
|
236
|
+
After you create a `.vscode/launch.json` file in your repository, you probably want to add it to your [global gitignore file](https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files#configuring-ignored-files-for-all-repositories-on-your-computer) so that it stays private for you and is not committed to the repository.
|
|
237
|
+
|
|
228
238
|
Once your IDEs Xdebug settings have been enabled, you should just have to launch the debugger, put a breakpoint on any line of PHP code, and then refresh your browser!
|
|
229
239
|
|
|
230
240
|
Here is a summary:
|
|
@@ -621,4 +631,10 @@ You can tell `wp-env` to use a specific PHP version for compatibility and testin
|
|
|
621
631
|
}
|
|
622
632
|
```
|
|
623
633
|
|
|
624
|
-
|
|
634
|
+
## Contributing to this package
|
|
635
|
+
|
|
636
|
+
This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/) and used by [WordPress](https://make.wordpress.org/core/) as well as other software projects.
|
|
637
|
+
|
|
638
|
+
To find out more about contributing to this package or Gutenberg as a whole, please read the project's main [contributor guide](https://github.com/WordPress/gutenberg/tree/HEAD/CONTRIBUTING.md).
|
|
639
|
+
|
|
640
|
+
<br /><br /><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>
|
package/lib/commands/start.js
CHANGED
|
@@ -174,6 +174,7 @@ module.exports = async function start( { spinner, debug, update, xdebug } ) {
|
|
|
174
174
|
|
|
175
175
|
const siteUrl = config.env.development.config.WP_SITEURL;
|
|
176
176
|
const e2eSiteUrl = config.env.tests.config.WP_TESTS_DOMAIN;
|
|
177
|
+
|
|
177
178
|
const { out: mySQLAddress } = await dockerCompose.port(
|
|
178
179
|
'mysql',
|
|
179
180
|
3306,
|
|
@@ -181,6 +182,13 @@ module.exports = async function start( { spinner, debug, update, xdebug } ) {
|
|
|
181
182
|
);
|
|
182
183
|
const mySQLPort = mySQLAddress.split( ':' ).pop();
|
|
183
184
|
|
|
185
|
+
const { out: testsMySQLAddress } = await dockerCompose.port(
|
|
186
|
+
'tests-mysql',
|
|
187
|
+
3306,
|
|
188
|
+
dockerComposeConfig
|
|
189
|
+
);
|
|
190
|
+
const testsMySQLPort = testsMySQLAddress.split( ':' ).pop();
|
|
191
|
+
|
|
184
192
|
spinner.prefixText = 'WordPress development site started'
|
|
185
193
|
.concat( siteUrl ? ` at ${ siteUrl }` : '.' )
|
|
186
194
|
.concat( '\n' )
|
|
@@ -188,6 +196,9 @@ module.exports = async function start( { spinner, debug, update, xdebug } ) {
|
|
|
188
196
|
.concat( e2eSiteUrl ? ` at ${ e2eSiteUrl }` : '.' )
|
|
189
197
|
.concat( '\n' )
|
|
190
198
|
.concat( `MySQL is listening on port ${ mySQLPort }` )
|
|
199
|
+
.concat(
|
|
200
|
+
`MySQL for automated testing is listening on port ${ testsMySQLPort }`
|
|
201
|
+
)
|
|
191
202
|
.concat( '\n' );
|
|
192
203
|
|
|
193
204
|
spinner.text = 'Done!';
|
package/lib/wordpress.js
CHANGED
|
@@ -42,7 +42,20 @@ async function checkDatabaseConnection( { dockerComposeConfigPath, debug } ) {
|
|
|
42
42
|
* @param {Object} spinner A CLI spinner which indicates progress.
|
|
43
43
|
*/
|
|
44
44
|
async function configureWordPress( environment, config, spinner ) {
|
|
45
|
-
const
|
|
45
|
+
const url = ( () => {
|
|
46
|
+
const port = config.env[ environment ].port;
|
|
47
|
+
const domain =
|
|
48
|
+
environment === 'tests'
|
|
49
|
+
? config.env.tests.config.WP_TESTS_DOMAIN
|
|
50
|
+
: config.env.development.config.WP_SITEURL;
|
|
51
|
+
if ( port === 80 ) {
|
|
52
|
+
return domain;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return `${ domain }:${ port }`;
|
|
56
|
+
} )();
|
|
57
|
+
|
|
58
|
+
const installCommand = `wp core install --url="${ url }" --title="${ config.name }" --admin_user=admin --admin_password=password --admin_email=wordpress@example.com --skip-email`;
|
|
46
59
|
|
|
47
60
|
// -eo pipefail exits the command as soon as anything fails in bash.
|
|
48
61
|
const setupCommands = [ 'set -eo pipefail', installCommand ];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/env",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.2",
|
|
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": "4566ac290359553d04de4eb574545309343f790b"
|
|
55
55
|
}
|