@jepz20/conman
Advanced tools
Comparing version 0.0.6 to 0.0.7
{ | ||
"name": "@jepz20/conman", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Configuration manager that supports ttl and plugabble sources", | ||
@@ -17,3 +17,3 @@ "main": "./src/conman", | ||
}, | ||
"gitHead": "71f94a800cc512bd74269e165a466e722efbe23a", | ||
"gitHead": "349fbbbbe10fe177bab4de63d6c81d8ec7b06b78", | ||
"lint-staged": { | ||
@@ -20,0 +20,0 @@ "src/**/*.*": [ |
@@ -160,2 +160,3 @@ const { mergeDeepRight } = require('ramda'); | ||
const sourcesTypes = _sources.map(({ name, type }) => name || type); | ||
const sourcesKeys = _sources.map(source => source.key); | ||
logger( | ||
@@ -170,3 +171,7 @@ 'log', | ||
); | ||
return configs.reduce((acc, config) => { | ||
return configs.reduce((acc, config, index) => { | ||
const sourceKey = sourcesKeys[index]; | ||
if (sourceKey) { | ||
return mergeDeepRight(acc, { [sourceKey]: config }); | ||
} | ||
return mergeDeepRight(acc, config); | ||
@@ -173,0 +178,0 @@ }, {}); |
@@ -6,3 +6,3 @@ jest.mock('jsonfile'); | ||
const source = obj => { | ||
const source = (obj, { key, name } = {}) => { | ||
return { | ||
@@ -12,3 +12,5 @@ build() { | ||
}, | ||
type: 'syncSource' | ||
type: 'syncSource', | ||
key, | ||
name | ||
}; | ||
@@ -43,3 +45,3 @@ }; | ||
it('should build with one synchronous source', async () => { | ||
it('should build with one asynchronous source', async () => { | ||
const source1 = asyncSource({ test: 'test' }); | ||
@@ -53,3 +55,12 @@ const config = await conman() | ||
it('should build with one asynchronous source', async () => { | ||
it('should build with one synchronous source and use the key', async () => { | ||
const source1 = source({ test: 'test' }, { key: 'TEST' }); | ||
const config = await conman() | ||
.addSource(source1) | ||
.build(); | ||
conman.stop(); | ||
expect(config).toEqual({ TEST: { test: 'test' } }); | ||
}); | ||
it('should build with one synchronous source', async () => { | ||
const source1 = source({ test: 'test async' }); | ||
@@ -56,0 +67,0 @@ const config = await conman() |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
263122
684