Skip to content
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

Merged
merged 3 commits into from Sep 6, 2019
Merged

feat: make it possible to merge configurations when extending other config. #1411

merged 3 commits into from Sep 6, 2019

Conversation

soulgalore
Copy link
Contributor

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

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
yargs.js Outdated Show resolved Hide resolved
lib/apply-extends.js Outdated Show resolved Hide resolved
@bcoe
Copy link
Member

bcoe commented Aug 26, 2019

@soulgalore thanks for the patch 👍 might be a few days before I can review.

lib/apply-extends.js Outdated Show resolved Hide resolved
lib/apply-extends.js Outdated Show resolved Hide resolved
lib/apply-extends.js Outdated Show resolved Hide resolved
yargs.js Outdated Show resolved Hide resolved
@soulgalore
Copy link
Contributor Author

@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!

@soulgalore soulgalore changed the title Make it possible to merge configurations when extending other config. feat: Make it possible to merge configurations when extending other config. Aug 30, 2019
Copy link
Member

@mleguen mleguen left a 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()?

@bcoe bcoe changed the title feat: Make it possible to merge configurations when extending other config. feat: make it possible to merge configurations when extending other config. Sep 5, 2019
Copy link
Member

@bcoe bcoe left a 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.

yargs.js Outdated Show resolved Hide resolved
@bcoe bcoe merged commit 5d7ad98 into yargs:master Sep 6, 2019
@bcoe
Copy link
Member

bcoe commented Sep 6, 2019

@soulgalore could you please try:

npm i yargs@next and let me know if it works for you use-cases?

@soulgalore
Copy link
Contributor Author

Thank you @bcoe ! I've tested and it works great!

@soulgalore soulgalore deleted the merge-extends branch September 7, 2019 07:18
@soulgalore
Copy link
Contributor Author

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
Where the new functionality doesn't work.

I'll add a new test case first thing tomorrow and verify.

@mleguen
Copy link
Member

mleguen commented Sep 11, 2019

@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)

@soulgalore
Copy link
Contributor Author

@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

@mleguen
Copy link
Member

mleguen commented Sep 18, 2019

@soulgalore sorry, it was a problem of outdated dependencies on my side

@bcoe
Copy link
Member

bcoe commented Oct 7, 2019

published in yargs@14.2.0 sorry for the slow cadence lately; thanks for the contribution @soulgalore, let me know if you bump into any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants