Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@venncity/nested-config

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@venncity/nested-config - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

8

CHANGELOG.md

@@ -6,4 +6,12 @@ # Change Log

## [1.0.2](https://github.com/venn-city/npm-shelf/compare/@venncity/nested-config@1.0.1...@venncity/nested-config@1.0.2) (2019-05-01)
**Note:** Version bump only for package @venncity/nested-config
## 1.0.1 (2019-04-29)
**Note:** Version bump only for package @venncity/nested-config

4

package.json
{
"name": "@venncity/nested-config",
"version": "1.0.1",
"version": "1.0.2",
"author": "Venn Engineering",

@@ -45,3 +45,3 @@ "main": "src/nestedConfig.js",

},
"gitHead": "bbb33a21af82dcd17bbc7d7b3097b38cbac0af2e"
"gitHead": "86172685d9c7b63ebe9dd9224d112b90703e3ad8"
}

@@ -7,7 +7,13 @@ ![Coverage](https://api.venn.city/production/coverage/badge?branch=master&repository=@venncity/nested-config)

By default the node config overrides the nested packages config files ,
to make it possible to use nested packages config files we need to use this package to extend the default functionality.
Node config does not support getting configuration defined inside a npm package. It always
takes the config from the config files under the working directory so configuration
of packages are ignored.
Example of usage:
const config = require('@venncity/nested-config')(__dirname)
This will load the package configs.
This package merges the configuration defined inside npm packages into the parent config and
so you can get the configuration defined inside packages seamlessly.
#### Usage:
Everywhere you use config in an npm package, require it like so:
`const config = require('@venncity/nested-config')(__dirname)`

@@ -11,3 +11,3 @@ /* eslint-disable no-underscore-dangle,global-require */

describe('get', () => {
describe('Nested config', () => {
afterEach(() => {

@@ -14,0 +14,0 @@ jest.resetModules();

@@ -8,3 +8,3 @@ process.env.ALLOW_CONFIG_MUTATIONS = true;

const initializedRepoNames = new Map();
const packagePathToConfigKeyPrefix = new Map();

@@ -22,5 +22,5 @@ function init(modulePath, packagePath) {

const packageName = path.basename(packagePath);
const configKey = `${packageName}-${createHash(modulePath)}`;
config.util.setModuleDefaults(configKey, baseConfig);
initializedRepoNames.set(packagePath, configKey);
const configKeyPrefix = `${packageName}-${createHash(modulePath)}`;
config.util.setModuleDefaults(configKeyPrefix, baseConfig);
packagePathToConfigKeyPrefix.set(packagePath, configKeyPrefix);
}

@@ -35,8 +35,8 @@

const packagePath = packageInfo.packageInfo(modulePath).path;
if (!initializedRepoNames.get(packagePath)) {
if (!packagePathToConfigKeyPrefix.get(packagePath)) {
init(modulePath, packagePath);
}
return {
get: key => config.get(`${initializedRepoNames.get(packagePath)}.${key}`)
get: key => config.get(`${packagePathToConfigKeyPrefix.get(packagePath)}.${key}`)
};
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc