@incanta/config
Advanced tools
Comparing version 0.5.9 to 0.5.10
@@ -8,7 +8,8 @@ #!/usr/bin/env node | ||
const child_process_1 = require("child_process"); | ||
const lodash_merge_1 = __importDefault(require("lodash.merge")); | ||
const lodash_mergewith_1 = __importDefault(require("lodash.mergewith")); | ||
const index_1 = __importDefault(require("./index")); | ||
const merge_customizer_1 = require("./merge-customizer"); | ||
const command = process.argv.slice(2).join(" "); | ||
const env = {}; | ||
(0, lodash_merge_1.default)(env, process.env, index_1.default.getConfiguredEnv()); | ||
(0, lodash_mergewith_1.default)(env, process.env, index_1.default.getConfiguredEnv(), merge_customizer_1.mergeWithCustomizer); | ||
(0, child_process_1.execSync)(command, { | ||
@@ -15,0 +16,0 @@ env, |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const lodash_merge_1 = __importDefault(require("lodash.merge")); | ||
const lodash_mergewith_1 = __importDefault(require("lodash.mergewith")); | ||
const path_1 = __importDefault(require("path")); | ||
@@ -12,2 +12,3 @@ const fs_1 = __importDefault(require("fs")); | ||
const provider_1 = require("./secrets/provider"); | ||
const merge_customizer_1 = require("./merge-customizer"); | ||
class Config { | ||
@@ -69,3 +70,3 @@ configDir = ""; | ||
const overrideValues = loader_1.Loader.loadFile(path_1.default.join(this.configDir, "override.json"), {}); | ||
(0, lodash_merge_1.default)(this.values, defaultValues.data, envValues.data, overrideValues); | ||
(0, lodash_mergewith_1.default)(this.values, defaultValues.data, envValues.data, overrideValues, merge_customizer_1.mergeWithCustomizer); | ||
this.values = loader_1.Loader.convertKebabToCamelCase(this.values, configFolderOptions); | ||
@@ -119,3 +120,3 @@ this.normalizedValues = this.normalizeObject(this.values, []); | ||
} | ||
let obj = (0, lodash_merge_1.default)({}, this.normalizedValues); | ||
let obj = (0, lodash_mergewith_1.default)({}, this.normalizedValues, merge_customizer_1.mergeWithCustomizer); | ||
for (const part of keyParts) { | ||
@@ -214,3 +215,3 @@ // convert to camelCase first | ||
} | ||
let obj = (0, lodash_merge_1.default)({}, this.values); | ||
let obj = (0, lodash_mergewith_1.default)({}, this.values, merge_customizer_1.mergeWithCustomizer); | ||
const keyParts = keyToFetchValue.split("."); | ||
@@ -264,3 +265,3 @@ for (const part of keyParts) { | ||
} | ||
const newObj = (0, lodash_merge_1.default)({}, obj); | ||
const newObj = (0, lodash_mergewith_1.default)({}, obj, merge_customizer_1.mergeWithCustomizer); | ||
for (const property of Object.keys(newObj)) { | ||
@@ -298,3 +299,3 @@ const value = newObj[property]; | ||
getJson() { | ||
const values = (0, lodash_merge_1.default)({}, this.normalizedValues); | ||
const values = (0, lodash_mergewith_1.default)({}, this.normalizedValues, merge_customizer_1.mergeWithCustomizer); | ||
return values; | ||
@@ -315,3 +316,3 @@ } | ||
obj[keyParts[keyParts.length - 1]] = value; | ||
(0, lodash_merge_1.default)(this.customValues, obj); | ||
(0, lodash_mergewith_1.default)(this.customValues, obj, merge_customizer_1.mergeWithCustomizer); | ||
} | ||
@@ -318,0 +319,0 @@ async save() { |
@@ -12,3 +12,4 @@ "use strict"; | ||
const js_yaml_1 = __importDefault(require("js-yaml")); | ||
const lodash_merge_1 = __importDefault(require("lodash.merge")); | ||
const lodash_mergewith_1 = __importDefault(require("lodash.mergewith")); | ||
const merge_customizer_1 = require("./merge-customizer"); | ||
class Loader { | ||
@@ -139,3 +140,3 @@ static readConfigSettings(folder) { | ||
}, config); | ||
(0, lodash_merge_1.default)(baseObj, parentResult.data); | ||
(0, lodash_mergewith_1.default)(baseObj, parentResult.data, merge_customizer_1.mergeWithCustomizer); | ||
loadedNames = parentResult.loadedNames; | ||
@@ -145,3 +146,3 @@ } | ||
} | ||
(0, lodash_merge_1.default)(baseObj, Loader.load(folder, options)); | ||
(0, lodash_mergewith_1.default)(baseObj, Loader.load(folder, options), merge_customizer_1.mergeWithCustomizer); | ||
return { | ||
@@ -164,3 +165,3 @@ data: baseObj, | ||
if (!content.isDirectory() && /^_?index\./.exec(content.name) !== null) { | ||
(0, lodash_merge_1.default)(baseObj, Loader.loadFile(path_1.default.join(folder, content.name), options)); | ||
(0, lodash_mergewith_1.default)(baseObj, Loader.loadFile(path_1.default.join(folder, content.name), options), merge_customizer_1.mergeWithCustomizer); | ||
} | ||
@@ -180,3 +181,3 @@ } | ||
const obj = Loader.load(path_1.default.join(folder, content.name), options); | ||
(0, lodash_merge_1.default)(baseObj[key], obj); | ||
(0, lodash_mergewith_1.default)(baseObj[key], obj, merge_customizer_1.mergeWithCustomizer); | ||
} | ||
@@ -195,3 +196,3 @@ else { | ||
const obj = Loader.loadFile(path_1.default.join(folder, content.name), options); | ||
(0, lodash_merge_1.default)(baseObj[key], obj); | ||
(0, lodash_mergewith_1.default)(baseObj[key], obj, merge_customizer_1.mergeWithCustomizer); | ||
} | ||
@@ -198,0 +199,0 @@ else { |
{ | ||
"name": "@incanta/config", | ||
"version": "0.5.9", | ||
"version": "0.5.10", | ||
"main": "lib/index.js", | ||
@@ -25,3 +25,3 @@ "exports": { | ||
"jsonc-parser": "^3.2.0", | ||
"lodash.merge": "^4.6.2" | ||
"lodash.mergewith": "^4.6.2" | ||
}, | ||
@@ -31,3 +31,3 @@ "devDependencies": { | ||
"@types/js-yaml": "^4.0.5", | ||
"@types/lodash.merge": "^4.6.7", | ||
"@types/lodash.mergewith": "^4.6.9", | ||
"@types/node": "^18.11.18", | ||
@@ -34,0 +34,0 @@ "@typescript-eslint/eslint-plugin": "^5.48.0", |
#!/usr/bin/env node | ||
import { execSync } from "child_process"; | ||
import merge from "lodash.merge"; | ||
import mergeWith from "lodash.mergewith"; | ||
import config from "./index"; | ||
import { mergeWithCustomizer } from "./merge-customizer"; | ||
@@ -11,3 +12,3 @@ const command = process.argv.slice(2).join(" "); | ||
merge(env, process.env, config.getConfiguredEnv()); | ||
mergeWith(env, process.env, config.getConfiguredEnv(), mergeWithCustomizer); | ||
@@ -14,0 +15,0 @@ execSync(command, { |
@@ -1,2 +0,2 @@ | ||
import merge from "lodash.merge"; | ||
import mergeWith from "lodash.mergewith"; | ||
import path from "path"; | ||
@@ -6,2 +6,3 @@ import fs from "fs"; | ||
import { GetSecretsProvider, SecretsProviderType } from "./secrets/provider"; | ||
import { mergeWithCustomizer } from "./merge-customizer"; | ||
@@ -112,3 +113,9 @@ export interface IConfigOptions { | ||
merge(this.values, defaultValues.data, envValues.data, overrideValues); | ||
mergeWith( | ||
this.values, | ||
defaultValues.data, | ||
envValues.data, | ||
overrideValues, | ||
mergeWithCustomizer | ||
); | ||
@@ -188,3 +195,3 @@ this.values = Loader.convertKebabToCamelCase( | ||
let obj = merge({}, this.normalizedValues); | ||
let obj = mergeWith({}, this.normalizedValues, mergeWithCustomizer); | ||
@@ -319,3 +326,3 @@ for (const part of keyParts) { | ||
let obj = merge({}, this.values); | ||
let obj = mergeWith({}, this.values, mergeWithCustomizer); | ||
@@ -373,3 +380,3 @@ const keyParts = keyToFetchValue.split("."); | ||
const newObj = merge({}, obj); | ||
const newObj = mergeWith({}, obj, mergeWithCustomizer); | ||
@@ -407,3 +414,3 @@ for (const property of Object.keys(newObj)) { | ||
public getJson(): any { | ||
const values = merge({}, this.normalizedValues); | ||
const values = mergeWith({}, this.normalizedValues, mergeWithCustomizer); | ||
@@ -430,3 +437,3 @@ return values; | ||
merge(this.customValues, obj); | ||
mergeWith(this.customValues, obj, mergeWithCustomizer); | ||
} | ||
@@ -433,0 +440,0 @@ |
@@ -6,4 +6,5 @@ import fs from "fs"; | ||
import YAML from "js-yaml"; | ||
import merge from "lodash.merge"; | ||
import mergeWith from "lodash.mergewith"; | ||
import Config from "./config"; | ||
import { mergeWithCustomizer } from "./merge-customizer"; | ||
@@ -185,3 +186,3 @@ export interface IConfigFolderOptions { | ||
merge(baseObj, parentResult.data); | ||
mergeWith(baseObj, parentResult.data, mergeWithCustomizer); | ||
loadedNames = parentResult.loadedNames; | ||
@@ -192,3 +193,3 @@ } | ||
merge(baseObj, Loader.load(folder, options)); | ||
mergeWith(baseObj, Loader.load(folder, options), mergeWithCustomizer); | ||
@@ -216,5 +217,6 @@ return { | ||
if (!content.isDirectory() && /^_?index\./.exec(content.name) !== null) { | ||
merge( | ||
mergeWith( | ||
baseObj, | ||
Loader.loadFile(path.join(folder, content.name), options) | ||
Loader.loadFile(path.join(folder, content.name), options), | ||
mergeWithCustomizer | ||
); | ||
@@ -240,3 +242,3 @@ } | ||
merge(baseObj[key], obj); | ||
mergeWith(baseObj[key], obj, mergeWithCustomizer); | ||
} else { | ||
@@ -258,3 +260,3 @@ if (/^_?index\./.exec(content.name) !== null) { | ||
merge(baseObj[key], obj); | ||
mergeWith(baseObj[key], obj, mergeWithCustomizer); | ||
} else { | ||
@@ -261,0 +263,0 @@ console.log( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
81814
37
1475
+ Addedlodash.mergewith@^4.6.2
+ Addedlodash.mergewith@4.6.2(transitive)
- Removedlodash.merge@^4.6.2
- Removedlodash.merge@4.6.2(transitive)