@gasket/utils
Advanced tools
Comparing version 6.0.13 to 6.2.0
# `@gasket/utils` | ||
### 6.3.0 | ||
- Fixed issue where an `environments` section of config files was doing proper inheritance of dev environment settings for the `local` environment. | ||
### 6.0.13 | ||
@@ -4,0 +8,0 @@ |
@@ -17,33 +17,27 @@ const path = require('path'); | ||
const { environments = {}, ...baseConfig } = config; | ||
// Iterate over any `.` delimited parts (e.g. `production.subEnv`) and | ||
// merge any corresponding config within `environments` into the | ||
// configuration of this command. | ||
const isLocalEnv = env === 'local'; | ||
const envParts = env.split('.'); | ||
let normalizedConfig = envParts.reduce((acc, part, i) => { | ||
return defaultsDeep({}, | ||
environments[envParts.slice(0, i + 1).join('.')], | ||
acc); | ||
}, baseConfig); | ||
// Special case for the local environment, which inherits from the | ||
// development environment | ||
if (env === 'local') { | ||
const devConfig = environments.development || environments.dev; | ||
if (devConfig) { | ||
normalizedConfig = defaultsDeep({}, normalizedConfig, devConfig); | ||
} | ||
const configs = [ | ||
// For git-ignorable changes, merge in optional `.local` file | ||
if (localFile) { | ||
const localOverrides = tryRequire(path.join(root, localFile)); | ||
if (localOverrides) { | ||
normalizedConfig = defaultsDeep({}, localOverrides, normalizedConfig); | ||
} | ||
} | ||
} | ||
isLocalEnv && localFile && tryRequire(path.join(root, localFile)), | ||
return normalizedConfig; | ||
// Iterate over any `.` delimited parts (e.g. `production.subEnv`) and | ||
// merge any corresponding configs within `environments` | ||
...envParts | ||
.map((_, i) => environments[envParts.slice(0, i + 1).join('.')]) | ||
.reverse(), | ||
// Special case for the local environment, which inherits from the | ||
// development environment | ||
isLocalEnv && (environments.development || environments.dev), | ||
baseConfig | ||
].filter(Boolean); | ||
return defaultsDeep({}, ...configs); | ||
} | ||
module.exports = applyEnvironmentOverrides; |
{ | ||
"name": "@gasket/utils", | ||
"version": "6.0.13", | ||
"version": "6.2.0", | ||
"description": "Reusable utilities for Gasket internals", | ||
@@ -63,4 +63,3 @@ "main": "lib", | ||
"test/fixtures" | ||
], | ||
"gitHead": "538602de36e1704f8ab26d4a8e29b08587b32145" | ||
] | ||
} |
19233
269