Provide option for collect and merge all found configurations
See original GitHub issueIt 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:
- collectionFilter
( configs ) => configs
, default:return configs
- 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:
- Created 5 years ago
- Reactions:2
- Comments:10 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
@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.