@wordpress/env 10.16.0 → 10.18.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
CHANGED
|
@@ -479,17 +479,20 @@ You can customize the WordPress installation, plugins and themes that the develo
|
|
|
479
479
|
|
|
480
480
|
`.wp-env.json` supports fields for options applicable to both the tests and development instances.
|
|
481
481
|
|
|
482
|
-
| Field
|
|
483
|
-
|
|
484
|
-
| `"core"`
|
|
485
|
-
| `"phpVersion"`
|
|
486
|
-
| `"plugins"`
|
|
487
|
-
| `"themes"`
|
|
488
|
-
| `"port"`
|
|
489
|
-
| `"testsPort"`
|
|
490
|
-
| `"config"`
|
|
491
|
-
| `"mappings"`
|
|
492
|
-
| `"mysqlPort"`
|
|
482
|
+
| Field | Type | Default | Description |
|
|
483
|
+
|----------------------|----------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|
|
|
484
|
+
| `"core"` | `string\|null` | `null` | The WordPress installation to use. If `null` is specified, `wp-env` will use the latest production release of WordPress. |
|
|
485
|
+
| `"phpVersion"` | `string\|null` | `null` | The PHP version to use. If `null` is specified, `wp-env` will use the default version used with production release of WordPress. |
|
|
486
|
+
| `"plugins"` | `string[]` | `[]` | A list of plugins to install and activate in the environment. |
|
|
487
|
+
| `"themes"` | `string[]` | `[]` | A list of themes to install in the environment. |
|
|
488
|
+
| `"port"` | `integer` | `8888` (`8889` for the tests instance) | The primary port number to use for the installation. You'll access the instance through the port: 'http://localhost:8888'. |
|
|
489
|
+
| `"testsPort"` | `integer` | `8889` | The port number for the test site. You'll access the instance through the port: 'http://localhost:8889'. |
|
|
490
|
+
| `"config"` | `Object` | See below. | Mapping of wp-config.php constants to their desired values. |
|
|
491
|
+
| `"mappings"` | `Object` | `"{}"` | Mapping of WordPress directories to local directories to be mounted in the WordPress instance. |
|
|
492
|
+
| `"mysqlPort"` | `integer` | `null` (randomly assigned) | The MySQL port number to expose. The setting is only available in the `env.development` and `env.tests` objects. |
|
|
493
|
+
| `"phpmyadminPort"` | `integer` | `null` | The port number for phpMyAdmin. If provided, you'll access phpMyAdmin through: http://localhost:<port> |
|
|
494
|
+
| `"multisite"` | `boolean` | `false` | Whether to set up a multisite installation. |
|
|
495
|
+
| `"lifecycleScripts"` | `Object` | `"{}"` | Mapping of commands that should be executed at certain points in the lifecycle. |
|
|
493
496
|
|
|
494
497
|
_Note: the port number environment variables (`WP_ENV_PORT` and `WP_ENV_TESTS_PORT`) take precedent over the .wp-env.json values._
|
|
495
498
|
|
|
@@ -523,7 +526,8 @@ Additionally, the key `env` is available to override any of the above options on
|
|
|
523
526
|
"KEY_1": false
|
|
524
527
|
},
|
|
525
528
|
"port": 3000,
|
|
526
|
-
"mysqlPort": 13306
|
|
529
|
+
"mysqlPort": 13306,
|
|
530
|
+
"phpmyadminPort": 9001
|
|
527
531
|
}
|
|
528
532
|
}
|
|
529
533
|
}
|
|
@@ -688,7 +692,12 @@ You can tell `wp-env` to use a custom port number so that your instance does not
|
|
|
688
692
|
}
|
|
689
693
|
```
|
|
690
694
|
|
|
691
|
-
These can also be set via
|
|
695
|
+
These can also be set via environment variables:
|
|
696
|
+
|
|
697
|
+
- `WP_ENV_PORT` to override the development environment's web server's port.
|
|
698
|
+
- `WP_ENV_TESTS_PORT` to override the testing environment's web server's port.
|
|
699
|
+
- phpMyAdmin is not enabled by default, but its port can also be overridden for the development and testing environments via `WP_ENV_PHPMYADMIN_PORT` and `WP_ENV_TESTS_PHPMYADMIN_PORT`, respectively.
|
|
700
|
+
- By default, MySQL aren't exposed to the host, which means no chance of port conflicts. But these can also be overridden for the development and testing environments via `WP_ENV_MYSQL_PORT` and `WP_ENV_TESTS_MYSQL_PORT`, respectively.
|
|
692
701
|
|
|
693
702
|
### Specific PHP Version
|
|
694
703
|
|
|
@@ -701,6 +710,17 @@ You can tell `wp-env` to use a specific PHP version for compatibility and testin
|
|
|
701
710
|
}
|
|
702
711
|
```
|
|
703
712
|
|
|
713
|
+
### Multisite support
|
|
714
|
+
|
|
715
|
+
You can tell `wp-env` if the site should be multisite enabled. This can also be set via the environment variable `WP_ENV_MULTISITE`.
|
|
716
|
+
|
|
717
|
+
```json
|
|
718
|
+
{
|
|
719
|
+
"multisite": true,
|
|
720
|
+
"plugins": [ "." ]
|
|
721
|
+
}
|
|
722
|
+
```
|
|
723
|
+
|
|
704
724
|
### Node Lifecycle Script
|
|
705
725
|
|
|
706
726
|
This is useful for performing some actions after setting up the environment, such as bootstrapping an E2E test environment.
|
|
@@ -23,6 +23,7 @@ const { checkPort, checkVersion, checkString } = require( './validate-config' );
|
|
|
23
23
|
* @property {?number} phpmyadminPort An override for the development environment's phpMyAdmin port.
|
|
24
24
|
* @property {?WPSource} coreSource An override for all environment's coreSource.
|
|
25
25
|
* @property {?string} phpVersion An override for all environment's PHP version.
|
|
26
|
+
* @property {?boolean} multisite An override for if environmen should be multisite.
|
|
26
27
|
* @property {?Object.<string, string>} lifecycleScripts An override for various lifecycle scripts.
|
|
27
28
|
*/
|
|
28
29
|
|
|
@@ -68,6 +69,10 @@ module.exports = function getConfigFromEnvironmentVars( cacheDirectoryPath ) {
|
|
|
68
69
|
environmentConfig.phpVersion = process.env.WP_ENV_PHP_VERSION;
|
|
69
70
|
}
|
|
70
71
|
|
|
72
|
+
if ( process.env.WP_ENV_MULTISITE ) {
|
|
73
|
+
environmentConfig.multisite = !! process.env.WP_ENV_MULTISITE;
|
|
74
|
+
}
|
|
75
|
+
|
|
71
76
|
return environmentConfig;
|
|
72
77
|
};
|
|
73
78
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/env",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.18.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",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"scripts": {
|
|
56
56
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "afe4fb333177642180ac020f1030c5685eab7183"
|
|
59
59
|
}
|