Skip to content

Improve env:install command with better configurability and error handling#8931

Closed
westonruter wants to merge 6 commits intoWordPress:trunkfrom
westonruter:trac-63543
Closed

Improve env:install command with better configurability and error handling#8931
westonruter wants to merge 6 commits intoWordPress:trunkfrom
westonruter:trac-63543

Conversation

@westonruter
Copy link
Copy Markdown
Member

@westonruter westonruter commented Jun 6, 2025

Trac ticket: https://core.trac.wordpress.org/ticket/63543

  • Force WP-CLI to use the the wp-config.php in the directory above the src directory via the WP_CONFIG_PATH environment variable read by WP-CLI in the wp_locate_config() function.
  • Update the env:install command to write out the config at the repo root instead of writing it inside of the ABSPATH only then to move it one directory up.
  • Fix JSHint issues.
  • Add error handling to when npm run env:install is executed without having first done npm run env:start (which has tripped me up multiple times), in which case the script will end with an exit code of 1 and emit:
Error: It appears the development environment has not been started. Message: Timed out waiting for: tcp:localhost:8000
Did you forget to do 'npm run env:start'?

Commit Message

Build/Test Tools: Improve env:install command with better configurability and error handling.

  • Force WP-CLI to use the the wp-config.php in the directory above the src directory via the WP_CONFIG_PATH environment variable read by WP-CLI in the wp_locate_config() function.
  • Update the env:install command to write out the config at the repo root instead of writing it inside of the ABSPATH only then to move it one directory up.
  • Fix JSHint issues.
  • Add error handling to when npm run env:install is executed without having first done npm run env:start (which has tripped me up multiple times), in which case the script will end with an exit code of 1 and emit:

Error: It appears the development environment has not been started. Message: Timed out waiting for: tcp:localhost:8000
Did you forget to do 'npm run env:start'?

Fixes #63543.
Props westonruter, jorbin, SirLouen.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@westonruter westonruter requested a review from johnbillion June 6, 2025 20:50
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 6, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props westonruter, jorbin.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 6, 2025

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@westonruter westonruter requested a review from desrosj June 9, 2025 21:21
@westonruter westonruter changed the title Set WP_CONFIG_PATH environment variable in cli container Improve env:install command with better configurability and error handling Jun 9, 2025
@westonruter westonruter requested a review from aaronjorbin June 9, 2025 21:23
Comment thread docker-compose.yml Outdated
Copy link
Copy Markdown
Member

@aaronjorbin aaronjorbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One suggested change, otherwise this looks good to me.

westonruter and others added 2 commits June 12, 2025 12:49
Co-authored-by: Aaron Jorbin <aaronjorbin@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 60305
GitHub commit: 6ac0efd

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants