New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: handle npm prefix config environment variables #7070
Changes from 4 commits
d4be564
8ea424e
93ff317
8db4c1b
1bdc281
be1808d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,8 +170,8 @@ export default class BaseRegistry { | |
// replace dunders with dots | ||
key = key.replace(/__/g, '.'); | ||
|
||
// replace underscores with dashes | ||
key = key.replace(/_/g, '-'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you instead add it in a more generic way that supports For example: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good idea. We're probably assuming any key starting with an underscore needs to stay an underscore, but that's probably always true There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @arcanis Are the changes satisfactory? |
||
// replace underscores with dashes ignoring keys that start with an underscore | ||
key.replace(/([^_])_/g, '$1-'); | ||
|
||
// set it via a path | ||
objectPath.set(this.config, key, val); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had trouble figuring out where these tests should go.
mergeEnv
is an instance method that requires a whole mocked registry to test.Simplifying this test would involve refactoring the
mergeEnv
method to use a utility method, but I decided to reduce the changes to the code and instead have a more complicated test