Repository navigation
Conversation
The local Docker environment scripts only need the values in `.env` that they
read themselves. Node.js can load a `.env` file natively with
`process.loadEnvFile()`, available since Node.js 20.12, so the `dotenv` and
`dotenv-expand` packages are no longer needed.
Values are no longer expanded. Docker Compose expands `${VAR}` references
itself when it reads `.env`, and the only reference in `.env.example`
(`WP_BASE_URL`) is not read by these scripts.
This also avoids `dotenv-expand` 1000.0.0, which adds command substitution
during expansion.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Y86gwpKRNgXhhtQMbSgQW
…I helper. The `wpCli()` helper set this so the tips printed by the `dotenv` package did not end up in the WP-CLI output it captures. The local environment scripts now load `.env` with `process.loadEnvFile()`, which prints nothing, so the variable no longer does anything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
…ve-loadenvfile # Conflicts: # .env.example
…`load_env()`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
The local Docker environment scripts (
env:start,env:install,env:cli, and the rest that go throughdocker.js) useddotenvanddotenv-expandto read.envintoprocess.env. Node.js can do this itself withprocess.loadEnvFile(), and the minimum Node.js version (24.18) supports it, so both packages are removed.This also avoids
dotenv-expand1000.0.0, which adds command substitution during expansion.This adds a
load_env()helper that the local environment scripts now use, and removes the leftoverDOTENV_CONFIG_QUIETsettings.Behavior
.env..env.exampleuses a${VAR}reference, and Docker Compose still expands values itself when it reads.env..envis silent, becauseensure_env_file()already reports it. Any other read error prints a warning and the command keeps running, asensure_env_file()does..envfiles are fine. A leftoverDOTENV_CONFIG_QUIET=trueline does nothing.Testing
.envgives the expected values (LOCAL_PORT=8889,LOCAL_DIR=src, …).LOCAL_PORT=9999in the shell overrides the value in.env..envproduces no output. An unreadable.envprints the warning and the script keeps running.jshintpasses ontools/local-env/scripts/.npm ls dotenv dotenv-expandis empty.AI Usage
This patch was written with Claude Code and reviewed by me.
🤖 Generated with Claude Code