Skip to content

Commit

Permalink
Replaced beforeDestroy With afterDestroy
Browse files Browse the repository at this point in the history
  • Loading branch information
ObliviousHarmony committed May 18, 2023
1 parent 9c3a0f7 commit 318b5cf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/env/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

### New feature

- Add `afterStart`, `afterClean`, and `beforeDestroy` lifecycle scripts to a new `lifecycleScripts` key in `.wp-env.json`.
- Add `afterStart`, `afterClean`, and `afterDestroy` lifecycle scripts to a new `lifecycleScripts` key in `.wp-env.json`.
- Add a series of `WP_ENV_LIFECYCLE_SCRIPT_` environment variables for the various lifecycle scripts.

### Enhancement
Expand Down
2 changes: 1 addition & 1 deletion packages/env/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ build won't break on subsequent executions.

* `afterStart`: Runs after `wp-env start` has finished setting up the environment.
* `afterClean`: Runs after `wp-env clean` has finished cleaning the environment.
* `beforeDestroy`: Runs before `wp-env destroy` begins destroying anything.
* `afterDestroy`: Runs after `wp-env destroy` has destroyed the environment.

## Examples

Expand Down
8 changes: 4 additions & 4 deletions packages/env/lib/commands/destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ module.exports = async function destroy( { spinner, scripts, debug } ) {
return;
}

if ( scripts ) {
await executeLifecycleScript( 'beforeDestroy', config, spinner );
}

spinner.text = 'Removing docker images, volumes, and networks.';

await dockerCompose.down( {
Expand All @@ -76,5 +72,9 @@ module.exports = async function destroy( { spinner, scripts, debug } ) {
await new Promise( ( resolve ) => setTimeout( resolve, 10000 ) );
await rimraf( config.workDirectoryPath );

if ( scripts ) {
await executeLifecycleScript( 'afterDestroy', config, spinner );
}

spinner.text = 'Removed WordPress environment.';
};

0 comments on commit 318b5cf

Please sign in to comment.