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
feat: make it possible to merge configurations when extending other config. #1411
Conversation
Default behavoir is as before. But you can add 'merge-extends': true to your parser configuration that will change so that configurations will be deeply merged instead of overwritten per key. #1363
@soulgalore thanks for the patch 👍 might be a few days before I can review. |
@mleguen Thanks for taking the time to review! I've pushed an updated version, please let me know if there's something else I missed! |
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.
Thank you @soulgalore.
Would you mind updating the doc too, to add en entry for the new mergeExtends()
function and a word about its effects in config()
?
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.
This is looking slick to me 👍
My main nit is I think we should configure this with parserConfiguration
rather than introducing a new method on yargs
.
@soulgalore could you please try:
|
Thank you @bcoe ! I've tested and it works great! |
One thing though @bcoe - when I tested at work I run into an issue of a three step extend described here: https://phabricator.wikimedia.org/T232467 I'll add a new test case first thing tomorrow and verify. |
@bcoe @soulgalore one of the tests added by this PR breaks on master branch :-( 559 passing (37s)
1 failing
1) yargs dsl tests
config
extends
deep merges configs when extending when deep-merge-config=true:
AssertionError: expected 1 to deeply equal [ 1 ]
at Context.it (test\yargs.js:1398:25) |
@mleguen Can you share some more context? It works when I tested on my local machine with a fresh checkout just now and on Travis: https://travis-ci.org/yargs/yargs/builds/581897033 |
@soulgalore sorry, it was a problem of outdated dependencies on my side |
published in |
Default behavoir is as before. But you can add 'merge-extends': true
to your parser configuration that will change so that configurations
will be deeply merged instead of overwritten per key.
See #1363