Iterate on .env
files: make the behavior override
#10094
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow up to #10093. After discussing with @orta, the
--add-env-files
flag being additive instead of overriding wasn't a sticking point in the original implementation, and the more feedback I get, it seems like most people expect later files to override earlier ones, so let's switch the behavior.In tandem, at first I tried to rename the flag back to just
--env-file
or--env-files
, but I'm afraid both give this cryptic error:The above was with my framework changes. I tried it again without my framework changes and the error persists. As far as I can tell,
rw
never executes and it seems like the Node.js binary itself is evaluating the--env-file
flag. It supports--env-file
now, and expects it to be a full path (so.env.prod
). But this isn't how I thought node processesprocess.argv
at all... I thought that all flags would've been passed to the script (here,rw
) for processing. But maybe not, and if so that means we can just pass options to node viayarn rw --my-node-option
. Which I still don't quite believe and if it is true, then I'm not sure what to make of yet cause people have been wanting to pass node options for a while and I always thoughtNODE_OPTIONS="--my-node-option" yarn rw ...
was the only way.So TL;DR, that's why I've left the name here and I'd like to keep that friction point out of the scope of this PR being considered mergeable.