@wordpress/env 4.5.1 → 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 +2 -2
- package/lib/config/config.js +13 -0
- package/lib/config/parse-config.js +2 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -534,9 +534,9 @@ This is useful for plugin development.
|
|
|
534
534
|
}
|
|
535
535
|
```
|
|
536
536
|
|
|
537
|
-
|
|
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
|
{
|
package/lib/config/config.js
CHANGED
|
@@ -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.
|
|
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",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"scripts": {
|
|
52
52
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "1ba52312b56db563df2d8d4fba5b00613fb46d8c"
|
|
55
55
|
}
|