config-kit
Advanced tools
Comparing version 1.7.2 to 2.0.0
@@ -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 @@ |
{ | ||
"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
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
6
96
0
Yes
9702
12
4
0
2
+ Added@xmldom/xmldom@0.8.10(transitive)
+ Addedbryt-lite@2.0.1(transitive)
+ Addedchalk@5.3.0(transitive)
+ Addeddetect-indent@7.0.1(transitive)
+ Addedfs-extra@10.1.0(transitive)
+ Addednanobuffer@3.0.0(transitive)
+ Addedsnooplogg@5.1.0(transitive)
+ Addedsupports-color@9.4.0(transitive)
- Removedsource-map-support@^0.5.21
- Removed@xmldom/xmldom@0.7.13(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedat-least-node@1.0.0(transitive)
- Removedbase64-js@1.5.1(transitive)
- Removedbrotli@1.3.3(transitive)
- Removedbryt@1.0.2(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedchalk@4.1.2(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removeddetect-indent@6.1.0(transitive)
- Removedfs-extra@9.1.0(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removednanobuffer@1.1.7(transitive)
- Removedsnooplogg@3.0.2(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedsource-map-support@0.5.21(transitive)
- Removedsupports-color@7.2.08.1.1(transitive)
Updated@xmldom/xmldom@^0.8.1
Updateddetect-indent@^7.0.0
Updatedfs-extra@^10.0.1
Updatedjoi@^17.6.0
Updatedsnooplogg@^5.0.0