@wordpress/env 10.16.0 → 10.17.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,19 @@ 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 | 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. |
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. |
493
495
 
494
496
  _Note: the port number environment variables (`WP_ENV_PORT` and `WP_ENV_TESTS_PORT`) take precedent over the .wp-env.json values._
495
497
 
@@ -523,7 +525,8 @@ Additionally, the key `env` is available to override any of the above options on
523
525
  "KEY_1": false
524
526
  },
525
527
  "port": 3000,
526
- "mysqlPort": 13306
528
+ "mysqlPort": 13306,
529
+ "phpmyadminPort": 9001
527
530
  }
528
531
  }
529
532
  }
@@ -688,7 +691,12 @@ You can tell `wp-env` to use a custom port number so that your instance does not
688
691
  }
689
692
  ```
690
693
 
691
- These can also be set via the environment variables `WP_ENV_PORT`, `WP_ENV_TESTS_PORT`, `WP_ENV_MYSQL_PORT` and `WP_ENV_TESTS_MYSQL_PORT`.
694
+ These can also be set via environment variables:
695
+
696
+ - `WP_ENV_PORT` to override the development environment's web server's port.
697
+ - `WP_ENV_TESTS_PORT` to override the testing environment's web server's port.
698
+ - 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.
699
+ - 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
700
 
693
701
  ### Specific PHP Version
694
702
 
@@ -701,6 +709,17 @@ You can tell `wp-env` to use a specific PHP version for compatibility and testin
701
709
  }
702
710
  ```
703
711
 
712
+ ### Multisite support
713
+
714
+ You can tell `wp-env` if the site should be multisite enabled. This can also be set via the environment variable `WP_ENV_MULTISITE`.
715
+
716
+ ```json
717
+ {
718
+ "multisite": true,
719
+ "plugins": [ "." ]
720
+ }
721
+ ```
722
+
704
723
  ### Node Lifecycle Script
705
724
 
706
725
  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.16.0",
3
+ "version": "10.17.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": "f48b9f56629e400891abb5ae491504de475237ff"
58
+ "gitHead": "68a831c3178197fe87db284d4b94e5743bfb6b6c"
59
59
  }