-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add wp-env
After Setup Command
#50196
Add wp-env
After Setup Command
#50196
Conversation
The `config` test files are under `lib/config` but the `lib` test files are under the root. This moves them to be consistent with the other test files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one or two minor comments, but this is looking pretty good! It also tests well.
packages/env/lib/config/test/__snapshots__/config-integration.js.snap
Outdated
Show resolved
Hide resolved
Another tip is that instead of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, this looks good to me! I have one non-blocking concern, which is that the sometimes-executed sometimes-not behavior might be confusing to end users. But I agree that the behavior in the PR makes the most sense given how wp-env start works.
What?
This pull request will execute a new lifecycle script,
afterSetup
, whenever WordPress is configured. It will run on:wp-env start
: Runs when the cache is invalidated and WordPress is configured.wp-env clean
: Runs after the environment is cleaned.Why?
By allowing users to run their own command after installation, they will be able to define setup scripts and the like that perform additional processing on the environment post-setup.
How?
We've added an
afterSetup
option that can be set at the root of a.wp-env.json
file. This option can also be overridden using theWP_ENV_AFTER_SETUP
environment variable.Testing Instructions
.wp-env.override.json
to include:npm run env -- start --update
and verify thatTest
is printed once.npm run env -- start --update --no-execute-scripts
and verify thatTest
is not printed.WP_ENV_AFTER_SETUP="ls -la" npm run env -- start --update
and verify that the Gutenberg directory is printed once.npm run env -- clean
and verify thatTest
is printed once.npm run env -- clean --no-execute-scripts
and verify thatTest
is not printed.