wp-env: Add support for different options in each environment#22568
wp-env: Add support for different options in each environment#22568noahtallen merged 23 commits intomasterfrom
Conversation
|
Size Change: +6.1 kB (0%) Total Size: 1.14 MB
ℹ️ View Unchanged
|
packages/env/lib/config.js
Outdated
| * @param {string} workDirectoryPath Absolute path to the environment work dir. | ||
| * @return {Object} the validated and parsed config object. | ||
| */ | ||
| function parseConfig( config, workDirectoryPath ) { |
There was a problem hiding this comment.
parseConfig now validates a WPServiceConfig. this way it can be reused for each environment override. (need to clean up comments around this)
packages/env/lib/config.js
Outdated
| * | ||
| * @param {Object} rawConfig config right after being read from a file. | ||
| */ | ||
| function withBackCompat( rawConfig ) { |
There was a problem hiding this comment.
with the new format, it doesn't make sense to have both port and testsPort. So each WPServiceConfig now has one port property. This function makes sure that existing .wp-env.json files continue working.
|
This is looking great! Let us know when it's ready for a pass :) |
9a6b7e9 to
b3eb6d6
Compare
|
My goal is to get this over the finish line this week. It's taken more time than expected to support multiple core sources. There are some expectations around how the core source is configured that might not always be true any more, so I'm working on solving that |
7e66c8d to
52612d8
Compare
|
@epiqueras this is ready for a look. I think some parts of it could be cleaned up more (e.g. |
Looks good 👍 |
80e0366 to
6c01eb5
Compare
|
@epiqueras this is ready for a thorough look. since config.js was getting pretty large, I moved it into its own directory and split out the functions into a few more files. Everything seems to be working pretty well. The remaining task is to update the tests & docs, but it'd be nice to get feedback on the code |
|
Thanks for the detailed review, @epiqueras! I knew I'd probably miss some things :) |
5e33f65 to
f0a8808
Compare
|
I'm not sure we can use the new null operators in node yet without transpiling 🙃 |
epiqueras
left a comment
There was a problem hiding this comment.
Nice work.
Let's stay alert for any bugs before the next release.
- increase install performance - fix bug in copy source
Thanks macbook Co-authored-by: Enrique Piqueras <epiqueras@users.noreply.github.com>
0dd38ed to
efb0236
Compare
Description
Allows the user to change the options for any WordPress environment in wp-env separately. This refactors the way the config works internally by putting all service-level configuration options into
env.<service>.Note: One subtle difference with parsing behavior is that wp-config values are now merged instead of overwritten.
For example:
WPServiceConfig is just something like:
the
WPServiceConfigcontains all options applicable to the service. For example, if .wp-env.json looks like:{ "plugins": [ "./" ], "env": { "tests": { "themes": [ "./some-theme" ] } } }the config will be merged like so:
As you can see, the base-level plugins option is added to both development and tests.
Practically, in
.wp-env.json, the only thing that changes is that you can override any of the existing options inside ofenv.developmentorenv.tests.Todo:
How has this been tested?
Unit tests, travis, and local testing in my own environment
Types of changes
new feature/refactor
Checklist:
closes #22514