Socket
Socket
Sign inDemoInstall

config-kit

Package Overview
Dependencies
16
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.7.2 to 2.0.0

12

CHANGELOG.md

@@ -0,1 +1,13 @@

# v2.0.0 (Mar 8, 2022)
* BREAKING CHANGE: Require Node.js 14.15.0 LTS or newer.
* BREAKING CHANGE: Immediately after creating a `Config` instance, you must call `init()`.
For example, `new Config({ })` becomes `await new Config().init({ })`.
* BREAKING CHANGE: `Config` methods `load()`, `pop()`, `push()`, `save()`, `set()`, `shift()`, and
`unshift()` methods are now async.
* BREAKING CHANGE: `LayerList` methods `add()` and `set()` are now async.
* BREAKING CHANGE: `.js` store no longer supports CommonJS modules; only ES modules are supported.
* chore: Updated dependencies.
* chore: Replaced Travis with GitHub action.
# v1.7.2 (Dec 17, 2021)

@@ -2,0 +14,0 @@

42

package.json
{
"name": "config-kit",
"version": "1.7.2",
"description": "A universal, layered configuration system.",
"main": "./dist/index.js",
"version": "2.0.0",
"description": "A universal, layered configuration system",
"type": "module",
"exports": "./src/index.js",
"author": "Axway, Inc. <npmjs@appcelerator.com>",

@@ -17,20 +18,27 @@ "maintainers": [

"scripts": {
"build": "gulp build",
"coverage": "gulp coverage",
"docs": "gulp docs",
"lint": "gulp lint",
"prepare": "gulp build",
"test": "gulp test"
"coverage": "c8 npm run test",
"lint": "eslint --ignore-pattern test/fixtures src test",
"prepublishOnly": "npm run lint",
"test": "npm run lint && mocha test/**/test-*.js --reporter spec"
},
"dependencies": {
"@xmldom/xmldom": "^0.7.5",
"detect-indent": "^6.1.0",
"fs-extra": "^9.1.0",
"@xmldom/xmldom": "^0.8.1",
"detect-indent": "^7.0.0",
"fs-extra": "^10.0.1",
"import-fresh": "^3.3.0",
"joi": "^17.5.0",
"snooplogg": "^3.0.2",
"source-map-support": "^0.5.21"
"joi": "^17.6.0",
"snooplogg": "^5.0.0"
},
"devDependencies": {
"appcd-gulp": "^3.2.0",
"c8": "^7.11.0",
"chai": "^4.3.6",
"chai-as-promised": "^7.1.1",
"eslint": "^8.10.0",
"eslint-plugin-chai-expect": "^3.0.0",
"eslint-plugin-mocha": "^10.0.3",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-security": "^1.4.0",
"mocha": "^9.2.1",
"sinon": "^13.0.1",
"sinon-chai": "^3.7.0",
"tmp": "^0.2.1"

@@ -42,4 +50,4 @@ },

"engines": {
"node": ">=10"
"node": ">=14.15.0"
}
}

@@ -7,4 +7,2 @@ # config-kit

[![NPM Downloads][downloads-image]][downloads-url]
[![Deps][david-image]][david-url]
[![Dev Deps][david-dev-image]][david-dev-url]

@@ -32,11 +30,57 @@ ## Features

const config = new Config();
const config = await new Config().init();
config.set('foo.bar', true);
await config.set('foo.bar', true);
console.log(config.get('foo')); // { "bar": true }
config.load('/path/to/myconfig.json');
await config.load('/path/to/myconfig.json');
await config.set('foo.baz', 'pow');
await config.save();
```
## Migrating from v1
v2 introduces major breaking API changes. This package was refactored to be a ES module.
This means `.js` config and schema files also need to be ES modules. Since you can't
synchronously import ES modules, there was no choice but to make nearly every API async.
When creating a new `Config` instance, simply prepend with `await` and call `init()` with the
constructor options:
#### v1
```js
const cfg = new Config({ /* opts */ });
```
#### v2
```js
const cfg = await new Config().init({ /* opts */ });
```
The following functions are now async: `load()`, `pop()`, `push()`, `save()`, `set()`, `shift()`,
`unshift()`.
#### v1
```js
cfg.load({ file: '/path/to/file' });
cfg.set('foo', 'bar');
cfg.push('baz', 'wiz');
cfg.save();
```
#### v2
```js
await cfg.load({ file: '/path/to/file' });
await cfg.set('foo', 'bar');
await cfg.push('baz', 'wiz');
await cfg.save();
```
## License

@@ -53,6 +97,2 @@

[downloads-url]: https://npmjs.org/package/config-kit
[david-image]: https://img.shields.io/david/appcelerator/config-kit.svg
[david-url]: https://david-dm.org/appcelerator/config-kit
[david-dev-image]: https://img.shields.io/david/dev/appcelerator/config-kit.svg
[david-dev-url]: https://david-dm.org/appcelerator/config-kit#info=devDependencies
[joi]: https://www.npmjs.com/package/@hapi/joi

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc