Repository navigation
wp-env: Fix mixed runtime detection issues - #75057
Conversation
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
6efb54e to
4a41890
Compare
|
Size Change: 0 B Total Size: 3 MB ℹ️ View Unchanged
|
0d53e2c to
6f5409d
Compare
- Store runtime type in cache instead of using file-based detection - Add interactive prompt when switching runtimes (e.g., Docker to Playground) - detectRuntime() now throws EnvironmentNotInitializedError if environment not initialized - Commands (stop, destroy, clean, logs, run) properly handle uninitialized environments Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
6f5409d to
9c6647e
Compare
| shouldDestroy = await confirm( { | ||
| message: `Environment was previously started with '${ savedRuntime }' runtime. Destroy it and start with '${ runtimeName }'?`, | ||
| default: true, | ||
| } ); |
There was a problem hiding this comment.
This isn't a big dea because I don't really care about wp-env (I've long disliked its internals and it's already using plenty of IMO frivolous dependencies), but I'll just point out that this could be achieved with Node's own Readline interface:
const readline = require('node:readline/promises');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: true,
});
(async () => {
const answer = await rl.question('Do you want to continue? (y/n) ');
rl.close();
const ok = /^y(es)?$/i.test(answer.trim());
console.log(ok ? 'Confirmed' : 'Cancelled');
})();There was a problem hiding this comment.
inquirer/prompts is not what I would call frivolous dependencies personally though. It's kind of standard when writing interactive JS tools.
Summary
Fixes issues with mixed runtime detection when switching between Docker and Playground runtimes.
Changes:
wp-env-cache.json) instead of file-based detectiondetectRuntime()now throwsEnvironmentNotInitializedErrorif environment not initializedcli.jsfor cleaner codeTest plan
Fresh start with Docker:
Switch runtime (interactive prompt):
Commands on uninitialized env:
Run existing tests:
🤖 Generated with Claude Code