From 4db6c3898b07100e3a324e4aae50c2fab4b93a04 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Wed, 12 Sep 2018 09:54:30 -0700 Subject: [PATCH] config-chain@1.1.12 --- node_modules/config-chain/.npmignore | 3 - node_modules/config-chain/package.json | 33 +++--- node_modules/config-chain/readme.markdown | 60 +++++++---- node_modules/config-chain/test/broken.js | 10 -- node_modules/config-chain/test/broken.json | 21 ---- node_modules/config-chain/test/chain-class.js | 100 ------------------ node_modules/config-chain/test/env.js | 10 -- node_modules/config-chain/test/find-file.js | 13 --- node_modules/config-chain/test/get.js | 15 --- .../config-chain/test/ignore-unfound-file.js | 5 - node_modules/config-chain/test/ini.js | 18 ---- node_modules/config-chain/test/save.js | 59 ----------- package-lock.json | 6 +- package.json | 2 +- 14 files changed, 61 insertions(+), 294 deletions(-) delete mode 100644 node_modules/config-chain/.npmignore delete mode 100644 node_modules/config-chain/test/broken.js delete mode 100644 node_modules/config-chain/test/broken.json delete mode 100644 node_modules/config-chain/test/chain-class.js delete mode 100644 node_modules/config-chain/test/env.js delete mode 100644 node_modules/config-chain/test/find-file.js delete mode 100644 node_modules/config-chain/test/get.js delete mode 100644 node_modules/config-chain/test/ignore-unfound-file.js delete mode 100644 node_modules/config-chain/test/ini.js delete mode 100644 node_modules/config-chain/test/save.js diff --git a/node_modules/config-chain/.npmignore b/node_modules/config-chain/.npmignore deleted file mode 100644 index 13abef4f5889..000000000000 --- a/node_modules/config-chain/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -node_modules/* -npm_debug.log diff --git a/node_modules/config-chain/package.json b/node_modules/config-chain/package.json index 501f13ef36e7..5654ff7a194b 100644 --- a/node_modules/config-chain/package.json +++ b/node_modules/config-chain/package.json @@ -1,31 +1,27 @@ { - "_args": [ - [ - "config-chain@1.1.11", - "/Users/rebecca/code/npm" - ] - ], - "_from": "config-chain@1.1.11", - "_id": "config-chain@1.1.11", + "_from": "config-chain@1.1.12", + "_id": "config-chain@1.1.12", "_inBundle": false, - "_integrity": "sha1-q6CXR9++TD5w52am5BWG4YWfxvI=", + "_integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==", "_location": "/config-chain", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "config-chain@1.1.11", + "raw": "config-chain@1.1.12", "name": "config-chain", "escapedName": "config-chain", - "rawSpec": "1.1.11", + "rawSpec": "1.1.12", "saveSpec": null, - "fetchSpec": "1.1.11" + "fetchSpec": "1.1.12" }, "_requiredBy": [ + "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.11.tgz", - "_spec": "1.1.11", + "_resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", + "_shasum": "0fde8d091200eb5e808caf25fe618c02f48e4efa", + "_spec": "config-chain@1.1.12", "_where": "/Users/rebecca/code/npm", "author": { "name": "Dominic Tarr", @@ -35,14 +31,19 @@ "bugs": { "url": "https://github.com/dominictarr/config-chain/issues" }, + "bundleDependencies": false, "dependencies": { "ini": "^1.3.4", "proto-list": "~1.2.1" }, + "deprecated": false, "description": "HANDLE CONFIGURATION ONCE AND FOR ALL", "devDependencies": { "tap": "0.3.0" }, + "files": [ + "index.js" + ], "homepage": "http://github.com/dominictarr/config-chain", "licenses": [ { @@ -56,7 +57,7 @@ "url": "git+https://github.com/dominictarr/config-chain.git" }, "scripts": { - "test": "tap test/" + "test": "tap test/*" }, - "version": "1.1.11" + "version": "1.1.12" } diff --git a/node_modules/config-chain/readme.markdown b/node_modules/config-chain/readme.markdown index a8d26378e6ff..47f894c79884 100644 --- a/node_modules/config-chain/readme.markdown +++ b/node_modules/config-chain/readme.markdown @@ -1,6 +1,6 @@ -#config-chain +# config-chain -USE THIS MODULE TO LOAD ALL YOUR CONFIGURATIONS +A module for loading custom configurations ## NOTE: Feature Freeze @@ -8,12 +8,42 @@ USE THIS MODULE TO LOAD ALL YOUR CONFIGURATIONS This module is frozen. -In general, I'd recommend using [rc](https://github.com/dominictarr/rc) instead, +In general, we recommend using [rc](https://github.com/dominictarr/rc) instead, but as [npm](https://github.com/npmjs/npm) depends on this, it cannot be changed. + +## Install + +```sh +yarn add config-chain + +# npm users +npm install --save config-chain +``` + +## Usage + +```js +const cc = require('config-chain'); + +console.log(cc.env('TERM_', process.env)); +/* +{ SESSION_ID: 'w1:5F38', + PROGRAM_VERSION: '3.1.2', + PROGRAM: 'iTerm.app' } +*/ +``` + +The `.env` function gets all the keys on the provided object which are +prefixed by the specified prefix, removes the prefix, and puts the values on a new object. + +
+ +## Full Usage + ``` js - //npm install config-chain + // npm install config-chain var cc = require('config-chain') , opts = require('optimist').argv //ALWAYS USE OPTIMIST FOR COMMAND LINE OPTIONS. @@ -63,17 +93,9 @@ but as [npm](https://github.com/npmjs/npm) depends on this, it cannot be changed ``` -FINALLY, EASY FLEXIBLE CONFIGURATIONS! - -##see also: [proto-list](https://github.com/isaacs/proto-list/) - -WHATS THAT YOU SAY? +Finally, flexible configurations! 👌 -YOU WANT A "CLASS" SO THAT YOU CAN DO CRAYCRAY JQUERY CRAPS? - -EXTEND WITH YOUR OWN FUNCTIONALTY!? - -## CONFIGCHAIN LIVES TO SERVE ONLY YOU! +## Custom Configuations ```javascript var cc = require('config-chain') @@ -108,7 +130,7 @@ var config = cc({ }) ``` -# BORING API DOCS +# API Docs ## cc(...args) @@ -116,13 +138,11 @@ MAKE A CHAIN AND ADD ALL THE ARGS. If the arg is a STRING, then it shall be a JSON FILENAME. -SYNC I/O! - RETURN THE CHAIN! ## cc.json(...args) -Join the args INTO A JSON FILENAME! +Join the args into a JSON filename! SYNC I/O! @@ -145,8 +165,8 @@ NO I/O! ## cc.env(prefix, env=process.env) -Get all the keys on the provided env object (or process.env) which are -prefixed by the specified prefix, and put the values on a new object. +Get all the keys on the provided object which are +prefixed by the specified prefix, removes the prefix, and puts the values on a new object. RETURN THE RESULTING OBJECT! diff --git a/node_modules/config-chain/test/broken.js b/node_modules/config-chain/test/broken.js deleted file mode 100644 index 101a3e4f5c21..000000000000 --- a/node_modules/config-chain/test/broken.js +++ /dev/null @@ -1,10 +0,0 @@ - - -var cc = require('..') -var assert = require('assert') - - -//throw on invalid json -assert.throws(function () { - cc(__dirname + '/broken.json') -}) diff --git a/node_modules/config-chain/test/broken.json b/node_modules/config-chain/test/broken.json deleted file mode 100644 index 2107ac18d949..000000000000 --- a/node_modules/config-chain/test/broken.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "config-chain", - "version": "0.3.0", - "description": "HANDLE CONFIGURATION ONCE AND FOR ALL", - "homepage": "http://github.com/dominictarr/config-chain", - "repository": { - "type": "git", - "url": "https://github.com/dominictarr/config-chain.git" - } - //missing , and then this comment. this json is intensionally invalid - "dependencies": { - "proto-list": "1", - "ini": "~1.0.2" - }, - "bundleDependencies": ["ini"], - "REM": "REMEMBER TO REMOVE BUNDLING WHEN/IF ISAACS MERGES ini#7", - "author": "Dominic Tarr (http://dominictarr.com)", - "scripts": { - "test": "node test/find-file.js && node test/ini.js && node test/env.js" - } -} diff --git a/node_modules/config-chain/test/chain-class.js b/node_modules/config-chain/test/chain-class.js deleted file mode 100644 index bbc0d4cb2d19..000000000000 --- a/node_modules/config-chain/test/chain-class.js +++ /dev/null @@ -1,100 +0,0 @@ -var test = require('tap').test -var CC = require('../index.js').ConfigChain - -var env = { foo_blaz : 'blzaa', foo_env : 'myenv' } -var jsonObj = { blaz: 'json', json: true } -var iniObj = { 'x.y.z': 'xyz', blaz: 'ini' } - -var fs = require('fs') -var ini = require('ini') - -fs.writeFileSync('/tmp/config-chain-class.json', JSON.stringify(jsonObj)) -fs.writeFileSync('/tmp/config-chain-class.ini', ini.stringify(iniObj)) - -var http = require('http') -var reqs = 0 -http.createServer(function (q, s) { - if (++reqs === 2) this.close() - if (q.url === '/json') { - // make sure that the requests come back from the server - // out of order. they should still be ordered properly - // in the resulting config object set. - setTimeout(function () { - s.setHeader('content-type', 'application/json') - s.end(JSON.stringify({ - blaz: 'http', - http: true, - json: true - })) - }, 200) - } else { - s.setHeader('content-type', 'application/ini') - s.end(ini.stringify({ - blaz: 'http', - http: true, - ini: true, - json: false - })) - } -}).listen(1337) - -test('basic class test', function (t) { - var cc = new CC() - var expectlist = - [ { blaz: 'json', json: true }, - { 'x.y.z': 'xyz', blaz: 'ini' }, - { blaz: 'blzaa', env: 'myenv' }, - { blaz: 'http', http: true, json: true }, - { blaz: 'http', http: true, ini: true, json: false } ] - - cc.addFile('/tmp/config-chain-class.json') - .addFile('/tmp/config-chain-class.ini') - .addEnv('foo_', env) - .addUrl('http://localhost:1337/json') - .addUrl('http://localhost:1337/ini') - .on('load', function () { - t.same(cc.list, expectlist) - t.same(cc.snapshot, { blaz: 'json', - json: true, - 'x.y.z': 'xyz', - env: 'myenv', - http: true, - ini: true }) - - cc.del('blaz', '/tmp/config-chain-class.json') - t.same(cc.snapshot, { blaz: 'ini', - json: true, - 'x.y.z': 'xyz', - env: 'myenv', - http: true, - ini: true }) - cc.del('blaz') - t.same(cc.snapshot, { json: true, - 'x.y.z': 'xyz', - env: 'myenv', - http: true, - ini: true }) - cc.shift() - t.same(cc.snapshot, { 'x.y.z': 'xyz', - env: 'myenv', - http: true, - json: true, - ini: true }) - cc.shift() - t.same(cc.snapshot, { env: 'myenv', - http: true, - json: true, - ini: true }) - cc.shift() - t.same(cc.snapshot, { http: true, - json: true, - ini: true }) - cc.shift() - t.same(cc.snapshot, { http: true, - ini: true, - json: false }) - cc.shift() - t.same(cc.snapshot, {}) - t.end() - }) -}) diff --git a/node_modules/config-chain/test/env.js b/node_modules/config-chain/test/env.js deleted file mode 100644 index fb718f32b7d9..000000000000 --- a/node_modules/config-chain/test/env.js +++ /dev/null @@ -1,10 +0,0 @@ -var cc = require('..') -var assert = require('assert') - -assert.deepEqual({ - hello: true -}, cc.env('test_', { - 'test_hello': true, - 'ignore_this': 4, - 'ignore_test_this_too': [] -})) diff --git a/node_modules/config-chain/test/find-file.js b/node_modules/config-chain/test/find-file.js deleted file mode 100644 index 23cde52ea9d8..000000000000 --- a/node_modules/config-chain/test/find-file.js +++ /dev/null @@ -1,13 +0,0 @@ - -var fs = require('fs') - , assert = require('assert') - , objx = { - rand: Math.random() - } - -fs.writeFileSync('/tmp/random-test-config.json', JSON.stringify(objx)) - -var cc = require('../') -var path = cc.find('tmp/random-test-config.json') - -assert.equal(path, '/tmp/random-test-config.json') \ No newline at end of file diff --git a/node_modules/config-chain/test/get.js b/node_modules/config-chain/test/get.js deleted file mode 100644 index d6fd79f74bbe..000000000000 --- a/node_modules/config-chain/test/get.js +++ /dev/null @@ -1,15 +0,0 @@ -var cc = require("../"); - -var chain = cc() - , name = "forFun"; - -chain - .add({ - __sample:"for fun only" - }, name) - .on("load", function() { - //It throw exception here - console.log(chain.get("__sample", name)); - //But if I drop the name param, it run normally and return as expected: "for fun only" - //console.log(chain.get("__sample")); - }); diff --git a/node_modules/config-chain/test/ignore-unfound-file.js b/node_modules/config-chain/test/ignore-unfound-file.js deleted file mode 100644 index d742b82ba758..000000000000 --- a/node_modules/config-chain/test/ignore-unfound-file.js +++ /dev/null @@ -1,5 +0,0 @@ - -var cc = require('..') - -//should not throw -cc(__dirname, 'non_existing_file') diff --git a/node_modules/config-chain/test/ini.js b/node_modules/config-chain/test/ini.js deleted file mode 100644 index 5572a6ed6ff0..000000000000 --- a/node_modules/config-chain/test/ini.js +++ /dev/null @@ -1,18 +0,0 @@ - - -var cc =require('..') -var INI = require('ini') -var assert = require('assert') - -function test(obj) { - - var _json, _ini - var json = cc.parse (_json = JSON.stringify(obj)) - var ini = cc.parse (_ini = INI.stringify(obj)) -console.log(_ini, _json) - assert.deepEqual(json, ini) -} - - -test({hello: true}) - diff --git a/node_modules/config-chain/test/save.js b/node_modules/config-chain/test/save.js deleted file mode 100644 index bc97bbd3f6f1..000000000000 --- a/node_modules/config-chain/test/save.js +++ /dev/null @@ -1,59 +0,0 @@ -var CC = require('../index.js').ConfigChain -var test = require('tap').test - -var f1 = '/tmp/f1.ini' -var f2 = '/tmp/f2.json' - -var ini = require('ini') - -var f1data = {foo: {bar: 'baz'}, bloo: 'jaus'} -var f2data = {oof: {rab: 'zab'}, oolb: 'suaj'} - -var fs = require('fs') - -fs.writeFileSync(f1, ini.stringify(f1data), 'utf8') -fs.writeFileSync(f2, JSON.stringify(f2data), 'utf8') - -test('test saving and loading ini files', function (t) { - new CC() - .add({grelb:'blerg'}, 'opt') - .addFile(f1, 'ini', 'inifile') - .addFile(f2, 'json', 'jsonfile') - .on('load', function (cc) { - - t.same(cc.snapshot, { grelb: 'blerg', - bloo: 'jaus', - foo: { bar: 'baz' }, - oof: { rab: 'zab' }, - oolb: 'suaj' }) - - t.same(cc.list, [ { grelb: 'blerg' }, - { bloo: 'jaus', foo: { bar: 'baz' } }, - { oof: { rab: 'zab' }, oolb: 'suaj' } ]) - - cc.set('grelb', 'brelg', 'opt') - .set('foo', 'zoo', 'inifile') - .set('oof', 'ooz', 'jsonfile') - .save('inifile') - .save('jsonfile') - .on('save', function () { - t.equal(fs.readFileSync(f1, 'utf8'), - "bloo=jaus\nfoo=zoo\n") - t.equal(fs.readFileSync(f2, 'utf8'), - "{\"oof\":\"ooz\",\"oolb\":\"suaj\"}") - - t.same(cc.snapshot, { grelb: 'brelg', - bloo: 'jaus', - foo: 'zoo', - oof: 'ooz', - oolb: 'suaj' }) - - t.same(cc.list, [ { grelb: 'brelg' }, - { bloo: 'jaus', foo: 'zoo' }, - { oof: 'ooz', oolb: 'suaj' } ]) - - t.pass('ok') - t.end() - }) - }) -}) diff --git a/package-lock.json b/package-lock.json index 8aed6ad03bed..05b0f9cb4dcc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -659,9 +659,9 @@ } }, "config-chain": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.11.tgz", - "integrity": "sha1-q6CXR9++TD5w52am5BWG4YWfxvI=", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", + "integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==", "requires": { "ini": "^1.3.4", "proto-list": "~1.2.1" diff --git a/package.json b/package.json index 93d09edd26e8..9e2a8587d91c 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "cli-table3": "^0.5.0", "cmd-shim": "~2.0.2", "columnify": "~1.5.4", - "config-chain": "~1.1.11", + "config-chain": "^1.1.12", "detect-indent": "~5.0.0", "detect-newline": "^2.1.0", "dezalgo": "~1.0.3",