question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide option for collect and merge all found configurations

See original GitHub issue

It would be useful to provide the ability to continue searching and collecting configuration files, merging them together instead of finding one and stopping.

Something like this?: collectAndMerge: boolean, default: false

To make this a fully fledged feature it would also be great to provide two modifiers:

  1. collectionFilter ( configs ) => configs, default: return configs
  2. mergeStrategy ( configs ) => config, default: configs.reduce(( config, next ) => Object.assign(config, next))

The default order for priority of merge should probably be closest directory to furthest, first config found to last.

Like this:

/path/to/module/package.json { a: 1 }
/path/to/module/.modulerc { a: 2, b: 2 }
/path/to/.modulerc { a: 3, b: 3, c: 3 }
/.modulerc { a: 4, b: 4, c: 4, d: 4 }
{ a: 1, b: 2, c: 3, d: 4 }

This would mirror the .gitconfig pattern, where it loads the global config, and overrides it with the local directory config. Only this would be more powerful because you can collect directories in between, allowing organizational directories, etc.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
sudo-suhascommented, May 23, 2018

@olsonpm I hear what you are saying. For me, it is 55:45 in favour of the feature. Because it would be nice to have this feature if somebody needs it. eslint is a good example of an use case. This was brought up earlier as well and the reason for not including it was that it was not clear what the logic for merging config files would be. Similar to the recent rewrite which added customisability, this could be done too.

1reaction
chrisblossomcommented, May 23, 2018

@one-humble-cranberry you can use cosmiconfig today without any changes needed. I’ve made a very basic example of how you can accomplish this: chrisblossom/cosmiconfig-all-example.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The current branch is not configured for pull No value for key ...
pull down "Source ref" list, select "testing" branch (pull strategy "merge", "Checkout new branch" checked); click "finish"; Switch to usual ...
Read more >
How to merge Word documents - Office - Microsoft Learn
Select the files to be merged into the current document. Press and hold Ctrl to select more than one document. Note. Documents will...
Read more >
Branching and Merging with GitKraken Client | Git Branching
Merging takes the commits on two different branches and combines them. With a merge, files are automatically merged unless there are two conflicting...
Read more >
merge - Functions - Configuration Language | Terraform
The merge function takes an arbitrary number maps or objects, and returns a single map or object that contains a merged set of...
Read more >
Type Merging – GraphQL Tools
That's it! Under the subschema config merge option, each merged type provides a query for accessing its respective partial type (services ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found