fix(config): Use boolifyWithDefault() for bools from environment #4823
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.
Summary
Use
boolifyWithDefault()
to determine if environment variable values aretrue
orfalse
. This ensures that all environment variables interpret the same values the same way.This changes the behavior of
YARN_SILENT
andYARN_IGNORE_PATH
if they have "unexpected" values, all nonempty stings beside"0"
and"false"
are now interpreted astrue
. For exampleYARN_SILENT=hello
was interpreted asfalse
before, now it istrue
. This makes some sense since those values are truthy in Javascript, but generally makes things more predictable if it works like that for all yarn environment variables.YARN_SILENT=true
was also interpreted asfalse
. This now definitely makes more sense since it will be interpreted astrue
.See also #4811.
Test plan
There should be no change to the existing intended functionality and the existing tests still pass.