@wordpress/env 4.4.0 → 4.6.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
@@ -534,9 +534,9 @@ This is useful for plugin development.
534
534
  }
535
535
  ```
536
536
 
537
- #### Latest development WordPress + current directory as a plugin
537
+ ### Latest development WordPress + current directory as a plugin
538
538
 
539
- This is useful for plugin development when upstream Core changes need to be tested.
539
+ This is useful for plugin development when upstream Core changes need to be tested. This can also be set via the environment variable `WP_ENV_CORE`.
540
540
 
541
541
  ```json
542
542
  {
@@ -13,6 +13,7 @@ const detectDirectoryType = require( './detect-directory-type' );
13
13
  const { validateConfig, ValidationError } = require( './validate-config' );
14
14
  const readRawConfigFile = require( './read-raw-config-file' );
15
15
  const parseConfig = require( './parse-config' );
16
+ const { includeTestsPath, parseSourceString } = parseConfig;
16
17
  const md5 = require( '../md5' );
17
18
 
18
19
  /**
@@ -256,6 +257,18 @@ function withOverrides( config ) {
256
257
  getNumberFromEnvVariable( 'WP_ENV_TESTS_PORT' ) ||
257
258
  config.env.tests.port;
258
259
 
260
+ // Override WordPress core with environment variable.
261
+ if ( process.env.WP_ENV_CORE ) {
262
+ const coreSource = includeTestsPath(
263
+ parseSourceString( process.env.WP_ENV_CORE, {
264
+ workDirectoryPath: config.workDirectoryPath,
265
+ } ),
266
+ { workDirectoryPath: config.workDirectoryPath }
267
+ );
268
+ config.env.development.coreSource = coreSource;
269
+ config.env.tests.coreSource = coreSource;
270
+ }
271
+
259
272
  // Override PHP version with environment variable.
260
273
  config.env.development.phpVersion =
261
274
  process.env.WP_ENV_PHP_VERSION || config.env.development.phpVersion;
@@ -136,6 +136,7 @@ function parseSourceString( sourceString, { workDirectoryPath } ) {
136
136
  `Invalid or unrecognized source: "${ sourceString }".`
137
137
  );
138
138
  }
139
+ module.exports.parseSourceString = parseSourceString;
139
140
 
140
141
  /**
141
142
  * Given a source object, returns a new source object with the testsPath
@@ -160,3 +161,4 @@ function includeTestsPath( source, { workDirectoryPath } ) {
160
161
  ),
161
162
  };
162
163
  }
164
+ module.exports.includeTestsPath = includeTestsPath;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/env",
3
- "version": "4.4.0",
3
+ "version": "4.6.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",
@@ -41,7 +41,7 @@
41
41
  "js-yaml": "^3.13.1",
42
42
  "ora": "^4.0.2",
43
43
  "rimraf": "^3.0.2",
44
- "simple-git": "^2.35.0",
44
+ "simple-git": "^3.5.0",
45
45
  "terminal-link": "^2.0.0",
46
46
  "yargs": "^17.3.0"
47
47
  },
@@ -51,5 +51,5 @@
51
51
  "scripts": {
52
52
  "test": "echo \"Error: run tests from root\" && exit 1"
53
53
  },
54
- "gitHead": "aa003c3634016cc4ab6348b2106907e371c648e1"
54
+ "gitHead": "1ba52312b56db563df2d8d4fba5b00613fb46d8c"
55
55
  }