From 25ebe82c974d6202add911569573d52acdc1bb5c Mon Sep 17 00:00:00 2001 From: Nicolas Froidure Date: Sun, 21 Oct 2018 18:12:39 +0200 Subject: [PATCH] refactor(DI): Use NODE_ENV / PORT / HOST directly --- .codeclimate.yml | 5 + ARCHITECTURE.md | 17 +- package-lock.json | 818 +++++++++++---------------- package.json | 27 +- src/__snapshots__/index.test.js.snap | 15 +- src/index.js | 8 +- src/index.test.js | 11 +- src/services/ENV.js | 7 +- src/services/{host.js => HOST.js} | 6 +- src/services/{port.js => PORT.js} | 2 +- 10 files changed, 377 insertions(+), 539 deletions(-) rename src/services/{host.js => HOST.js} (78%) rename src/services/{port.js => PORT.js} (94%) diff --git a/.codeclimate.yml b/.codeclimate.yml index 452108b6..743bba66 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -8,3 +8,8 @@ engines: ratings: paths: - "'src/**/*.js'" +## Exclude test files. +exclude_patterns: +- "dist/" +- "**/node_modules/" +- "src/**/*.test.js" diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 6db0e9be..2214ee87 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -21,7 +21,7 @@ Whook exposes a `runServer` function to programmatically spawn If no `PORT` configuration is specified, this service detects a free port automagically. -[See in context](./src/services/port.js#L5-L8) +[See in context](./src/services/PORT.js#L5-L8) @@ -30,7 +30,7 @@ If no `PORT` configuration is specified, this service detects If no `HOST` configuration is specified, this service detects the machine host automagically. -[See in context](./src/services/host.js#L5-L8) +[See in context](./src/services/HOST.js#L5-L8) @@ -100,11 +100,12 @@ Whook's embed a few default initializers proxied from ## Environment service The `ENV` service add a layer of configuration over just using - node's `process.env` value. Only `PWD` and `NODE_ENV` are - guaranteed to be the exact same than the values in the process - environment. + node's `process.env` value. Beware that `PWD` and `NODE_ENV` are + guaranteed to be the exact same than the injected constants. + It is up to you to decide upstream if you set them via the + `process.env.NODE_ENV` and `process.cwd()` values or not. -[See in context](./src/services/ENV.js#L7-L12) +[See in context](./src/services/ENV.js#L7-L13) @@ -115,7 +116,7 @@ Per default, Whook takes the process environment as is AWS Lambda or Google Cloud Functions one can isolate the process env when building. -[See in context](./src/services/ENV.js#L24-L29) +[See in context](./src/services/ENV.js#L25-L30) @@ -125,7 +126,7 @@ You may need to keep some secrets out of your Git history. Whook uses `dotenv` to provide your such ability. -[See in context](./src/services/ENV.js#L35-L39) +[See in context](./src/services/ENV.js#L36-L40) diff --git a/package-lock.json b/package-lock.json index 69a6dea0..e7d879af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1157,9 +1157,9 @@ "dev": true }, "babel-eslint": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-9.0.0.tgz", - "integrity": "sha512-itv1MwE3TMbY0QtNfeL7wzak1mV47Uy+n6HtSOO4Xd7rvmO+tsGQSgyOEEgo6Y2vHZKZphaoelNeSVj4vkLA1g==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.0.1.tgz", + "integrity": "sha512-z7OT1iNV+TjOwHNLLyJk+HN+YVWX+CLE6fPD2SymJZOZQBs+QIexFjhm4keGTm8MW9xr4EC9Q0PbaLB24V5GoQ==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -1186,6 +1186,15 @@ "trim-right": "^1.0.1" }, "dependencies": { + "detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, "jsesc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", @@ -1247,17 +1256,6 @@ "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", "dev": true }, - "babel-polyfill": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.23.0.tgz", - "integrity": "sha1-g2TKYt+Or7gwSZ9pkXdGbDsDSZ0=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "core-js": "^2.4.0", - "regenerator-runtime": "^0.10.0" - } - }, "babel-preset-jest": { "version": "23.2.0", "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-23.2.0.tgz", @@ -1360,14 +1358,6 @@ "requires": { "core-js": "^2.4.0", "regenerator-runtime": "^0.11.0" - }, - "dependencies": { - "regenerator-runtime": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", - "dev": true - } } }, "babel-template": { @@ -1606,13 +1596,13 @@ } }, "browserslist": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.2.1.tgz", - "integrity": "sha512-1oO0c7Zhejwd+LXihS89WqtKionSbz298rJZKJgfrHIZhrV8AC15gw553VcB0lcEugja7IhWD7iAlrsamfYVPA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.3.0.tgz", + "integrity": "sha512-j0jLqo+6ZhFWvTjEIcDyR8LIiN8pA3cUrT/SGAs0LPp/cKvkRpCnzuxtnAW+sOPLTic5wfb+TQvRX2RTN2wo4w==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30000890", - "electron-to-chromium": "^1.3.79", + "caniuse-lite": "^1.0.30000893", + "electron-to-chromium": "^1.3.80", "node-releases": "^1.0.0-alpha.14" } }, @@ -1690,13 +1680,10 @@ } }, "cachedir": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-1.3.0.tgz", - "integrity": "sha512-O1ji32oyON9laVPJL1IZ5bmwd2cB46VfpxkDequezH+15FDzzVddEyrGEeX4WusDSqKxdyFdDQDEG1yo1GoWkg==", - "dev": true, - "requires": { - "os-homedir": "^1.0.1" - } + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.1.0.tgz", + "integrity": "sha512-xGBpPqoBvn3unBW7oxgb8aJn42K0m9m1/wyjmazah10Fq7bROGG3kRAE6OIyr3U3PIJUqGuebhCEdMk9OKJG0A==", + "dev": true }, "call-me-maybe": { "version": "1.0.1", @@ -1745,9 +1732,9 @@ } }, "caniuse-lite": { - "version": "1.0.30000890", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000890.tgz", - "integrity": "sha512-4NI3s4Y6ROm+SgZN5sLUG4k7nVWQnedis3c/RWkynV5G6cHSY7+a8fwFyn2yoBDE3E6VswhTNNwR3PvzGqlTkg==", + "version": "1.0.30000893", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000893.tgz", + "integrity": "sha512-kOddHcTEef+NgN/fs0zmX2brHTNATVOWMEIhlZHCuwQRtXobjSw9pAECc44Op4bTBcavRjkLaPrGomknH7+Jvg==", "dev": true }, "caporal": { @@ -1832,9 +1819,9 @@ } }, "chardet": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", - "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, "chokidar": { @@ -2078,80 +2065,92 @@ "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==" }, "commitizen": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/commitizen/-/commitizen-2.10.1.tgz", - "integrity": "sha1-jDld7zSolfTpSVLC78PJ60w2g70=", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/commitizen/-/commitizen-3.0.4.tgz", + "integrity": "sha512-djR5F7RBsGALyUEm/B1H/85nsN4L1F5DhWN+9/efSwqHDSyhw2MK6MF2VRuD26PUqGkQbcUlYO61btkTWjcjVw==", "dev": true, "requires": { - "cachedir": "^1.1.0", - "chalk": "1.1.3", - "cz-conventional-changelog": "2.0.0", - "dedent": "0.6.0", - "detect-indent": "4.0.0", + "cachedir": "2.1.0", + "cz-conventional-changelog": "2.1.0", + "dedent": "0.7.0", + "detect-indent": "^5.0.0", "find-node-modules": "1.0.4", - "find-root": "1.0.0", - "fs-extra": "^1.0.0", - "glob": "7.1.1", - "inquirer": "1.2.3", - "lodash": "4.17.5", + "find-root": "1.1.0", + "fs-extra": "^7.0.0", + "glob": "7.1.3", + "inquirer": "6.2.0", + "lodash": "4.17.11", "minimist": "1.2.0", - "opencollective": "1.0.3", - "path-exists": "2.1.0", "shelljs": "0.7.6", "strip-json-comments": "2.0.1" }, "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "ansi-escapes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", "dev": true }, - "chalk": { - "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", "dev": true, "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "restore-cursor": "^2.0.0" } }, - "cz-conventional-changelog": { + "external-editor": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz", + "integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==", + "dev": true, + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + } + }, + "figures": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/cz-conventional-changelog/-/cz-conventional-changelog-2.0.0.tgz", - "integrity": "sha1-Val5r9/pXnAkh50qD1kkYwFwtTM=", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", "dev": true, "requires": { - "conventional-commit-types": "^2.0.0", - "lodash.map": "^4.5.1", - "longest": "^1.0.1", - "pad-right": "^0.2.2", - "right-pad": "^1.0.1", - "word-wrap": "^1.0.3" + "escape-string-regexp": "^1.0.5" } }, - "glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", - "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "inquirer": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz", + "integrity": "sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg==", "dev": true, "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.2", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.0", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.0", + "figures": "^2.0.0", + "lodash": "^4.17.10", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^6.1.0", + "string-width": "^2.1.0", + "strip-ansi": "^4.0.0", + "through": "^2.3.6" } }, - "lodash": { - "version": "4.17.5", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", - "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==", + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "minimist": { @@ -2160,20 +2159,58 @@ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "dev": true + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", "dev": true, "requires": { - "pinkie-promise": "^2.0.0" + "mimic-fn": "^1.0.0" } }, - "supports-color": { + "restore-cursor": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } } } }, @@ -2184,23 +2221,13 @@ "dev": true }, "common-services": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/common-services/-/common-services-3.2.0.tgz", - "integrity": "sha512-S35YgB4XC5PHH3SmF9XFSQndDoXMR1A7wW7SGvHFf/28xOHQcKDPuh8KKf00tQAf85SrhGPqSdg2b6NtsPClTQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/common-services/-/common-services-4.0.0.tgz", + "integrity": "sha512-e75DgB0fInZbailztgRTiKJwGHJNyhMu7dmeYTWPHBVmreCXdLD9xNgy+1KzAlo9h8creX/BTnMQls9FxGkCwg==", "requires": { - "knifecycle": "^2.5.4", + "knifecycle": "^3.1.0", + "sinon": "^7.0.0", "yerror": "^2.1.3" - }, - "dependencies": { - "knifecycle": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/knifecycle/-/knifecycle-2.7.0.tgz", - "integrity": "sha512-5RMr81ZUicXsk2C3OknUIXKXuFCzvG8uDIM7C+2Dq9Rq2ZeoagW9/CLslBr+CsE4ghZ8o03d1zYXwLKv56GIBg==", - "requires": { - "debug": "^4.0.1", - "yerror": "^2.1.3" - } - } } }, "commondir": { @@ -2658,9 +2685,9 @@ "dev": true }, "dedent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.6.0.tgz", - "integrity": "sha1-Dm2o8M5Sg471zsXI+TlrDBtko8s=", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", + "integrity": "sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=", "dev": true }, "deep-extend": { @@ -2799,13 +2826,10 @@ } }, "detect-indent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", - "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", - "dev": true, - "requires": { - "repeating": "^2.0.0" - } + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-5.0.0.tgz", + "integrity": "sha1-OHHMCmoALow+Wzz38zYmRnXwa50=", + "dev": true }, "detect-newline": { "version": "2.1.0", @@ -2819,9 +2843,9 @@ "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==" }, "dmd": { - "version": "3.0.12", - "resolved": "https://registry.npmjs.org/dmd/-/dmd-3.0.12.tgz", - "integrity": "sha512-79w644JdsB2TthYpVl2bDurX7i9Abaegg2E7X46Ajc135aASTMXxrHzJ9mOa5X5nbmnXwlBYiF68K+1baX+BzQ==", + "version": "3.0.13", + "resolved": "https://registry.npmjs.org/dmd/-/dmd-3.0.13.tgz", + "integrity": "sha512-FV/417bH2c/CYpe8BjFEAHoaHaItcJnPlKELi/qyPZdmUom8joyuC78OhhfPUdyKD/WcouTQ2LxQT4M/RoiJ3w==", "dev": true, "requires": { "array-back": "^2.0.0", @@ -2881,20 +2905,11 @@ } }, "electron-to-chromium": { - "version": "1.3.79", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.79.tgz", - "integrity": "sha512-LQdY3j4PxuUl6xfxiFruTSlCniTrTrzAd8/HfsLEMi0PUpaQ0Iy+Pr4N4VllDYjs0Hyu2lkTbvzqlG+PX9NsNw==", + "version": "1.3.80", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.80.tgz", + "integrity": "sha512-WClidEWEUNx7OfwXehB0qaxCuetjbKjev2SmXWgybWPLKAThBiMTF/2Pd8GSUDtoGOavxVzdkKwfFAPRSWlkLw==", "dev": true }, - "encoding": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", - "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", - "dev": true, - "requires": { - "iconv-lite": "~0.4.13" - } - }, "error": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/error/-/error-7.0.2.tgz", @@ -3063,12 +3078,6 @@ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, - "chardet": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", - "dev": true - }, "cli-cursor": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", @@ -3191,13 +3200,12 @@ } }, "eslint-plugin-prettier": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-2.7.0.tgz", - "integrity": "sha512-CStQYJgALoQBw3FsBzH0VOVDRnJ/ZimUlpLm226U8qgqYJfPOY/CPK6wyRInMxh73HSKg5wyRwdS4BVYYHwokA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.0.0.tgz", + "integrity": "sha512-4g11opzhqq/8+AMmo5Vc2Gn7z9alZ4JqrbZ+D4i8KlSyxeQhZHlmIrY8U9Akf514MoEhogPa87Jgkq87aZ2Ohw==", "dev": true, "requires": { - "fast-diff": "^1.1.1", - "jest-docblock": "^21.0.0" + "prettier-linter-helpers": "^1.0.0" } }, "eslint-scope": { @@ -3383,6 +3391,12 @@ "kind-of": "^3.0.2" } }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, "isobject": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", @@ -3673,9 +3687,9 @@ } }, "find-root": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.0.0.tgz", - "integrity": "sha1-li/yEaqyXGUg/u641ih/j26VgHo=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", + "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==", "dev": true }, "find-up": { @@ -3832,25 +3846,14 @@ "dev": true }, "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", - "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "dev": true, "requires": { "asynckit": "^0.4.0", - "combined-stream": "1.0.6", + "combined-stream": "^1.0.6", "mime-types": "^2.1.12" - }, - "dependencies": { - "combined-stream": { - "version": "1.0.6", - "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - } } }, "format-util": { @@ -3874,14 +3877,14 @@ "dev": true }, "fs-extra": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz", - "integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.0.tgz", + "integrity": "sha512-EglNDLRpmaTWiD/qraZn6HREAEAHJcJOmxNEYwq6xeMKnVMAy3GUcFB+wXt2C6k4CNvB/mP1y/U3dzvKKj5OtQ==", "dev": true, "requires": { "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0" + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" } }, "fs-readdir-recursive": { @@ -4483,7 +4486,7 @@ }, "camelcase-keys": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "resolved": "http://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "dev": true, "requires": { @@ -4508,7 +4511,7 @@ }, "meow": { "version": "3.7.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "resolved": "http://registry.npmjs.org/meow/-/meow-3.7.0.tgz", "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "dev": true, "requires": { @@ -5434,9 +5437,9 @@ "dev": true }, "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" }, "isexe": { "version": "2.0.0", @@ -5932,10 +5935,13 @@ } }, "jest-docblock": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz", - "integrity": "sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw==", - "dev": true + "version": "23.2.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-23.2.0.tgz", + "integrity": "sha1-8IXh8YVI2Z/dabICB+b9VdkTg6c=", + "dev": true, + "requires": { + "detect-newline": "^2.1.0" + } }, "jest-each": { "version": "23.6.0", @@ -5970,7 +5976,7 @@ }, "jest-get-type": { "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz", + "resolved": "http://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz", "integrity": "sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w==", "dev": true }, @@ -6049,15 +6055,6 @@ "is-extglob": "^1.0.0" } }, - "jest-docblock": { - "version": "23.2.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-23.2.0.tgz", - "integrity": "sha1-8IXh8YVI2Z/dabICB+b9VdkTg6c=", - "dev": true, - "requires": { - "detect-newline": "^2.1.0" - } - }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -6292,17 +6289,6 @@ "jest-worker": "^23.2.0", "source-map-support": "^0.5.6", "throat": "^4.0.0" - }, - "dependencies": { - "jest-docblock": { - "version": "23.2.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-23.2.0.tgz", - "integrity": "sha1-8IXh8YVI2Z/dabICB+b9VdkTg6c=", - "dev": true, - "requires": { - "detect-newline": "^2.1.0" - } - } } }, "jest-runtime": { @@ -6709,15 +6695,6 @@ "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.19.tgz", "integrity": "sha512-Vg0C9s/REX6/WIXN37UKpv5ZhRi6A4pjHlpkE34+8/a6c2W1Q692n3hmc+SZG5lKRnaExLUbxtJ1SVT+KaCQ/A==", "dev": true - }, - "klaw": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-2.0.0.tgz", - "integrity": "sha1-WcEo4Nxc5BAgEVEZTuucv4WGUPY=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.9" - } } } }, @@ -6853,9 +6830,9 @@ "dev": true }, "jsonfile": { - "version": "2.4.0", - "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", "dev": true, "requires": { "graceful-fs": "^4.1.6" @@ -6901,9 +6878,9 @@ "dev": true }, "klaw": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", - "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-2.0.0.tgz", + "integrity": "sha1-WcEo4Nxc5BAgEVEZTuucv4WGUPY=", "dev": true, "requires": { "graceful-fs": "^4.1.9" @@ -7110,9 +7087,9 @@ "dev": true }, "lolex": { - "version": "2.7.5", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.7.5.tgz", - "integrity": "sha512-l9x0+1offnKKIzYVjyXU2SiwhXDLekRzKyhnbyldPHvC7BvLPVpdNUNR2KeMAiCN2D/kLNttZgQD5WjSxuBx3Q==" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-3.0.0.tgz", + "integrity": "sha512-hcnW80h3j2lbUfFdMArd5UPA/vxZJ+G8vobd+wg3nVEQA0EigStbYcrG030FJxL6xiDDPEkoMatV9xIh5OecQQ==" }, "longest": { "version": "1.0.1", @@ -7276,57 +7253,25 @@ } }, "metapak": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/metapak/-/metapak-1.0.3.tgz", - "integrity": "sha512-wS0+o1iVeM/vtuQhTpLtGTlGXtqTAzAVAgtm2DD7cFXGD1DRiwMC3bAkM+uwoIIZvyXGlHY65DDnpXfvrgwmlQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/metapak/-/metapak-2.0.0.tgz", + "integrity": "sha512-Gb62lyl8xamRr1P3fRiJ8nWZsDMyZcJ72ptleRMhk0HYDj50xfvHuSojo/1FAQvugdBS6YuOmM6VyntlASlKBA==", "dev": true, "requires": { - "bluebird": "^3.5.1", - "commander": "^2.12.1", - "debug": "^3.1.0", - "glob": "^7.1.2", - "knifecycle": "^2.4.1", + "bluebird": "^3.5.2", + "commander": "^2.19.0", + "debug": "^4.1.0", + "glob": "^7.1.3", + "knifecycle": "^3.1.0", "mkdirp": "^0.5.1", "sort-object": "^3.0.2", - "yerror": "^2.1.0" - }, - "dependencies": { - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "knifecycle": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/knifecycle/-/knifecycle-2.7.0.tgz", - "integrity": "sha512-5RMr81ZUicXsk2C3OknUIXKXuFCzvG8uDIM7C+2Dq9Rq2ZeoagW9/CLslBr+CsE4ghZ8o03d1zYXwLKv56GIBg==", - "dev": true, - "requires": { - "debug": "^4.0.1", - "yerror": "^2.1.3" - }, - "dependencies": { - "debug": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", - "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } - } - } + "yerror": "^2.1.3" } }, "metapak-nfroidure": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/metapak-nfroidure/-/metapak-nfroidure-7.1.1.tgz", - "integrity": "sha512-zHY0KQlfJdTeCdNkhDHSFumEkxJ6gLDBDziCNgxRFxqrPIQ+3Bb8Y/jk6IcBJTtIePxfTQMdsOYsPKN0bKjUMQ==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/metapak-nfroidure/-/metapak-nfroidure-8.0.0.tgz", + "integrity": "sha512-tbzlgJurnp/2kC5LKycPiOE/mGNnkDTgsBC+c3va5aXaqRyS+CGmLdOuqBApvcu/zyLNcuEZOtxgx0dYZWk2ug==", "dev": true, "requires": { "escape-string-regexp": "^1.0.5" @@ -7363,18 +7308,18 @@ } }, "mime-db": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", - "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==", + "version": "1.37.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", + "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==", "dev": true }, "mime-types": { - "version": "2.1.20", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", - "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "version": "2.1.21", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", + "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", "dev": true, "requires": { - "mime-db": "~1.36.0" + "mime-db": "~1.37.0" } }, "mimic-fn": { @@ -7515,15 +7460,22 @@ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" }, "nise": { - "version": "1.4.5", - "resolved": "https://registry.npmjs.org/nise/-/nise-1.4.5.tgz", - "integrity": "sha512-OHRVvdxKgwZELf2DTgsJEIA4MOq8XWvpSUzoOXyxJ2mY0mMENWC66+70AShLR2z05B1dzrzWlUQJmJERlOUpZw==", + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/nise/-/nise-1.4.6.tgz", + "integrity": "sha512-1GedetLKzmqmgwabuMSqPsT7oumdR77SBpDfNNJhADRIeA3LN/2RVqR4fFqwvzhAqcTef6PPCzQwITE/YQ8S8A==", "requires": { "@sinonjs/formatio": "3.0.0", "just-extend": "^3.0.0", "lolex": "^2.3.2", "path-to-regexp": "^1.7.0", "text-encoding": "^0.6.4" + }, + "dependencies": { + "lolex": { + "version": "2.7.5", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.7.5.tgz", + "integrity": "sha512-l9x0+1offnKKIzYVjyXU2SiwhXDLekRzKyhnbyldPHvC7BvLPVpdNUNR2KeMAiCN2D/kLNttZgQD5WjSxuBx3Q==" + } } }, "no-case": { @@ -7534,16 +7486,6 @@ "lower-case": "^1.1.1" } }, - "node-fetch": { - "version": "1.6.3", - "resolved": "http://registry.npmjs.org/node-fetch/-/node-fetch-1.6.3.tgz", - "integrity": "sha1-3CNO3WSJmC1Y6PDbT2lQKavNjAQ=", - "dev": true, - "requires": { - "encoding": "^0.1.11", - "is-stream": "^1.0.1" - } - }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -7557,13 +7499,13 @@ "dev": true }, "node-notifier": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.2.1.tgz", - "integrity": "sha512-MIBs+AAd6dJ2SklbbE8RUDRlIVhU8MaNLh1A9SUZDUHPiZkWLFde6UNwG41yQHZEToHgJMXqyVZ9UcS/ReOVTg==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.3.0.tgz", + "integrity": "sha512-AhENzCSGZnZJgBARsUjnQ7DnZbzyP+HxlVXuD0xqAnvL8q+OqtSX7lGg9e8nHzwXkMMXNdVeqq4E2M3EUAqX6Q==", "dev": true, "requires": { "growly": "^1.3.0", - "semver": "^5.4.1", + "semver": "^5.5.0", "shellwords": "^0.1.1", "which": "^1.3.0" } @@ -7608,7 +7550,7 @@ }, "npmlog": { "version": "2.0.4", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-2.0.4.tgz", + "resolved": "http://registry.npmjs.org/npmlog/-/npmlog-2.0.4.tgz", "integrity": "sha1-mLUlMPJRTKkNCexbIsiEZyI3VpI=", "dev": true, "requires": { @@ -7761,180 +7703,6 @@ "swagger-schema-official": "2.0.0-bab6bed" } }, - "opencollective": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/opencollective/-/opencollective-1.0.3.tgz", - "integrity": "sha1-ruY3K8KBRFg2kMPKja7PwSDdDvE=", - "dev": true, - "requires": { - "babel-polyfill": "6.23.0", - "chalk": "1.1.3", - "inquirer": "3.0.6", - "minimist": "1.2.0", - "node-fetch": "1.6.3", - "opn": "4.0.2" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", - "dev": true, - "requires": { - "restore-cursor": "^2.0.0" - } - }, - "external-editor": { - "version": "2.2.0", - "resolved": "http://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", - "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", - "dev": true, - "requires": { - "chardet": "^0.4.0", - "iconv-lite": "^0.4.17", - "tmp": "^0.0.33" - } - }, - "figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, - "inquirer": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.0.6.tgz", - "integrity": "sha1-4EqqnQW3o8ubD0B9BDdfBEcZA0c=", - "dev": true, - "requires": { - "ansi-escapes": "^1.1.0", - "chalk": "^1.0.0", - "cli-cursor": "^2.1.0", - "cli-width": "^2.0.0", - "external-editor": "^2.0.1", - "figures": "^2.0.0", - "lodash": "^4.3.0", - "mute-stream": "0.0.7", - "run-async": "^2.2.0", - "rx": "^4.1.0", - "string-width": "^2.0.0", - "strip-ansi": "^3.0.0", - "through": "^2.3.6" - } - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "minimist": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - }, - "mute-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", - "dev": true - }, - "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", - "dev": true, - "requires": { - "mimic-fn": "^1.0.0" - } - }, - "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", - "dev": true, - "requires": { - "onetime": "^2.0.0", - "signal-exit": "^3.0.2" - } - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - }, - "dependencies": { - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.2" - } - } - } - }, - "opn": { - "version": "4.0.2", - "resolved": "http://registry.npmjs.org/opn/-/opn-4.0.2.tgz", - "integrity": "sha1-erwi5kTf9jsKltWrfyeQwPAavJU=", - "dev": true, - "requires": { - "object-assign": "^4.0.1", - "pinkie-promise": "^2.0.0" - } - }, "optimist": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", @@ -8064,15 +7832,6 @@ "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", "dev": true }, - "pad-right": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/pad-right/-/pad-right-0.2.2.tgz", - "integrity": "sha1-b7ySQEXSRPKiokRQMGDTv8YAl3Q=", - "dev": true, - "requires": { - "repeat-string": "^1.5.2" - } - }, "parse-github-repo-url": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/parse-github-repo-url/-/parse-github-repo-url-1.4.1.tgz", @@ -8178,13 +7937,6 @@ "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", "requires": { "isarray": "0.0.1" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - } } }, "path-type": { @@ -8254,9 +8006,9 @@ "dev": true }, "portfinder": { - "version": "1.0.17", - "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.17.tgz", - "integrity": "sha512-syFcRIRzVI1BoEFOCaAiizwDolh1S1YXSodsVhncbhjzjZQulhczNRbqnUl9N31Q4dKGOXsNDqxC2BWBgSMqeQ==", + "version": "1.0.18", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.18.tgz", + "integrity": "sha512-KanzLOERzKoX3En5yTiV8K/arnU1ykYVokmtEn0PgCzqKZG9489tqW8ifp9+v3/VJZ5YDjvDt/PAP5WaPgk7FA==", "requires": { "async": "^1.5.2", "debug": "^2.2.0", @@ -8302,6 +8054,15 @@ "integrity": "sha512-qZDVnCrnpsRJJq5nSsiHCE3BYMED2OtsI+cmzIzF1QIfqm5ALf8tEJcO27zV1gKNKRPdhjO0dNWnrzssDQ1tFg==", "dev": true }, + "prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "requires": { + "fast-diff": "^1.1.2" + } + }, "pretty-format": { "version": "23.6.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-23.6.0.tgz", @@ -8350,9 +8111,9 @@ "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" }, "progress": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", - "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.1.tgz", + "integrity": "sha512-OE+a6vzqazc+K6LxJrX5UPyKFvGnL5CYmq2jFGNIBWHpc4QyE49/YOumcrpQFJpfejmvRtbJzgO1zPmMCqlbBg==", "dev": true }, "prompts": { @@ -8540,6 +8301,11 @@ "util-deprecate": "~1.0.1" }, "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -8678,9 +8444,9 @@ } }, "regenerator-runtime": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", - "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", "dev": true }, "regenerator-transform": { @@ -9136,16 +8902,16 @@ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, "sinon": { - "version": "6.3.5", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-6.3.5.tgz", - "integrity": "sha512-xgoZ2gKjyVRcF08RrIQc+srnSyY1JDJtxu3Nsz07j1ffjgXoY6uPLf/qja6nDBZgzYYEovVkFryw2+KiZz11xQ==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.0.0.tgz", + "integrity": "sha512-8OrSYFPZ9xaECfi1ayVMd0ihYCW2OZYgX3rBczrB990gHZMM+aftvhNTJazGz/luS0Us9NWgD5P3KGQ7kYZvGg==", "requires": { "@sinonjs/commons": "^1.0.2", "@sinonjs/formatio": "^3.0.0", "@sinonjs/samsam": "^2.1.2", "diff": "^3.5.0", "lodash.get": "^4.4.2", - "lolex": "^2.7.5", + "lolex": "^3.0.0", "nise": "^1.4.5", "supports-color": "^5.5.0", "type-detect": "^4.0.8" @@ -9608,6 +9374,29 @@ "debug": "^4.0.1", "sinon": "^6.3.3", "yerror": "^2.1.3" + }, + "dependencies": { + "lolex": { + "version": "2.7.5", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.7.5.tgz", + "integrity": "sha512-l9x0+1offnKKIzYVjyXU2SiwhXDLekRzKyhnbyldPHvC7BvLPVpdNUNR2KeMAiCN2D/kLNttZgQD5WjSxuBx3Q==" + }, + "sinon": { + "version": "6.3.5", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-6.3.5.tgz", + "integrity": "sha512-xgoZ2gKjyVRcF08RrIQc+srnSyY1JDJtxu3Nsz07j1ffjgXoY6uPLf/qja6nDBZgzYYEovVkFryw2+KiZz11xQ==", + "requires": { + "@sinonjs/commons": "^1.0.2", + "@sinonjs/formatio": "^3.0.0", + "@sinonjs/samsam": "^2.1.2", + "diff": "^3.5.0", + "lodash.get": "^4.4.2", + "lolex": "^2.7.5", + "nise": "^1.4.5", + "supports-color": "^5.5.0", + "type-detect": "^4.0.8" + } + } } }, "string-length": { @@ -9699,9 +9488,9 @@ } }, "swagger-http-router": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/swagger-http-router/-/swagger-http-router-2.0.0.tgz", - "integrity": "sha512-xg4fDJ5cdJMVzijLaIU2MwSz00kaFan0Hrmvqk4kU8BcM58D3w5l7uM9PNQuwrpYisu17lh0SKjXnt/uOuTX2g==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/swagger-http-router/-/swagger-http-router-3.0.0.tgz", + "integrity": "sha512-RuImDtd/u6pJ07WxSK46i0PYIOUHpKlYQQcD6oNw0bP6DE2nZva6GVIRvtL05dIXe02aO6MdL7geQSZia7q4ZA==", "requires": { "ajv": "^6.5.4", "body": "^5.1.0", @@ -9712,6 +9501,7 @@ "debug": "4.1.0", "first-chunk-stream": "^2.0.0", "knifecycle": "^3.1.0", + "ms": "^2.1.1", "negotiator": "^0.6.1", "qs": "^6.5.2", "siso": "^2.2.1", @@ -9720,6 +9510,28 @@ "swagger-parser": "^6.0.1", "yerror": "^2.1.3", "yhttperror": "^2.0.0" + }, + "dependencies": { + "common-services": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/common-services/-/common-services-3.2.0.tgz", + "integrity": "sha512-S35YgB4XC5PHH3SmF9XFSQndDoXMR1A7wW7SGvHFf/28xOHQcKDPuh8KKf00tQAf85SrhGPqSdg2b6NtsPClTQ==", + "requires": { + "knifecycle": "^2.5.4", + "yerror": "^2.1.3" + }, + "dependencies": { + "knifecycle": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/knifecycle/-/knifecycle-2.7.0.tgz", + "integrity": "sha512-5RMr81ZUicXsk2C3OknUIXKXuFCzvG8uDIM7C+2Dq9Rq2ZeoagW9/CLslBr+CsE4ghZ8o03d1zYXwLKv56GIBg==", + "requires": { + "debug": "^4.0.1", + "yerror": "^2.1.3" + } + } + } + } } }, "swagger-methods": { @@ -10307,6 +10119,12 @@ } } }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, "unset-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", @@ -10344,6 +10162,12 @@ "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true } } }, diff --git a/package.json b/package.json index 2e07ba7f..6195eb2e 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "jsdocs" ], "data": { + "testsFiles": "'src/**/*.test.js'", "files": "'src/**/*.js'", "ignore": [ "dist" @@ -63,35 +64,35 @@ }, "homepage": "https://github.com/nfroidure/whook", "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.1", + "@babel/cli": "^7.1.2", + "@babel/core": "^7.1.2", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", - "@babel/preset-env": "^7.0.0", + "@babel/preset-env": "^7.1.0", "@babel/register": "^7.0.0", "babel-core": "^7.0.0-0", - "babel-eslint": "^9.0.0", + "babel-eslint": "^10.0.1", "caporal": "^0.10.0", - "commitizen": "^2.10.1", + "commitizen": "^3.0.4", "conventional-changelog-cli": "^2.0.5", "coveralls": "^3.0.2", "cz-conventional-changelog": "^2.1.0", "debug": "^4.0.1", - "eslint": "^5.6.0", - "eslint-plugin-prettier": "^2.6.2", + "eslint": "^5.7.0", + "eslint-plugin-prettier": "^3.0.0", "jest": "^23.6.0", "jsarch": "^1.3.0", "jsdoc-to-markdown": "^4.0.1", - "metapak": "1.0.3", - "metapak-nfroidure": "7.1.1", - "prettier": "^1.14.2" + "metapak": "2.0.0", + "metapak-nfroidure": "8.0.0", + "prettier": "^1.14.3" }, "dependencies": { - "common-services": "^3.2.0", + "common-services": "^4.0.0", "dotenv": "^6.1.0", "internal-ip": "^3.0.1", "knifecycle": "^3.1.0", - "portfinder": "^1.0.17", - "swagger-http-router": "^2.0.0" + "portfinder": "^1.0.18", + "swagger-http-router": "^3.0.0" }, "contributors": [], "engines": { diff --git a/src/__snapshots__/index.test.js.snap b/src/__snapshots__/index.test.js.snap index c1c643ee..d9a1cf6b 100644 --- a/src/__snapshots__/index.test.js.snap +++ b/src/__snapshots__/index.test.js.snap @@ -3,6 +3,18 @@ exports[`runServer should work 1`] = ` Object { "autoloaderCalls": Array [ + Array [ + "MAX_HEADERS_COUNT", + ], + Array [ + "KEEP_ALIVE_TIMEOUT", + ], + Array [ + "MAX_CONNECTIONS", + ], + Array [ + "TIMEOUT", + ], Array [ "PROCESS_NAME", ], @@ -27,9 +39,6 @@ Object { Array [ "QUERY_PARSER", ], - Array [ - "TIMEOUT", - ], Array [ "TRANSACTIONS", ], diff --git a/src/index.js b/src/index.js index 3fd1729c..ec5c12ad 100644 --- a/src/index.js +++ b/src/index.js @@ -13,8 +13,8 @@ import { initHTTPServer, initErrorHandler, } from 'swagger-http-router'; -import initPort from './services/port'; -import initHost from './services/host'; +import initPORT from './services/PORT'; +import initHOST from './services/HOST'; import initAutoload from './services/_autoload'; import initENV from './services/ENV'; @@ -111,8 +111,8 @@ export async function prepareServer($ = new Knifecycle()) { initHTTPTransaction, initHTTPServer, initErrorHandler, - initPort, - initHost, + initPORT, + initHOST, initENV, initAutoload, ].forEach($.register.bind($)); diff --git a/src/index.test.js b/src/index.test.js index 3c5752df..e9b5c65f 100644 --- a/src/index.test.js +++ b/src/index.test.js @@ -47,13 +47,10 @@ describe('runServer', () => { }, }), ); - $.register( - constant('ENV', { - PORT: 8888, - HOST: 'localhost', - NODE_ENV: 'test', - }), - ); + $.register(constant('ENV', {})); + $.register(constant('NODE_ENV', 'test')); + $.register(constant('PORT', 8888)); + $.register(constant('HOST', 'localhost')); $.register(constant('WRAPPERS', [])); $.register(constant('NODE_ENV', 'test')); $.register(constant('DEBUG_NODE_ENVS', [])); diff --git a/src/services/ENV.js b/src/services/ENV.js index 67c0ff86..b3ad1d83 100644 --- a/src/services/ENV.js +++ b/src/services/ENV.js @@ -6,9 +6,10 @@ import { noop } from '../libs/utils'; /* Architecture Note #3: Environment service The `ENV` service add a layer of configuration over just using - node's `process.env` value. Only `PWD` and `NODE_ENV` are - guaranteed to be the exact same than the values in the process - environment. + node's `process.env` value. Beware that `PWD` and `NODE_ENV` are + guaranteed to be the exact same than the injected constants. + It is up to you to decide upstream if you set them via the + `process.env.NODE_ENV` and `process.cwd()` values or not. */ export default initializer( { diff --git a/src/services/host.js b/src/services/HOST.js similarity index 78% rename from src/services/host.js rename to src/services/HOST.js index 009ff3f8..385dee22 100644 --- a/src/services/host.js +++ b/src/services/HOST.js @@ -11,11 +11,11 @@ export default initializer( { name: 'HOST', type: 'service', - inject: ['?log'], + inject: ['?ENV', '?log'], options: { singleton: true }, }, - async ({ log = noop }) => { - const host = await internalIp.v4(); + async ({ ENV = {}, log = noop }) => { + const host = ENV.host || (await internalIp.v4()); log('info', `Using detected host ${host}`); diff --git a/src/services/port.js b/src/services/PORT.js similarity index 94% rename from src/services/port.js rename to src/services/PORT.js index f9e94803..0d238de1 100644 --- a/src/services/port.js +++ b/src/services/PORT.js @@ -11,7 +11,7 @@ export default initializer( { name: 'PORT', type: 'service', - inject: ['?log'], + inject: ['ENV', '?log'], options: { singleton: true }, }, async ({ log = noop }) => {