From 4bbd6ab7899922b31de5f002ca8d8e317fa54601 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Mon, 6 Nov 2017 01:46:48 +0530 Subject: [PATCH 01/37] Change webroot path, update README. --- README.md | 19 ++++++++----------- index.js | 3 ++- package-lock.json | 2 +- utils/nginxPath.js | 2 +- 4 files changed, 12 insertions(+), 14 deletions(-) mode change 100644 => 100755 index.js diff --git a/README.md b/README.md index de542bf..160e313 100644 --- a/README.md +++ b/README.md @@ -30,21 +30,18 @@ Install `up` from npm: ## Commands -`up static ` - Create new static server at current folder. +Format: `up command [optional]` -`up proxy ` - Create new proxy server listening at said port. - -`up list` - List currently available servers. (Doesn't work yet) - -`up kill ` - Kill the server for this domain. +- `up static [outbound port]` - Create new static server at current folder. +- `up proxy [outbound port]` - Create new proxy server listening at said port. +- `up list` - List currently available servers. (Doesn't work yet) +- `up kill ` - Kill the server for this domain. ## Examples -`up static example.com` will serve a static website from current folder. - -`up proxy example.com 8081` will create a reverse proxy listening at port 8081. - -`up kill example.com` +- `up static example.com` will serve a static website from current folder. +- `up proxy example.com 8081` will create a reverse proxy listening at port 8081. +- `up kill example.com` ## Contributors, Collaborators, and Guides diff --git a/index.js b/index.js old mode 100644 new mode 100755 index f95b0f2..8f3a00d --- a/index.js +++ b/index.js @@ -13,7 +13,8 @@ var createProxyServer = require('./actions/createProxyServer'); var createStaticServer = require('./actions/createStaticServer'); var killServer = require('./actions/killServer'); -// Check for requirements such as OS version and nginx install. Throw and exit if requirements not found. #Roadmap: Add ability to satisfy any possible requirements. +// Check for requirements such as OS version and nginx install. Throw and exit if requirements not found. +// #Roadmap: Add ability to satisfy any possible requirements. requirements(); // Comment in development and uncomment this line in production. This should check whether the OS is compatible with this version of `up` program diff --git a/package-lock.json b/package-lock.json index 0b002a6..bf62478 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "up-serve", - "version": "0.1.3", + "version": "0.1.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/utils/nginxPath.js b/utils/nginxPath.js index 91dbe8c..935beac 100644 --- a/utils/nginxPath.js +++ b/utils/nginxPath.js @@ -2,7 +2,7 @@ var available = "/etc/nginx/sites-available/"; var enabled = "/etc/nginx/sites-enabled/"; -var wwwRoot = "/var/www/"; +var wwwRoot = "/etc/up-serve/static/"; function availableSites() { return available; From 75bdd81f059d2d1ebf430236761c353a7493d89a Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Mon, 6 Nov 2017 01:49:55 +0530 Subject: [PATCH 02/37] Create LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..96fb330 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Anu Rahul Nandhan a.k.a Muthu Kumar & CodeFeathers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 4e2940f8161d858b774d56a2797583f03f6df199 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Mon, 6 Nov 2017 21:48:55 +0530 Subject: [PATCH 03/37] VSCode Tab indentation and LF endings --- .vscode/settings.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..92f021c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "editor.insertSpaces": false, + "editor.tabSize": 4, + "files.eol": "\n" +} \ No newline at end of file From 2b19a5991c8a114ea20cf4673c5104b2b314742b Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Tue, 7 Nov 2017 00:30:09 +0530 Subject: [PATCH 04/37] Added eslint as dev dependency --- package-lock.json | 990 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 3 + 2 files changed, 993 insertions(+) diff --git a/package-lock.json b/package-lock.json index bf62478..90d09e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,59 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "acorn": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz", + "integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==", + "dev": true + }, + "acorn-jsx": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", + "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", + "dev": true, + "requires": { + "acorn": "3.3.0" + }, + "dependencies": { + "acorn": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", + "dev": true + } + } + }, + "ajv": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.3.0.tgz", + "integrity": "sha1-RBT/dKUIecII7l/cgm4ywwNUnto=", + "dev": true, + "requires": { + "co": "4.6.0", + "fast-deep-equal": "1.0.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" + } + }, + "ajv-keywords": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.1.tgz", + "integrity": "sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I=", + "dev": true + }, + "ansi-escapes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", + "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, "ansi-styles": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", @@ -12,6 +65,83 @@ "color-convert": "1.9.0" } }, + "argparse": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", + "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "dev": true, + "requires": { + "sprintf-js": "1.0.3" + } + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "1.0.3" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" + }, + "dependencies": { + "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": "https://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.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "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 + } + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -26,6 +156,21 @@ "concat-map": "0.0.1" } }, + "caller-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", + "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", + "dev": true, + "requires": { + "callsites": "0.2.0" + } + }, + "callsites": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", + "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", + "dev": true + }, "chalk": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", @@ -36,6 +181,33 @@ "supports-color": "4.5.0" } }, + "circular-json": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", + "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", + "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": { + "restore-cursor": "2.0.0" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true + }, "color-convert": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", @@ -59,11 +231,241 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, + "concat-stream": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", + "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.3", + "typedarray": "0.0.6" + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "4.1.1", + "shebang-command": "1.2.0", + "which": "1.3.0" + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "del": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", + "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", + "dev": true, + "requires": { + "globby": "5.0.0", + "is-path-cwd": "1.0.0", + "is-path-in-cwd": "1.0.0", + "object-assign": "4.1.1", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "rimraf": "2.6.2" + } + }, + "doctrine": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", + "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=", + "dev": true, + "requires": { + "esutils": "2.0.2", + "isarray": "1.0.0" + } + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, + "eslint": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.10.0.tgz", + "integrity": "sha512-MMVl8P/dYUFZEvolL8PYt7qc5LNdS2lwheq9BYa5Y07FblhcZqFyaUqlS8TW5QITGex21tV4Lk0a3fK8lsJIkA==", + "dev": true, + "requires": { + "ajv": "5.3.0", + "babel-code-frame": "6.26.0", + "chalk": "2.3.0", + "concat-stream": "1.6.0", + "cross-spawn": "5.1.0", + "debug": "3.1.0", + "doctrine": "2.0.0", + "eslint-scope": "3.7.1", + "espree": "3.5.1", + "esquery": "1.0.0", + "estraverse": "4.2.0", + "esutils": "2.0.2", + "file-entry-cache": "2.0.0", + "functional-red-black-tree": "1.0.1", + "glob": "7.1.2", + "globals": "9.18.0", + "ignore": "3.3.7", + "imurmurhash": "0.1.4", + "inquirer": "3.3.0", + "is-resolvable": "1.0.0", + "js-yaml": "3.10.0", + "json-stable-stringify": "1.0.1", + "levn": "0.3.0", + "lodash": "4.17.4", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "natural-compare": "1.4.0", + "optionator": "0.8.2", + "path-is-inside": "1.0.2", + "pluralize": "7.0.0", + "progress": "2.0.0", + "require-uncached": "1.0.3", + "semver": "5.4.1", + "strip-ansi": "4.0.0", + "strip-json-comments": "2.0.1", + "table": "4.0.2", + "text-table": "0.2.0" + } + }, + "eslint-scope": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", + "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", + "dev": true, + "requires": { + "esrecurse": "4.2.0", + "estraverse": "4.2.0" + } + }, + "espree": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.1.tgz", + "integrity": "sha1-DJiLirRttTEAoZVK5LqZXd0n2H4=", + "dev": true, + "requires": { + "acorn": "5.2.1", + "acorn-jsx": "3.0.1" + } + }, + "esprima": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", + "dev": true + }, + "esquery": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz", + "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", + "dev": true, + "requires": { + "estraverse": "4.2.0" + } + }, + "esrecurse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz", + "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", + "dev": true, + "requires": { + "estraverse": "4.2.0", + "object-assign": "4.1.1" + } + }, + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "external-editor": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.0.5.tgz", + "integrity": "sha512-Msjo64WT5W+NhOpQXh0nOHm+n0RfU1QUwDnKYvJ8dEJ8zlwLrqXNTv5mSUTJpepf41PDJGyhueTw2vNZW+Fr/w==", + "dev": true, + "requires": { + "iconv-lite": "0.4.19", + "jschardet": "1.6.0", + "tmp": "0.0.33" + } + }, + "fast-deep-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", + "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "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" + } + }, + "file-entry-cache": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", + "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", + "dev": true, + "requires": { + "flat-cache": "1.3.0", + "object-assign": "4.1.1" + } + }, + "flat-cache": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz", + "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", + "dev": true, + "requires": { + "circular-json": "0.3.3", + "del": "2.2.2", + "graceful-fs": "4.1.11", + "write": "0.2.1" + } + }, "fs-extra": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.2.tgz", @@ -79,6 +481,12 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", @@ -92,16 +500,63 @@ "path-is-absolute": "1.0.1" } }, + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true + }, + "globby": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", + "dev": true, + "requires": { + "array-union": "1.0.2", + "arrify": "1.0.1", + "glob": "7.1.2", + "object-assign": "4.1.1", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + } + }, "graceful-fs": { "version": "4.1.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, "has-flag": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" }, + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", + "dev": true + }, + "ignore": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.7.tgz", + "integrity": "sha512-YGG3ejvBNHRqu0559EOxxNFihD0AjpvHlC/pdGKd3X3ofe+CoJkYazwNJYTNebqpPKN+VVQbh4ZFn1DivMNuHA==", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -116,11 +571,127 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, + "inquirer": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", + "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", + "dev": true, + "requires": { + "ansi-escapes": "3.0.0", + "chalk": "2.3.0", + "cli-cursor": "2.1.0", + "cli-width": "2.2.0", + "external-editor": "2.0.5", + "figures": "2.0.0", + "lodash": "4.17.4", + "mute-stream": "0.0.7", + "run-async": "2.3.0", + "rx-lite": "4.0.8", + "rx-lite-aggregates": "4.0.8", + "string-width": "2.1.1", + "strip-ansi": "4.0.0", + "through": "2.3.8" + } + }, "interpret": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.4.tgz", "integrity": "sha1-ggzdWIuGj/sZGoCVBtbJyPISsbA=" }, + "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 + }, + "is-path-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", + "dev": true + }, + "is-path-in-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", + "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", + "dev": true, + "requires": { + "is-path-inside": "1.0.0" + } + }, + "is-path-inside": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", + "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=", + "dev": true, + "requires": { + "path-is-inside": "1.0.2" + } + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-resolvable": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", + "integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=", + "dev": true, + "requires": { + "tryit": "1.0.3" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "js-yaml": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", + "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", + "dev": true, + "requires": { + "argparse": "1.0.9", + "esprima": "4.0.0" + } + }, + "jschardet": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.6.0.tgz", + "integrity": "sha512-xYuhvQ7I9PDJIGBWev9xm0+SMSed3ZDBAmvVjbFR1ZRLAF+vlXcQu6cRI9uAlj81rzikElRVteehwV7DuX2ZmQ==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "dev": true, + "requires": { + "jsonify": "0.0.0" + } + }, "jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -129,6 +700,44 @@ "graceful-fs": "4.1.11" } }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "1.1.2", + "type-check": "0.3.2" + } + }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "dev": true + }, + "lru-cache": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "dev": true, + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } + }, + "mimic-fn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", + "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", + "dev": true + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -137,6 +746,45 @@ "brace-expansion": "1.1.8" } }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "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 + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -145,16 +793,117 @@ "wrappy": "1.0.2" } }, + "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.1.0" + } + }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, + "requires": { + "deep-is": "0.1.3", + "fast-levenshtein": "2.0.6", + "levn": "0.3.0", + "prelude-ls": "1.1.2", + "type-check": "0.3.2", + "wordwrap": "1.0.0" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, "path-parse": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=" }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "2.0.4" + } + }, + "pluralize": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", + "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", + "dev": true + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "dev": true + }, + "progress": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "readable-stream": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", + "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" + } + }, "rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", @@ -163,6 +912,16 @@ "resolve": "1.5.0" } }, + "require-uncached": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", + "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", + "dev": true, + "requires": { + "caller-path": "0.1.0", + "resolve-from": "1.0.1" + } + }, "resolve": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", @@ -171,6 +930,82 @@ "path-parse": "1.0.5" } }, + "resolve-from": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", + "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", + "dev": true + }, + "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.1", + "signal-exit": "3.0.2" + } + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "7.1.2" + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "2.1.0" + } + }, + "rx-lite": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", + "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", + "dev": true + }, + "rx-lite-aggregates": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", + "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", + "dev": true, + "requires": { + "rx-lite": "4.0.8" + } + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "dev": true + }, + "semver": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", + "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, "shelljs": { "version": "0.7.8", "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", @@ -181,6 +1016,69 @@ "rechoir": "0.6.2" } }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "slice-ansi": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", + "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "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" + } + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, + "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" + }, + "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 + } + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, "supports-color": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", @@ -189,20 +1087,112 @@ "has-flag": "2.0.0" } }, + "table": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz", + "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", + "dev": true, + "requires": { + "ajv": "5.3.0", + "ajv-keywords": "2.1.1", + "chalk": "2.3.0", + "lodash": "4.17.4", + "slice-ansi": "1.0.0", + "string-width": "2.1.1" + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "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" + } + }, + "tryit": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz", + "integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics=", + "dev": true + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "1.1.2" + } + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, "universalify": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz", "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=" }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, "validator": { "version": "9.1.1", "resolved": "https://registry.npmjs.org/validator/-/validator-9.1.1.tgz", "integrity": "sha512-1TGGX1GKilfmcEa9rm+9nI9AqIUQK8oj4jZI0DmTGLTPM5jmowBBhyBIHCks73+P1QPZk2i6oOYUq583uOetHQ==" }, + "which": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "dev": true, + "requires": { + "isexe": "2.0.0" + } + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "write": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", + "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", + "dev": true, + "requires": { + "mkdirp": "0.5.1" + } + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true } } } diff --git a/package.json b/package.json index 471228b..ffdb7ba 100644 --- a/package.json +++ b/package.json @@ -32,5 +32,8 @@ "fs-extra": "^4.0.2", "shelljs": "^0.7.8", "validator": "^9.1.1" + }, + "devDependencies": { + "eslint": "^4.10.0" } } From cc474f3a2ec1b10e65dd7a4dcc6b9492f2d0b9f8 Mon Sep 17 00:00:00 2001 From: shunmusanjay Date: Tue, 7 Nov 2017 01:59:37 +0530 Subject: [PATCH 05/37] up-list feature branch --- utils/listFile.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 utils/listFile.js diff --git a/utils/listFile.js b/utils/listFile.js new file mode 100644 index 0000000..b0ab224 --- /dev/null +++ b/utils/listFile.js @@ -0,0 +1,13 @@ +// These functions just return paths. + +var list = 'etc/up-serve/servers.up'; + +function list(domain, inPort, outPort) { + if (inPort) { + return (list + ' ' + domain + ':' + outPort + ' ' + 'proxy' + ' ' + inPort); + } else { + return (list + ' ' + domain + ':' + outPort + ' ' + 'static'); + } +} + +module.exports = listFile; \ No newline at end of file From da770f9c239bcf7b85f52d6128683bb97c7c5a17 Mon Sep 17 00:00:00 2001 From: shunmusanjay Date: Tue, 7 Nov 2017 02:31:04 +0530 Subject: [PATCH 06/37] listFile.js file creation and append --- utils/listFile.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/utils/listFile.js b/utils/listFile.js index b0ab224..477acfa 100644 --- a/utils/listFile.js +++ b/utils/listFile.js @@ -1,13 +1,22 @@ // These functions just return paths. -var list = 'etc/up-serve/servers.up'; +var fs = require('fs-extra'); +var shell = require('shelljs'); +var EOL = require('os').EOL; // \n if used on Linux, \r\n if used on Windows. + +var listFilePath = 'etc/up-serve/servers.up'; function list(domain, inPort, outPort) { + fs.ensureFileSync(listFilePath) // Creates directory if doesn't exist + if (inPort) { - return (list + ' ' + domain + ':' + outPort + ' ' + 'proxy' + ' ' + inPort); + var addr = domain + ':' + outPort + ' ' + 'proxy' + ' ' + inPort + EOL; } else { - return (list + ' ' + domain + ':' + outPort + ' ' + 'static'); + var addr = domain + ':' + outPort + ' ' + 'static' + EOL; } + + //wirtes to the file in path + fs.appendFileSync(listFilePath, addr); } module.exports = listFile; \ No newline at end of file From 9ba538798b8b7f95293ac4ec6ac05c23cb63361a Mon Sep 17 00:00:00 2001 From: shunmusanjay Date: Tue, 7 Nov 2017 02:49:21 +0530 Subject: [PATCH 07/37] appendToList Test --- index.js | 116 ++++++++++++++++++++++++++++-------------------------- utils/listFile.js | 6 +-- 2 files changed, 64 insertions(+), 58 deletions(-) diff --git a/index.js b/index.js index f95b0f2..fb1f0ce 100644 --- a/index.js +++ b/index.js @@ -7,74 +7,80 @@ var chalk = require('chalk'); // Requiring utils var validate = require('./utils/validate'); var requirements = require('./utils/requirements'); +var appendToList = require('./utils/listFile'); // Requiring Actions var createProxyServer = require('./actions/createProxyServer'); var createStaticServer = require('./actions/createStaticServer'); var killServer = require('./actions/killServer'); + +appendToList("example.com", "80"); +appendToList("example2.com", "80", "4000"); + + // Check for requirements such as OS version and nginx install. Throw and exit if requirements not found. #Roadmap: Add ability to satisfy any possible requirements. requirements(); // Comment in development and uncomment this line in production. This should check whether the OS is compatible with this version of `up` -program - .version('0.1.5'); +// program +// .version('0.1.5'); -program - .command('static [outPort]') - .description('Create a static server at this folder.') - .action(function (domain, outPort) { //If outport is not given, 80 is set as default. Later, change this default to reflect nginx's settings. - outPort = outPort || "80"; // This is a string because regex needs to validate it. - if (!validate(domain, outPort)) return; //Validates domain and outport, and if invalid, throws and returns. - createStaticServer(domain, outPort); - if (outPort != "80" || "443") domain = domain + ":" + outPort; - console.log("Done! Your static server has been set up!\nPoint your domain to this server and check " + chalk.cyan(domain) + " to verify!"); - }); +// program +// .command('static [outPort]') +// .description('Create a static server at this folder.') +// .action(function (domain, outPort) { //If outport is not given, 80 is set as default. Later, change this default to reflect nginx's settings. +// outPort = outPort || "80"; // This is a string because regex needs to validate it. +// if (!validate(domain, outPort)) return; //Validates domain and outport, and if invalid, throws and returns. +// createStaticServer(domain, outPort); +// if (outPort != "80" || "443") domain = domain + ":" + outPort; +// console.log("Done! Your static server has been set up!\nPoint your domain to this server and check " + chalk.cyan(domain) + " to verify!"); +// }); -program - .command('proxy [outPort]') - .description('Create a proxy server, listening at port number.') - .action(function (domain, inPort, outPort) { //Inbound port is necessary, but outbound is set to 80 by default. Again, will change this to reflect nginx's settings. - outPort = outPort || "80"; // This is a string because regex needs to validate it. - if (!validate(domain, inPort, outPort)) return; - createProxyServer(domain, inPort, outPort); - if (outPort != "80" || "443") domain = domain + ":" + outPort; - console.log("Done! Your reverse proxy server has been set up!\nPoint your domain to this server and check " + chalk.cyan(domain) + " to verify!"); - }); +// program +// .command('proxy [outPort]') +// .description('Create a proxy server, listening at port number.') +// .action(function (domain, inPort, outPort) { //Inbound port is necessary, but outbound is set to 80 by default. Again, will change this to reflect nginx's settings. +// outPort = outPort || "80"; // This is a string because regex needs to validate it. +// if (!validate(domain, inPort, outPort)) return; +// createProxyServer(domain, inPort, outPort); +// if (outPort != "80" || "443") domain = domain + ":" + outPort; +// console.log("Done! Your reverse proxy server has been set up!\nPoint your domain to this server and check " + chalk.cyan(domain) + " to verify!"); +// }); -program - .command('list') - .description('List all available servers.') - .action(function () { - // Stuff happens here - }); +// program +// .command('list') +// .description('List all available servers.') +// .action(function () { +// // Stuff happens here +// }); -program - .command('kill [ourPort]') - .description('Kill a server.') - .action(function (domain, outPort) { - outPort = outPort || "80"; // This is a string because regex needs to validate it. - killServer(domain, outPort); - console.log("\nDone! Your server has been killed!\n"); - }); +// program +// .command('kill [ourPort]') +// .description('Kill a server.') +// .action(function (domain, outPort) { +// outPort = outPort || "80"; // This is a string because regex needs to validate it. +// killServer(domain, outPort); +// console.log("\nDone! Your server has been killed!\n"); +// }); -program - .command('*') // This should pick invalid commands, but it doesn't, yet. - .action(function () { - console.log("Invalid command. Type " + chalk.cyan('up --help') + " for help."); - }); +// program +// .command('*') // This should pick invalid commands, but it doesn't, yet. +// .action(function () { +// console.log("Invalid command. Type " + chalk.cyan('up --help') + " for help."); +// }); -// Adds custom help text to the automatically generated help. -program.on('--help', function () { - console.log(''); - console.log(' Usage:'); - console.log(''); - console.log(' ', chalk.yellow('$ up'), chalk.cyan('static'), chalk.blue('domain-name')); - console.log(' Set up a static server at domain-name'); - console.log(''); - console.log(' ', chalk.yellow('$ up'), chalk.cyan('proxy'), chalk.blue('domain-name port-number')); - console.log(' Set up a proxy server listening at port-number'); - console.log(''); -}); +// // Adds custom help text to the automatically generated help. +// program.on('--help', function () { +// console.log(''); +// console.log(' Usage:'); +// console.log(''); +// console.log(' ', chalk.yellow('$ up'), chalk.cyan('static'), chalk.blue('domain-name')); +// console.log(' Set up a static server at domain-name'); +// console.log(''); +// console.log(' ', chalk.yellow('$ up'), chalk.cyan('proxy'), chalk.blue('domain-name port-number')); +// console.log(' Set up a proxy server listening at port-number'); +// console.log(''); +// }); -// Parses commands passed to `up` and chooses one of the above commands. -program.parse(process.argv); \ No newline at end of file +// // Parses commands passed to `up` and chooses one of the above commands. +// program.parse(process.argv); \ No newline at end of file diff --git a/utils/listFile.js b/utils/listFile.js index 477acfa..56ddfc9 100644 --- a/utils/listFile.js +++ b/utils/listFile.js @@ -1,12 +1,12 @@ // These functions just return paths. - var fs = require('fs-extra'); var shell = require('shelljs'); + var EOL = require('os').EOL; // \n if used on Linux, \r\n if used on Windows. var listFilePath = 'etc/up-serve/servers.up'; -function list(domain, inPort, outPort) { +function appendToList(domain, outPort, inPort) { fs.ensureFileSync(listFilePath) // Creates directory if doesn't exist if (inPort) { @@ -19,4 +19,4 @@ function list(domain, inPort, outPort) { fs.appendFileSync(listFilePath, addr); } -module.exports = listFile; \ No newline at end of file +module.exports = appendToList; \ No newline at end of file From 6d7523b3fb21b40dcc3f208bb7bc3e62a7520f3f Mon Sep 17 00:00:00 2001 From: shunmusanjay Date: Tue, 7 Nov 2017 03:52:39 +0530 Subject: [PATCH 08/37] listFile.js delete line if domain | outPort exist --- index.js | 114 +++++++++++++++++++++++++++--------------------------- utils/listFile.js | 42 +++++++++++++++++++- 2 files changed, 97 insertions(+), 59 deletions(-) diff --git a/index.js b/index.js index fb1f0ce..94ba248 100644 --- a/index.js +++ b/index.js @@ -15,72 +15,72 @@ var createStaticServer = require('./actions/createStaticServer'); var killServer = require('./actions/killServer'); -appendToList("example.com", "80"); -appendToList("example2.com", "80", "4000"); +// appendToList("example.com", "80"); +// appendToList("example2.com", "80", "4000"); // Check for requirements such as OS version and nginx install. Throw and exit if requirements not found. #Roadmap: Add ability to satisfy any possible requirements. requirements(); // Comment in development and uncomment this line in production. This should check whether the OS is compatible with this version of `up` -// program -// .version('0.1.5'); +program + .version('0.1.5'); -// program -// .command('static [outPort]') -// .description('Create a static server at this folder.') -// .action(function (domain, outPort) { //If outport is not given, 80 is set as default. Later, change this default to reflect nginx's settings. -// outPort = outPort || "80"; // This is a string because regex needs to validate it. -// if (!validate(domain, outPort)) return; //Validates domain and outport, and if invalid, throws and returns. -// createStaticServer(domain, outPort); -// if (outPort != "80" || "443") domain = domain + ":" + outPort; -// console.log("Done! Your static server has been set up!\nPoint your domain to this server and check " + chalk.cyan(domain) + " to verify!"); -// }); +program + .command('static [outPort]') + .description('Create a static server at this folder.') + .action(function (domain, outPort) { //If outport is not given, 80 is set as default. Later, change this default to reflect nginx's settings. + outPort = outPort || "80"; // This is a string because regex needs to validate it. + if (!validate(domain, outPort)) return; //Validates domain and outport, and if invalid, throws and returns. + createStaticServer(domain, outPort); + if (outPort != "80" || "443") domain = domain + ":" + outPort; + console.log("Done! Your static server has been set up!\nPoint your domain to this server and check " + chalk.cyan(domain) + " to verify!"); + }); -// program -// .command('proxy [outPort]') -// .description('Create a proxy server, listening at port number.') -// .action(function (domain, inPort, outPort) { //Inbound port is necessary, but outbound is set to 80 by default. Again, will change this to reflect nginx's settings. -// outPort = outPort || "80"; // This is a string because regex needs to validate it. -// if (!validate(domain, inPort, outPort)) return; -// createProxyServer(domain, inPort, outPort); -// if (outPort != "80" || "443") domain = domain + ":" + outPort; -// console.log("Done! Your reverse proxy server has been set up!\nPoint your domain to this server and check " + chalk.cyan(domain) + " to verify!"); -// }); +program + .command('proxy [outPort]') + .description('Create a proxy server, listening at port number.') + .action(function (domain, inPort, outPort) { //Inbound port is necessary, but outbound is set to 80 by default. Again, will change this to reflect nginx's settings. + outPort = outPort || "80"; // This is a string because regex needs to validate it. + if (!validate(domain, inPort, outPort)) return; + createProxyServer(domain, inPort, outPort); + if (outPort != "80" || "443") domain = domain + ":" + outPort; + console.log("Done! Your reverse proxy server has been set up!\nPoint your domain to this server and check " + chalk.cyan(domain) + " to verify!"); + }); -// program -// .command('list') -// .description('List all available servers.') -// .action(function () { -// // Stuff happens here -// }); +program + .command('list') + .description('List all available servers.') + .action(function () { + // Stuff happens here + }); -// program -// .command('kill [ourPort]') -// .description('Kill a server.') -// .action(function (domain, outPort) { -// outPort = outPort || "80"; // This is a string because regex needs to validate it. -// killServer(domain, outPort); -// console.log("\nDone! Your server has been killed!\n"); -// }); +program + .command('kill [ourPort]') + .description('Kill a server.') + .action(function (domain, outPort) { + outPort = outPort || "80"; // This is a string because regex needs to validate it. + killServer(domain, outPort); + console.log("\nDone! Your server has been killed!\n"); + }); -// program -// .command('*') // This should pick invalid commands, but it doesn't, yet. -// .action(function () { -// console.log("Invalid command. Type " + chalk.cyan('up --help') + " for help."); -// }); +program + .command('*') // This should pick invalid commands, but it doesn't, yet. + .action(function () { + console.log("Invalid command. Type " + chalk.cyan('up --help') + " for help."); + }); -// // Adds custom help text to the automatically generated help. -// program.on('--help', function () { -// console.log(''); -// console.log(' Usage:'); -// console.log(''); -// console.log(' ', chalk.yellow('$ up'), chalk.cyan('static'), chalk.blue('domain-name')); -// console.log(' Set up a static server at domain-name'); -// console.log(''); -// console.log(' ', chalk.yellow('$ up'), chalk.cyan('proxy'), chalk.blue('domain-name port-number')); -// console.log(' Set up a proxy server listening at port-number'); -// console.log(''); -// }); +// Adds custom help text to the automatically generated help. +program.on('--help', function () { + console.log(''); + console.log(' Usage:'); + console.log(''); + console.log(' ', chalk.yellow('$ up'), chalk.cyan('static'), chalk.blue('domain-name')); + console.log(' Set up a static server at domain-name'); + console.log(''); + console.log(' ', chalk.yellow('$ up'), chalk.cyan('proxy'), chalk.blue('domain-name port-number')); + console.log(' Set up a proxy server listening at port-number'); + console.log(''); +}); -// // Parses commands passed to `up` and chooses one of the above commands. -// program.parse(process.argv); \ No newline at end of file +// Parses commands passed to `up` and chooses one of the above commands. +program.parse(process.argv); \ No newline at end of file diff --git a/utils/listFile.js b/utils/listFile.js index 56ddfc9..ce84905 100644 --- a/utils/listFile.js +++ b/utils/listFile.js @@ -14,9 +14,47 @@ function appendToList(domain, outPort, inPort) { } else { var addr = domain + ':' + outPort + ' ' + 'static' + EOL; } + //reads file to check if domain already exist + var data = fs.readFileSync(listFilePath); + + var dataString = data.toString().split("\n"); + + var isDomainUnique = dataString.search(domain); // returns -1 if not found else line count + var isOutPortUnique = dataString.search(outPort); // returns -1 if not found else line count + + if (isDomainUnique == -1 && isOutPortUnique == -1) { + //wirtes to the file in path + fs.appendFileSync(listFilePath, addr); + } else if (isDomainUnique == -1 || isOutPortUnique == -1) { + if (isDomainUnique == -1) { + var deleteOutPortLine = dataString.slice(isOutPortUnique).join('\n'); + fs.appendFileSync(listFilePath, deleteOutPortLine); + fs.appendFileSync(listFilePath, addr); + + } else { + var deleteDomainLine = dataString.slice(isDomainUnique).join('\n'); + fs.appendFileSync(listFilePath, deleteDomainLine); + fs.appendFileSync(listFilePath, addr); + } + + } else { + var deleteDomainLine = dataString.slice(isDomainUnique).join('\n'); + fs.appendFileSync(listFilePath, deleteDomainLine); + + var data = fs.readFileSync(listFilePath); + + var dataString = data.toString().split("\n"); + var isOutPortUnique = dataString.search(outPort); // returns -1 if not found else line count + + var deleteOutPortLine = dataString.slice(isOutPortUnique).join('\n'); + fs.appendFileSync(listFilePath, deleteOutPortLine); + + fs.appendFileSync(listFilePath, addr); + + } + + - //wirtes to the file in path - fs.appendFileSync(listFilePath, addr); } module.exports = appendToList; \ No newline at end of file From 1e3e404cc550ff620429b6a590c45a47ca6360f9 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Tue, 7 Nov 2017 12:49:02 +0530 Subject: [PATCH 09/37] Working on reading and writing json --- etc/up-serve/servers.up | 0 index.js | 6 ++-- package-lock.json | 2 +- utils/listFile.js | 83 +++++++++++++++++++++---------------------------- 4 files changed, 38 insertions(+), 53 deletions(-) create mode 100644 etc/up-serve/servers.up mode change 100644 => 100755 index.js diff --git a/etc/up-serve/servers.up b/etc/up-serve/servers.up new file mode 100644 index 0000000..e69de29 diff --git a/index.js b/index.js old mode 100644 new mode 100755 index 94ba248..cf8e6e7 --- a/index.js +++ b/index.js @@ -14,10 +14,8 @@ var createProxyServer = require('./actions/createProxyServer'); var createStaticServer = require('./actions/createStaticServer'); var killServer = require('./actions/killServer'); - -// appendToList("example.com", "80"); -// appendToList("example2.com", "80", "4000"); - +appendToList("example.com", "80"); +appendToList("example2.com", "80", "4000"); // Check for requirements such as OS version and nginx install. Throw and exit if requirements not found. #Roadmap: Add ability to satisfy any possible requirements. requirements(); // Comment in development and uncomment this line in production. This should check whether the OS is compatible with this version of `up` diff --git a/package-lock.json b/package-lock.json index 0b002a6..bf62478 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "up-serve", - "version": "0.1.3", + "version": "0.1.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/utils/listFile.js b/utils/listFile.js index ce84905..fc5abdb 100644 --- a/utils/listFile.js +++ b/utils/listFile.js @@ -1,59 +1,46 @@ -// These functions just return paths. var fs = require('fs-extra'); var shell = require('shelljs'); var EOL = require('os').EOL; // \n if used on Linux, \r\n if used on Windows. -var listFilePath = 'etc/up-serve/servers.up'; +var listFilePath = "/etc/up-serve/servers.up"; function appendToList(domain, outPort, inPort) { - fs.ensureFileSync(listFilePath) // Creates directory if doesn't exist - - if (inPort) { - var addr = domain + ':' + outPort + ' ' + 'proxy' + ' ' + inPort + EOL; - } else { - var addr = domain + ':' + outPort + ' ' + 'static' + EOL; - } - //reads file to check if domain already exist - var data = fs.readFileSync(listFilePath); - - var dataString = data.toString().split("\n"); - - var isDomainUnique = dataString.search(domain); // returns -1 if not found else line count - var isOutPortUnique = dataString.search(outPort); // returns -1 if not found else line count - - if (isDomainUnique == -1 && isOutPortUnique == -1) { - //wirtes to the file in path - fs.appendFileSync(listFilePath, addr); - } else if (isDomainUnique == -1 || isOutPortUnique == -1) { - if (isDomainUnique == -1) { - var deleteOutPortLine = dataString.slice(isOutPortUnique).join('\n'); - fs.appendFileSync(listFilePath, deleteOutPortLine); - fs.appendFileSync(listFilePath, addr); - - } else { - var deleteDomainLine = dataString.slice(isDomainUnique).join('\n'); - fs.appendFileSync(listFilePath, deleteDomainLine); - fs.appendFileSync(listFilePath, addr); - } - - } else { - var deleteDomainLine = dataString.slice(isDomainUnique).join('\n'); - fs.appendFileSync(listFilePath, deleteDomainLine); - - var data = fs.readFileSync(listFilePath); - - var dataString = data.toString().split("\n"); - var isOutPortUnique = dataString.search(outPort); // returns -1 if not found else line count - - var deleteOutPortLine = dataString.slice(isOutPortUnique).join('\n'); - fs.appendFileSync(listFilePath, deleteOutPortLine); - - fs.appendFileSync(listFilePath, addr); - - } - + if (!inPort) { + var domBlock = { + domain: { + "type": "static", + "outPort": outPort, + "inPort": undefined + } + } + } else { + var domBlock = { + domain: { + "type": "proxy", + "outPort": outPort, + "inPort": inPort + } + } + } + if (fs.existsSync(listFilePath)) { + var jsonFile = fs.readFileSync(listFilePath); + jsonFile = JSON.parse(jsonFile); + + for (block in jsonFile) { + if (block.domain == domain && block.outPort == outPort) { + delete jsonFile.block; + return; + } + } + + jsonFile.domain = domBlock.domain; + } + else { + var jsonFile = JSON.stringify(domBlock) + EOL; + } + fs.writeFileSync(listFilePath, jsonFile); } From edea53acd7424588f5a41bd22286acaeb4d80bc8 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Tue, 7 Nov 2017 12:50:35 +0530 Subject: [PATCH 10/37] Removed etc folder --- etc/up-serve/servers.up | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 etc/up-serve/servers.up diff --git a/etc/up-serve/servers.up b/etc/up-serve/servers.up deleted file mode 100644 index e69de29..0000000 From a3c3b08cc120b1c16ae69af6c1c41c0a6ff8b9cb Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Tue, 7 Nov 2017 23:03:24 +0530 Subject: [PATCH 11/37] appendToList works --- index.js | 7 +++++-- utils/listFile.js | 38 +++++++++++++++++++++++++++----------- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/index.js b/index.js index cf8e6e7..90fcdc1 100755 --- a/index.js +++ b/index.js @@ -14,9 +14,12 @@ var createProxyServer = require('./actions/createProxyServer'); var createStaticServer = require('./actions/createStaticServer'); var killServer = require('./actions/killServer'); -appendToList("example.com", "80"); -appendToList("example2.com", "80", "4000"); +var jsonFile; +// appendToList("example.com", "80"); +// appendToList("example2.com", "80", "4000"); +// appendToList("example2.com", "80", "4444"); +console.log(jsonFile); // Check for requirements such as OS version and nginx install. Throw and exit if requirements not found. #Roadmap: Add ability to satisfy any possible requirements. requirements(); // Comment in development and uncomment this line in production. This should check whether the OS is compatible with this version of `up` diff --git a/utils/listFile.js b/utils/listFile.js index fc5abdb..2572705 100644 --- a/utils/listFile.js +++ b/utils/listFile.js @@ -7,41 +7,57 @@ var listFilePath = "/etc/up-serve/servers.up"; function appendToList(domain, outPort, inPort) { + var jsonFile = {}; + var domBlock; + if (!inPort) { - var domBlock = { - domain: { + domBlock = { "type": "static", "outPort": outPort, "inPort": undefined - } } } else { - var domBlock = { - domain: { + domBlock = { "type": "proxy", "outPort": outPort, "inPort": inPort - } } } + + jsonFile = { + } + + var newBlock = { + + } +/* + Object.assign(jsonFile, domain.domBlock) + return jsonFile; +*/ + + if (fs.existsSync(listFilePath)) { - var jsonFile = fs.readFileSync(listFilePath); + jsonFile = fs.readFileSync(listFilePath); jsonFile = JSON.parse(jsonFile); for (block in jsonFile) { - if (block.domain == domain && block.outPort == outPort) { + if (block.domain == domain && block.domain.outPort == outPort) { delete jsonFile.block; return; } } - jsonFile.domain = domBlock.domain; + jsonFile[domain] = domBlock; + jsonFile = JSON.stringify(jsonFile); } else { - var jsonFile = JSON.stringify(domBlock) + EOL; + jsonFile = { + } + jsonFile[domain] = domBlock; + jsonFile = JSON.stringify(jsonFile); } fs.writeFileSync(listFilePath, jsonFile); - + } module.exports = appendToList; \ No newline at end of file From af115cb81c6d8443091e3b3c9df1d4c32cb755d4 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Tue, 7 Nov 2017 23:27:20 +0530 Subject: [PATCH 12/37] Added json-beautify --- index.js | 6 +++--- package-lock.json | 5 +++++ package.json | 1 + utils/listFile.js | 20 +++++--------------- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/index.js b/index.js index 90fcdc1..d69294e 100755 --- a/index.js +++ b/index.js @@ -15,9 +15,9 @@ var createStaticServer = require('./actions/createStaticServer'); var killServer = require('./actions/killServer'); var jsonFile; -// appendToList("example.com", "80"); -// appendToList("example2.com", "80", "4000"); -// appendToList("example2.com", "80", "4444"); +//appendToList("example.com", "80"); +//appendToList("example2.com", "80", "4000"); +//appendToList("example2.com", "80", "4444"); console.log(jsonFile); // Check for requirements such as OS version and nginx install. Throw and exit if requirements not found. #Roadmap: Add ability to satisfy any possible requirements. diff --git a/package-lock.json b/package-lock.json index bf62478..27e3a0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -121,6 +121,11 @@ "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.4.tgz", "integrity": "sha1-ggzdWIuGj/sZGoCVBtbJyPISsbA=" }, + "json-beautify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-beautify/-/json-beautify-1.0.1.tgz", + "integrity": "sha1-WYtQ1Mjqm4/KWru0C34svTrUwvw=" + }, "jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", diff --git a/package.json b/package.json index 471228b..e4f5998 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "chalk": "^2.3.0", "commander": "^2.11.0", "fs-extra": "^4.0.2", + "json-beautify": "^1.0.1", "shelljs": "^0.7.8", "validator": "^9.1.1" } diff --git a/utils/listFile.js b/utils/listFile.js index 2572705..4331a5e 100644 --- a/utils/listFile.js +++ b/utils/listFile.js @@ -1,5 +1,6 @@ var fs = require('fs-extra'); var shell = require('shelljs'); +var beautifyJSON = require("json-beautify"); var EOL = require('os').EOL; // \n if used on Linux, \r\n if used on Windows. @@ -24,17 +25,7 @@ function appendToList(domain, outPort, inPort) { } } - jsonFile = { - } - - var newBlock = { - - } -/* - Object.assign(jsonFile, domain.domBlock) - return jsonFile; -*/ - + jsonFile = {} if (fs.existsSync(listFilePath)) { jsonFile = fs.readFileSync(listFilePath); @@ -48,13 +39,12 @@ function appendToList(domain, outPort, inPort) { } jsonFile[domain] = domBlock; - jsonFile = JSON.stringify(jsonFile); + jsonFile = beautifyJSON(jsonFile, null, 2, 30); } else { - jsonFile = { - } + jsonFile = {} jsonFile[domain] = domBlock; - jsonFile = JSON.stringify(jsonFile); + jsonFile = beautifyJSON(jsonFile); } fs.writeFileSync(listFilePath, jsonFile); From 38d72b12294cbded4b9a3cd232b386a54feffb73 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Tue, 7 Nov 2017 23:31:55 +0530 Subject: [PATCH 13/37] Removed redundant initialization --- utils/listFile.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/utils/listFile.js b/utils/listFile.js index 4331a5e..cbd6770 100644 --- a/utils/listFile.js +++ b/utils/listFile.js @@ -24,8 +24,6 @@ function appendToList(domain, outPort, inPort) { "inPort": inPort } } - - jsonFile = {} if (fs.existsSync(listFilePath)) { jsonFile = fs.readFileSync(listFilePath); @@ -42,7 +40,6 @@ function appendToList(domain, outPort, inPort) { jsonFile = beautifyJSON(jsonFile, null, 2, 30); } else { - jsonFile = {} jsonFile[domain] = domBlock; jsonFile = beautifyJSON(jsonFile); } @@ -50,4 +47,4 @@ function appendToList(domain, outPort, inPort) { } -module.exports = appendToList; \ No newline at end of file +module.exports = appendToList; From 48516a66121dea1e8d3c1174b6f46ecd71be5a92 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Tue, 7 Nov 2017 23:55:33 +0530 Subject: [PATCH 14/37] Create listFile directory if doesn't exist --- index.js | 19 +++++++++++++------ utils/listFile.js | 5 ++++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index d69294e..90e5583 100755 --- a/index.js +++ b/index.js @@ -14,17 +14,19 @@ var createProxyServer = require('./actions/createProxyServer'); var createStaticServer = require('./actions/createStaticServer'); var killServer = require('./actions/killServer'); -var jsonFile; //appendToList("example.com", "80"); //appendToList("example2.com", "80", "4000"); //appendToList("example2.com", "80", "4444"); -console.log(jsonFile); // Check for requirements such as OS version and nginx install. Throw and exit if requirements not found. #Roadmap: Add ability to satisfy any possible requirements. requirements(); // Comment in development and uncomment this line in production. This should check whether the OS is compatible with this version of `up` program - .version('0.1.5'); + .version('0.1.5') + .arguments(' [options]') + .action ( function(cmd) { + var cmdValue = cmd; + }); program .command('static [outPort]') @@ -65,9 +67,9 @@ program }); program - .command('*') // This should pick invalid commands, but it doesn't, yet. + .command('*') // This picks invalid commands, but doesn't pick empty commands, yet. .action(function () { - console.log("Invalid command. Type " + chalk.cyan('up --help') + " for help."); + console.log("\n Invalid command. Type " + chalk.cyan('up --help') + " for help.\n"); }); // Adds custom help text to the automatically generated help. @@ -84,4 +86,9 @@ program.on('--help', function () { }); // Parses commands passed to `up` and chooses one of the above commands. -program.parse(process.argv); \ No newline at end of file +program.parse(process.argv); + +if (typeof cmdValue == 'undefined') { + console.log("\nNo commands given. Exiting...\n"); + process.exit(1); +} \ No newline at end of file diff --git a/utils/listFile.js b/utils/listFile.js index 4331a5e..814ec2a 100644 --- a/utils/listFile.js +++ b/utils/listFile.js @@ -4,10 +4,13 @@ var beautifyJSON = require("json-beautify"); var EOL = require('os').EOL; // \n if used on Linux, \r\n if used on Windows. -var listFilePath = "/etc/up-serve/servers.up"; +var listFileDir = "/etc/up-serve/"; +var listFilePath = listFileDir + "servers.up"; function appendToList(domain, outPort, inPort) { + shell.mkdir('-p', listFileDir); + var jsonFile = {}; var domBlock; From 7df9ccf425f05d0bd945295f1c2f3f245dea6211 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Tue, 7 Nov 2017 23:58:28 +0530 Subject: [PATCH 15/37] Add listFile directory if doens't exist --- utils/listFile.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/utils/listFile.js b/utils/listFile.js index 814ec2a..c278460 100644 --- a/utils/listFile.js +++ b/utils/listFile.js @@ -27,8 +27,6 @@ function appendToList(domain, outPort, inPort) { "inPort": inPort } } - - jsonFile = {} if (fs.existsSync(listFilePath)) { jsonFile = fs.readFileSync(listFilePath); @@ -45,7 +43,6 @@ function appendToList(domain, outPort, inPort) { jsonFile = beautifyJSON(jsonFile, null, 2, 30); } else { - jsonFile = {} jsonFile[domain] = domBlock; jsonFile = beautifyJSON(jsonFile); } From 183680ac35d98e02c932fe2ad8b9c5fddc79ab52 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Tue, 7 Nov 2017 23:58:38 +0530 Subject: [PATCH 16/37] Revert "Create listFile directory if doesn't exist" This reverts commit 48516a66121dea1e8d3c1174b6f46ecd71be5a92. modified: index.js --- index.js | 19 ++++++------------- utils/listFile.js | 5 +---- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/index.js b/index.js index 90e5583..d69294e 100755 --- a/index.js +++ b/index.js @@ -14,19 +14,17 @@ var createProxyServer = require('./actions/createProxyServer'); var createStaticServer = require('./actions/createStaticServer'); var killServer = require('./actions/killServer'); +var jsonFile; //appendToList("example.com", "80"); //appendToList("example2.com", "80", "4000"); //appendToList("example2.com", "80", "4444"); +console.log(jsonFile); // Check for requirements such as OS version and nginx install. Throw and exit if requirements not found. #Roadmap: Add ability to satisfy any possible requirements. requirements(); // Comment in development and uncomment this line in production. This should check whether the OS is compatible with this version of `up` program - .version('0.1.5') - .arguments(' [options]') - .action ( function(cmd) { - var cmdValue = cmd; - }); + .version('0.1.5'); program .command('static [outPort]') @@ -67,9 +65,9 @@ program }); program - .command('*') // This picks invalid commands, but doesn't pick empty commands, yet. + .command('*') // This should pick invalid commands, but it doesn't, yet. .action(function () { - console.log("\n Invalid command. Type " + chalk.cyan('up --help') + " for help.\n"); + console.log("Invalid command. Type " + chalk.cyan('up --help') + " for help."); }); // Adds custom help text to the automatically generated help. @@ -86,9 +84,4 @@ program.on('--help', function () { }); // Parses commands passed to `up` and chooses one of the above commands. -program.parse(process.argv); - -if (typeof cmdValue == 'undefined') { - console.log("\nNo commands given. Exiting...\n"); - process.exit(1); -} \ No newline at end of file +program.parse(process.argv); \ No newline at end of file diff --git a/utils/listFile.js b/utils/listFile.js index c278460..7451ac7 100644 --- a/utils/listFile.js +++ b/utils/listFile.js @@ -4,13 +4,10 @@ var beautifyJSON = require("json-beautify"); var EOL = require('os').EOL; // \n if used on Linux, \r\n if used on Windows. -var listFileDir = "/etc/up-serve/"; -var listFilePath = listFileDir + "servers.up"; +var listFilePath = "/etc/up-serve/servers.up"; function appendToList(domain, outPort, inPort) { - shell.mkdir('-p', listFileDir); - var jsonFile = {}; var domBlock; From 6058823faf4847ea0608fc82851fb76578928332 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Wed, 8 Nov 2017 00:01:56 +0530 Subject: [PATCH 17/37] Removed test lines from index.js --- index.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/index.js b/index.js index d69294e..efb8cfd 100755 --- a/index.js +++ b/index.js @@ -14,12 +14,6 @@ var createProxyServer = require('./actions/createProxyServer'); var createStaticServer = require('./actions/createStaticServer'); var killServer = require('./actions/killServer'); -var jsonFile; -//appendToList("example.com", "80"); -//appendToList("example2.com", "80", "4000"); -//appendToList("example2.com", "80", "4444"); - -console.log(jsonFile); // Check for requirements such as OS version and nginx install. Throw and exit if requirements not found. #Roadmap: Add ability to satisfy any possible requirements. requirements(); // Comment in development and uncomment this line in production. This should check whether the OS is compatible with this version of `up` From f8553d78cb527d97118c0cf1c2dc18fb5888d839 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Wed, 8 Nov 2017 00:50:19 +0530 Subject: [PATCH 18/37] Working on adding and removing list items --- actions/createProxyServer.js | 6 ++++-- actions/createStaticServer.js | 5 +++-- actions/killServer.js | 2 +- index.js | 24 +++++++++++++++--------- package-lock.json | 19 +++++++++++++++++++ package.json | 1 + utils/listFile.js | 33 ++++++++++++++++++++++++++++++--- utils/nginxPath.js | 12 ++++++------ 8 files changed, 79 insertions(+), 23 deletions(-) diff --git a/actions/createProxyServer.js b/actions/createProxyServer.js index 666cd29..d38f984 100644 --- a/actions/createProxyServer.js +++ b/actions/createProxyServer.js @@ -4,11 +4,12 @@ var shell = require('shelljs'); var npath = require('../utils/nginxPath'); var conf = require('../utils/nginxConf'); var nginxReload = require('../utils/nginxReload'); +var appendToList = require('../utils/listFile').appendToList; var EOL = require('os').EOL; // \n if used on Linux, \r\n if used on Windows. function createProxyServer(domain, inPort, outPort) { - fs.outputFileSync((conf(npath.availableSites(), domain, outPort)), + fs.outputFileSync((conf(npath.confD(), domain, outPort)), "server {" + EOL + " listen " + outPort + ";" + EOL + " listen [::]:" + outPort + ";" + EOL + @@ -26,8 +27,9 @@ function createProxyServer(domain, inPort, outPort) { "}" ); shell.mkdir('-p', npath.enabledSites()); // Creates directory if doesn't exist - shell.ln('-sf', conf(npath.availableSites(), domain, outPort), conf(npath.enabledSites(), domain, outPort)); // Symlink the conf file from sites-available to sites-enabled + shell.ln('-sf', conf(npath.confD(), domain, outPort), conf(npath.enabledSites(), domain, outPort)); // Symlink the conf file from sites-available to sites-enabled + appendToList(domain, outPort, inPort); nginxReload(); } diff --git a/actions/createStaticServer.js b/actions/createStaticServer.js index 8c09997..5ad99b4 100644 --- a/actions/createStaticServer.js +++ b/actions/createStaticServer.js @@ -11,7 +11,7 @@ var EOL = require('os').EOL; // \n if used on Linux, \r\n if used on Windows. function createStaticServer(domain, outPort) { outPort = outPort || 80; - fs.outputFileSync((conf(npath.availableSites(), domain, outPort)), // Gets nginx's paths from nginxPath.js + fs.outputFileSync((conf(npath.confD(), domain, outPort)), // Gets nginx's paths from nginxPath.js "server {" + EOL + " listen " + outPort + ";" + EOL + " listen [::]:" + outPort + ";" + EOL + @@ -26,11 +26,12 @@ function createStaticServer(domain, outPort) { ); shell.mkdir('-p', npath.enabledSites()); // Creates directory if doesn't exist shell.rm('-rf', conf(npath.enabledSites(), domain, outPort)); // Removes domain from sites-enabled if exists - shell.ln('-sf', conf(npath.availableSites(), domain, outPort), conf(npath.enabledSites(), domain, outPort)); // Symlink the conf file from sites-available to sites-enabled + shell.ln('-sf', conf(npath.confD(), domain, outPort), conf(npath.enabledSites(), domain, outPort)); // Symlink the conf file from sites-available to sites-enabled shell.rm('-rf', npath.webRootDomain(domain, outPort)); // Removes domain from webroot if exists shell.mkdir('-p', npath.webRoot()); // Creating the nginx www path if it doesn't exist so symlink doesn't fail shell.ln('-sf', currentPath, npath.webRootDomain(domain, outPort)); // Symlink current directory to nginx's web root + appendToList(domain, outPort); nginxReload(); } diff --git a/actions/killServer.js b/actions/killServer.js index ed0d25d..065e9da 100644 --- a/actions/killServer.js +++ b/actions/killServer.js @@ -6,7 +6,7 @@ var nginxReload = require('../utils/nginxReload'); function killServer(domain, outPort) { shell.rm('-rf', conf(npath.enabledSites(), domain, outPort)); - shell.rm('-rf', conf(npath.availableSites(), domain, outPort)); + shell.rm('-rf', conf(npath.confD(), domain, outPort)); shell.rm('-rf', npath.webRootDomain(domain, outPort)); nginxReload(); diff --git a/index.js b/index.js index efb8cfd..2b1bea1 100755 --- a/index.js +++ b/index.js @@ -3,17 +3,22 @@ // Requiring npm modules var program = require('commander'); var chalk = require('chalk'); - -// Requiring utils -var validate = require('./utils/validate'); -var requirements = require('./utils/requirements'); -var appendToList = require('./utils/listFile'); +var fs = require('fs-extra'); +var prettyjson = require('prettyjson'); // Requiring Actions var createProxyServer = require('./actions/createProxyServer'); var createStaticServer = require('./actions/createStaticServer'); var killServer = require('./actions/killServer'); +// Requiring utils +var validate = require('./utils/validate'); +var requirements = require('./utils/requirements'); +var appendToList = require('./utils/listFile').appendToList; +var readServers = require('./utils/listFile').readServers; + +var EOL = require('os').EOL; + // Check for requirements such as OS version and nginx install. Throw and exit if requirements not found. #Roadmap: Add ability to satisfy any possible requirements. requirements(); // Comment in development and uncomment this line in production. This should check whether the OS is compatible with this version of `up` @@ -28,7 +33,7 @@ program if (!validate(domain, outPort)) return; //Validates domain and outport, and if invalid, throws and returns. createStaticServer(domain, outPort); if (outPort != "80" || "443") domain = domain + ":" + outPort; - console.log("Done! Your static server has been set up!\nPoint your domain to this server and check " + chalk.cyan(domain) + " to verify!"); + console.log("\nDone! Your static server has been set up!\nPoint your domain to this server and check " + chalk.cyan(domain) + " to verify!"); }); program @@ -39,14 +44,15 @@ program if (!validate(domain, inPort, outPort)) return; createProxyServer(domain, inPort, outPort); if (outPort != "80" || "443") domain = domain + ":" + outPort; - console.log("Done! Your reverse proxy server has been set up!\nPoint your domain to this server and check " + chalk.cyan(domain) + " to verify!"); + console.log("\nDone! Your reverse proxy server has been set up!\nPoint your domain to this server and check " + chalk.cyan(domain) + " to verify!"); }); program .command('list') .description('List all available servers.') .action(function () { - // Stuff happens here + var serversList = readServers(); + console.log(EOL + prettyjson.render(serversList) + EOL); }); program @@ -61,7 +67,7 @@ program program .command('*') // This should pick invalid commands, but it doesn't, yet. .action(function () { - console.log("Invalid command. Type " + chalk.cyan('up --help') + " for help."); + console.log("\nInvalid command. Type " + chalk.cyan('up --help') + " for help.\n"); }); // Adds custom help text to the automatically generated help. diff --git a/package-lock.json b/package-lock.json index 27e3a0c..e584f36 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,6 +49,11 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, + "colors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=" + }, "commander": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", @@ -142,6 +147,11 @@ "brace-expansion": "1.1.8" } }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -160,6 +170,15 @@ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=" }, + "prettyjson": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prettyjson/-/prettyjson-1.2.1.tgz", + "integrity": "sha1-/P+rQdGcq0365eV15kJGYZsS0ok=", + "requires": { + "colors": "1.1.2", + "minimist": "1.2.0" + } + }, "rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", diff --git a/package.json b/package.json index e4f5998..bfed2d4 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "commander": "^2.11.0", "fs-extra": "^4.0.2", "json-beautify": "^1.0.1", + "prettyjson": "^1.2.1", "shelljs": "^0.7.8", "validator": "^9.1.1" } diff --git a/utils/listFile.js b/utils/listFile.js index cbd6770..ae59f0b 100644 --- a/utils/listFile.js +++ b/utils/listFile.js @@ -7,7 +7,8 @@ var EOL = require('os').EOL; // \n if used on Linux, \r\n if used on Windows. var listFilePath = "/etc/up-serve/servers.up"; function appendToList(domain, outPort, inPort) { - + + inPort = inPort || undefined; var jsonFile = {}; var domBlock; @@ -43,8 +44,34 @@ function appendToList(domain, outPort, inPort) { jsonFile[domain] = domBlock; jsonFile = beautifyJSON(jsonFile); } - fs.writeFileSync(listFilePath, jsonFile); + fs.writeFileSync(listFilePath, jsonFile); } -module.exports = appendToList; +function readServers () { + return JSON.parse(fs.readFileSync(listFilePath)); +} + +function removeFromList (domain, outPort) { + var jsonFile = {}; + if (fs.existsSync(listFilePath)) { + jsonFile = fs.readFileSync(listFilePath); + jsonFile = JSON.parse(jsonFile); + + for (block in jsonFile) { + if (block.domain == domain && block.domain.outPort == outPort) { + delete jsonFile.block; + return; + } + } + + jsonFile = beautifyJSON(jsonFile, null, 2, 30); + } + else { + console.log("\Domain was not in my list. Are you sure?\n") + } + fs.writeFileSync(listFilePath, jsonFile); +} + +module.exports.appendToList = appendToList; +module.exports.readServers = readServers; \ No newline at end of file diff --git a/utils/nginxPath.js b/utils/nginxPath.js index 91dbe8c..97b32af 100644 --- a/utils/nginxPath.js +++ b/utils/nginxPath.js @@ -1,17 +1,17 @@ // These functions just return paths. Later, these should be modified to poll from nginx's config. -var available = "/etc/nginx/sites-available/"; var enabled = "/etc/nginx/sites-enabled/"; +var conf = "/etc/nginx/conf.d/"; var wwwRoot = "/var/www/"; -function availableSites() { - return available; -} - function enabledSites() { return enabled; } +function confD() { + return conf; +} + function webRoot() { return wwwRoot; } @@ -21,7 +21,7 @@ function webRootDomain(domain, outPort) { return rootWithDomain; } -module.exports.availableSites = availableSites; +module.exports.confD = confD; module.exports.enabledSites = enabledSites; module.exports.webRoot = webRoot; module.exports.webRootDomain = webRootDomain; \ No newline at end of file From 23fd1b9e4351a6c192b7455ad584903b2817906e Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Wed, 8 Nov 2017 01:16:15 +0530 Subject: [PATCH 19/37] `up kill` works, with known exceptions: The code block that removes a server block if it exists does not work yet. Appears twice in `listFile.js` - `appendToList` and `removeFromList` --- actions/createStaticServer.js | 1 + actions/killServer.js | 2 ++ utils/listFile.js | 17 +++++++++-------- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/actions/createStaticServer.js b/actions/createStaticServer.js index 5ad99b4..65e33e4 100644 --- a/actions/createStaticServer.js +++ b/actions/createStaticServer.js @@ -5,6 +5,7 @@ var path = require('path'); var npath = require('../utils/nginxPath'); var conf = require('../utils/nginxConf'); var nginxReload = require('../utils/nginxReload'); +var appendToList = require('../utils/listFile').appendToList; var currentPath = path.normalize(process.cwd()); var EOL = require('os').EOL; // \n if used on Linux, \r\n if used on Windows. diff --git a/actions/killServer.js b/actions/killServer.js index 065e9da..01d62d3 100644 --- a/actions/killServer.js +++ b/actions/killServer.js @@ -3,6 +3,7 @@ var shell = require('shelljs'); var npath = require('../utils/nginxPath'); var conf = require('../utils/nginxConf'); var nginxReload = require('../utils/nginxReload'); +var removeFromList = require('../utils/listFile').removeFromList; function killServer(domain, outPort) { shell.rm('-rf', conf(npath.enabledSites(), domain, outPort)); @@ -10,6 +11,7 @@ function killServer(domain, outPort) { shell.rm('-rf', npath.webRootDomain(domain, outPort)); nginxReload(); + removeFromList(domain, outPort); } module.exports = killServer; \ No newline at end of file diff --git a/utils/listFile.js b/utils/listFile.js index ae59f0b..66f19bf 100644 --- a/utils/listFile.js +++ b/utils/listFile.js @@ -31,7 +31,7 @@ function appendToList(domain, outPort, inPort) { jsonFile = JSON.parse(jsonFile); for (block in jsonFile) { - if (block.domain == domain && block.domain.outPort == outPort) { + if (block[domain] == domain && block[domain].outPort == outPort) { delete jsonFile.block; return; } @@ -45,11 +45,6 @@ function appendToList(domain, outPort, inPort) { jsonFile = beautifyJSON(jsonFile); } fs.writeFileSync(listFilePath, jsonFile); - -} - -function readServers () { - return JSON.parse(fs.readFileSync(listFilePath)); } function removeFromList (domain, outPort) { @@ -59,8 +54,9 @@ function removeFromList (domain, outPort) { jsonFile = JSON.parse(jsonFile); for (block in jsonFile) { - if (block.domain == domain && block.domain.outPort == outPort) { + if (block[domain] == domain && block[domain].outPort == outPort) { delete jsonFile.block; + console.log('\nDomain was deleted successfully.\n'); return; } } @@ -73,5 +69,10 @@ function removeFromList (domain, outPort) { fs.writeFileSync(listFilePath, jsonFile); } +function readServers () { + return JSON.parse(fs.readFileSync(listFilePath)); +} + module.exports.appendToList = appendToList; -module.exports.readServers = readServers; \ No newline at end of file +module.exports.readServers = readServers; +module.exports.removeFromList = removeFromList; \ No newline at end of file From a103573ea75f4960fc765d9227c2d600b63ffc4e Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Wed, 8 Nov 2017 01:33:14 +0530 Subject: [PATCH 20/37] Bump to 0.1.8 --- README.md | 4 +- package-lock.json | 2437 +++++++++++++++++++++++++++-------------------------- 2 files changed, 1224 insertions(+), 1217 deletions(-) diff --git a/README.md b/README.md index 160e313..960a593 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@ # up -> Current version: `up v.0.1.5 (Pre-Alpha)` +> Current version: `up v.0.1.8 (Pre-Alpha)` -> Notes: `up` has landed in pre-alpha! 🎉 Changelog will be added from `up v.0.2.0` [(Alpha/MVP)](Roadmap.md)\ +> Notes: `up` is coming soon to `Alpha`! 🎉 Changelog will be added from `up v.0.2.0` [(Alpha/MVP)](Roadmap.md)\ > ⚠️ ❌ `up` is still not ready for use yet! Do not attempt to use this in development or production until alpha! **`up`** is a command line application that creates nginx server blocks quickly with a single command. diff --git a/package-lock.json b/package-lock.json index 7eb24f2..1866dd6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,1217 +1,1224 @@ { - "name": "up-serve", - "version": "0.1.5", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "acorn": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz", - "integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==", - "dev": true - }, - "acorn-jsx": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", - "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", - "dev": true, - "requires": { - "acorn": "3.3.0" - }, - "dependencies": { - "acorn": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", - "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", - "dev": true - } - } - }, - "ajv": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.3.0.tgz", - "integrity": "sha1-RBT/dKUIecII7l/cgm4ywwNUnto=", - "dev": true, - "requires": { - "co": "4.6.0", - "fast-deep-equal": "1.0.0", - "fast-json-stable-stringify": "2.0.0", - "json-schema-traverse": "0.3.1" - } - }, - "ajv-keywords": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.1.tgz", - "integrity": "sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I=", - "dev": true - }, - "ansi-escapes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", - "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", - "dev": true - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "requires": { - "color-convert": "1.9.0" - } - }, - "argparse": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", - "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", - "dev": true, - "requires": { - "sprintf-js": "1.0.3" - } - }, - "array-union": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", - "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", - "dev": true, - "requires": { - "array-uniq": "1.0.3" - } - }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", - "dev": true - }, - "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true - }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "esutils": "2.0.2", - "js-tokens": "3.0.2" - }, - "dependencies": { - "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": "https://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.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "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 - } - } - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" - }, - "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", - "requires": { - "balanced-match": "1.0.0", - "concat-map": "0.0.1" - } - }, - "caller-path": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", - "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", - "dev": true, - "requires": { - "callsites": "0.2.0" - } - }, - "callsites": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", - "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", - "dev": true - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "circular-json": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", - "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", - "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": { - "restore-cursor": "2.0.0" - } - }, - "cli-width": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", - "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", - "dev": true - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", - "dev": true - }, - "color-convert": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", - "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, - "colors": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=" - }, - "commander": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==" - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "concat-stream": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", - "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", - "dev": true, - "requires": { - "inherits": "2.0.3", - "readable-stream": "2.3.3", - "typedarray": "0.0.6" - } - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "dev": true, - "requires": { - "lru-cache": "4.1.1", - "shebang-command": "1.2.0", - "which": "1.3.0" - } - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true - }, - "del": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", - "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", - "dev": true, - "requires": { - "globby": "5.0.0", - "is-path-cwd": "1.0.0", - "is-path-in-cwd": "1.0.0", - "object-assign": "4.1.1", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "rimraf": "2.6.2" - } - }, - "doctrine": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", - "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=", - "dev": true, - "requires": { - "esutils": "2.0.2", - "isarray": "1.0.0" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" - }, - "eslint": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.10.0.tgz", - "integrity": "sha512-MMVl8P/dYUFZEvolL8PYt7qc5LNdS2lwheq9BYa5Y07FblhcZqFyaUqlS8TW5QITGex21tV4Lk0a3fK8lsJIkA==", - "dev": true, - "requires": { - "ajv": "5.3.0", - "babel-code-frame": "6.26.0", - "chalk": "2.3.0", - "concat-stream": "1.6.0", - "cross-spawn": "5.1.0", - "debug": "3.1.0", - "doctrine": "2.0.0", - "eslint-scope": "3.7.1", - "espree": "3.5.1", - "esquery": "1.0.0", - "estraverse": "4.2.0", - "esutils": "2.0.2", - "file-entry-cache": "2.0.0", - "functional-red-black-tree": "1.0.1", - "glob": "7.1.2", - "globals": "9.18.0", - "ignore": "3.3.7", - "imurmurhash": "0.1.4", - "inquirer": "3.3.0", - "is-resolvable": "1.0.0", - "js-yaml": "3.10.0", - "json-stable-stringify": "1.0.1", - "levn": "0.3.0", - "lodash": "4.17.4", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "natural-compare": "1.4.0", - "optionator": "0.8.2", - "path-is-inside": "1.0.2", - "pluralize": "7.0.0", - "progress": "2.0.0", - "require-uncached": "1.0.3", - "semver": "5.4.1", - "strip-ansi": "4.0.0", - "strip-json-comments": "2.0.1", - "table": "4.0.2", - "text-table": "0.2.0" - } - }, - "eslint-scope": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", - "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", - "dev": true, - "requires": { - "esrecurse": "4.2.0", - "estraverse": "4.2.0" - } - }, - "espree": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.1.tgz", - "integrity": "sha1-DJiLirRttTEAoZVK5LqZXd0n2H4=", - "dev": true, - "requires": { - "acorn": "5.2.1", - "acorn-jsx": "3.0.1" - } - }, - "esprima": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", - "dev": true - }, - "esquery": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz", - "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", - "dev": true, - "requires": { - "estraverse": "4.2.0" - } - }, - "esrecurse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz", - "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", - "dev": true, - "requires": { - "estraverse": "4.2.0", - "object-assign": "4.1.1" - } - }, - "estraverse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", - "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", - "dev": true - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true - }, - "external-editor": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.0.5.tgz", - "integrity": "sha512-Msjo64WT5W+NhOpQXh0nOHm+n0RfU1QUwDnKYvJ8dEJ8zlwLrqXNTv5mSUTJpepf41PDJGyhueTw2vNZW+Fr/w==", - "dev": true, - "requires": { - "iconv-lite": "0.4.19", - "jschardet": "1.6.0", - "tmp": "0.0.33" - } - }, - "fast-deep-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", - "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "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" - } - }, - "file-entry-cache": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", - "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", - "dev": true, - "requires": { - "flat-cache": "1.3.0", - "object-assign": "4.1.1" - } - }, - "flat-cache": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz", - "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", - "dev": true, - "requires": { - "circular-json": "0.3.3", - "del": "2.2.2", - "graceful-fs": "4.1.11", - "write": "0.2.1" - } - }, - "fs-extra": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.2.tgz", - "integrity": "sha1-+RcExT0bRh+JNFKwwwfZmXZHq2s=", - "requires": { - "graceful-fs": "4.1.11", - "jsonfile": "4.0.0", - "universalify": "0.1.1" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", - "dev": true - }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "globals": { - "version": "9.18.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", - "dev": true - }, - "globby": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", - "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", - "dev": true, - "requires": { - "array-union": "1.0.2", - "arrify": "1.0.1", - "glob": "7.1.2", - "object-assign": "4.1.1", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" - } - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" - }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", - "dev": true - }, - "ignore": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.7.tgz", - "integrity": "sha512-YGG3ejvBNHRqu0559EOxxNFihD0AjpvHlC/pdGKd3X3ofe+CoJkYazwNJYTNebqpPKN+VVQbh4ZFn1DivMNuHA==", - "dev": true - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "inquirer": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", - "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", - "dev": true, - "requires": { - "ansi-escapes": "3.0.0", - "chalk": "2.3.0", - "cli-cursor": "2.1.0", - "cli-width": "2.2.0", - "external-editor": "2.0.5", - "figures": "2.0.0", - "lodash": "4.17.4", - "mute-stream": "0.0.7", - "run-async": "2.3.0", - "rx-lite": "4.0.8", - "rx-lite-aggregates": "4.0.8", - "string-width": "2.1.1", - "strip-ansi": "4.0.0", - "through": "2.3.8" - } - }, - "interpret": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.4.tgz", - "integrity": "sha1-ggzdWIuGj/sZGoCVBtbJyPISsbA=" - }, - "json-beautify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-beautify/-/json-beautify-1.0.1.tgz", - "integrity": "sha1-WYtQ1Mjqm4/KWru0C34svTrUwvw=" - "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 - }, - "is-path-cwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", - "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", - "dev": true - }, - "is-path-in-cwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", - "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", - "dev": true, - "requires": { - "is-path-inside": "1.0.0" - } - }, - "is-path-inside": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", - "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=", - "dev": true, - "requires": { - "path-is-inside": "1.0.2" - } - }, - "is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", - "dev": true - }, - "is-resolvable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", - "integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=", - "dev": true, - "requires": { - "tryit": "1.0.3" - } - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - }, - "js-yaml": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", - "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", - "dev": true, - "requires": { - "argparse": "1.0.9", - "esprima": "4.0.0" - } - }, - "jschardet": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.6.0.tgz", - "integrity": "sha512-xYuhvQ7I9PDJIGBWev9xm0+SMSed3ZDBAmvVjbFR1ZRLAF+vlXcQu6cRI9uAlj81rzikElRVteehwV7DuX2ZmQ==", - "dev": true - }, - "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", - "dev": true - }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "dev": true, - "requires": { - "jsonify": "0.0.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "requires": { - "graceful-fs": "4.1.11" - } - }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", - "dev": true - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "requires": { - "prelude-ls": "1.1.2", - "type-check": "0.3.2" - } - }, - "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", - "dev": true - }, - "lru-cache": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", - "dev": true, - "requires": { - "pseudomap": "1.0.2", - "yallist": "2.1.2" - } - }, - "mimic-fn": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", - "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "requires": { - "brace-expansion": "1.1.8" - } - }, - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "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 - }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1.0.2" - } - }, - "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.1.0" - } - }, - "optionator": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", - "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", - "dev": true, - "requires": { - "deep-is": "0.1.3", - "fast-levenshtein": "2.0.6", - "levn": "0.3.0", - "prelude-ls": "1.1.2", - "type-check": "0.3.2", - "wordwrap": "1.0.0" - } - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" - }, - "path-is-inside": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", - "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", - "dev": true - }, - "path-parse": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", - "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=" - }, - "prettyjson": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prettyjson/-/prettyjson-1.2.1.tgz", - "integrity": "sha1-/P+rQdGcq0365eV15kJGYZsS0ok=", - "requires": { - "colors": "1.1.2", - "minimist": "1.2.0" - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "dev": true - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dev": true, - "requires": { - "pinkie": "2.0.4" - } - }, - "pluralize": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", - "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", - "dev": true - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true - }, - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", - "dev": true - }, - "progress": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", - "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", - "dev": true - }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", - "dev": true - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" - } - }, - "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", - "requires": { - "resolve": "1.5.0" - } - }, - "require-uncached": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", - "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", - "dev": true, - "requires": { - "caller-path": "0.1.0", - "resolve-from": "1.0.1" - } - }, - "resolve": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", - "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", - "requires": { - "path-parse": "1.0.5" - } - }, - "resolve-from": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", - "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", - "dev": true - }, - "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.1", - "signal-exit": "3.0.2" - } - }, - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, - "requires": { - "glob": "7.1.2" - } - }, - "run-async": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", - "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", - "dev": true, - "requires": { - "is-promise": "2.1.0" - } - }, - "rx-lite": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", - "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", - "dev": true - }, - "rx-lite-aggregates": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", - "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", - "dev": true, - "requires": { - "rx-lite": "4.0.8" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true - }, - "semver": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", - "dev": true - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "shelljs": { - "version": "0.7.8", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", - "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", - "requires": { - "glob": "7.1.2", - "interpret": "1.0.4", - "rechoir": "0.6.2" - } - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, - "slice-ansi": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", - "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "2.0.0" - } - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "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" - } - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "5.1.1" - } - }, - "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" - }, - "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 - } - } - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "requires": { - "has-flag": "2.0.0" - } - }, - "table": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz", - "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", - "dev": true, - "requires": { - "ajv": "5.3.0", - "ajv-keywords": "2.1.1", - "chalk": "2.3.0", - "lodash": "4.17.4", - "slice-ansi": "1.0.0", - "string-width": "2.1.1" - } - }, - "text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", - "dev": true - }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "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" - } - }, - "tryit": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz", - "integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics=", - "dev": true - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "requires": { - "prelude-ls": "1.1.2" - } - }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", - "dev": true - }, - "universalify": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz", - "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=" - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "validator": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/validator/-/validator-9.1.1.tgz", - "integrity": "sha512-1TGGX1GKilfmcEa9rm+9nI9AqIUQK8oj4jZI0DmTGLTPM5jmowBBhyBIHCks73+P1QPZk2i6oOYUq583uOetHQ==" - }, - "which": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", - "dev": true, - "requires": { - "isexe": "2.0.0" - } - }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "write": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", - "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", - "dev": true, - "requires": { - "mkdirp": "0.5.1" - } - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true - } - } + "name": "up-serve", + "version": "0.1.5", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "acorn": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz", + "integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==", + "dev": true + }, + "acorn-jsx": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", + "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", + "dev": true, + "requires": { + "acorn": "3.3.0" + }, + "dependencies": { + "acorn": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", + "dev": true + } + } + }, + "ajv": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.3.0.tgz", + "integrity": "sha1-RBT/dKUIecII7l/cgm4ywwNUnto=", + "dev": true, + "requires": { + "co": "4.6.0", + "fast-deep-equal": "1.0.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" + } + }, + "ajv-keywords": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.1.tgz", + "integrity": "sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I=", + "dev": true + }, + "ansi-escapes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", + "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "requires": { + "color-convert": "1.9.0" + } + }, + "argparse": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", + "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "dev": true, + "requires": { + "sprintf-js": "1.0.3" + } + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "1.0.3" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" + }, + "dependencies": { + "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": "https://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.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "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 + } + } + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "caller-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", + "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", + "dev": true, + "requires": { + "callsites": "0.2.0" + } + }, + "callsites": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", + "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", + "dev": true + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "circular-json": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", + "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", + "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": { + "restore-cursor": "2.0.0" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true + }, + "color-convert": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", + "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "colors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=" + }, + "commander": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "concat-stream": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", + "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.3", + "typedarray": "0.0.6" + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "4.1.1", + "shebang-command": "1.2.0", + "which": "1.3.0" + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "del": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", + "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", + "dev": true, + "requires": { + "globby": "5.0.0", + "is-path-cwd": "1.0.0", + "is-path-in-cwd": "1.0.0", + "object-assign": "4.1.1", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "rimraf": "2.6.2" + } + }, + "doctrine": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", + "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=", + "dev": true, + "requires": { + "esutils": "2.0.2", + "isarray": "1.0.0" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "eslint": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.10.0.tgz", + "integrity": "sha512-MMVl8P/dYUFZEvolL8PYt7qc5LNdS2lwheq9BYa5Y07FblhcZqFyaUqlS8TW5QITGex21tV4Lk0a3fK8lsJIkA==", + "dev": true, + "requires": { + "ajv": "5.3.0", + "babel-code-frame": "6.26.0", + "chalk": "2.3.0", + "concat-stream": "1.6.0", + "cross-spawn": "5.1.0", + "debug": "3.1.0", + "doctrine": "2.0.0", + "eslint-scope": "3.7.1", + "espree": "3.5.1", + "esquery": "1.0.0", + "estraverse": "4.2.0", + "esutils": "2.0.2", + "file-entry-cache": "2.0.0", + "functional-red-black-tree": "1.0.1", + "glob": "7.1.2", + "globals": "9.18.0", + "ignore": "3.3.7", + "imurmurhash": "0.1.4", + "inquirer": "3.3.0", + "is-resolvable": "1.0.0", + "js-yaml": "3.10.0", + "json-stable-stringify": "1.0.1", + "levn": "0.3.0", + "lodash": "4.17.4", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "natural-compare": "1.4.0", + "optionator": "0.8.2", + "path-is-inside": "1.0.2", + "pluralize": "7.0.0", + "progress": "2.0.0", + "require-uncached": "1.0.3", + "semver": "5.4.1", + "strip-ansi": "4.0.0", + "strip-json-comments": "2.0.1", + "table": "4.0.2", + "text-table": "0.2.0" + } + }, + "eslint-scope": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", + "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", + "dev": true, + "requires": { + "esrecurse": "4.2.0", + "estraverse": "4.2.0" + } + }, + "espree": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.1.tgz", + "integrity": "sha1-DJiLirRttTEAoZVK5LqZXd0n2H4=", + "dev": true, + "requires": { + "acorn": "5.2.1", + "acorn-jsx": "3.0.1" + } + }, + "esprima": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", + "dev": true + }, + "esquery": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz", + "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", + "dev": true, + "requires": { + "estraverse": "4.2.0" + } + }, + "esrecurse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz", + "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", + "dev": true, + "requires": { + "estraverse": "4.2.0", + "object-assign": "4.1.1" + } + }, + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "external-editor": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.0.5.tgz", + "integrity": "sha512-Msjo64WT5W+NhOpQXh0nOHm+n0RfU1QUwDnKYvJ8dEJ8zlwLrqXNTv5mSUTJpepf41PDJGyhueTw2vNZW+Fr/w==", + "dev": true, + "requires": { + "iconv-lite": "0.4.19", + "jschardet": "1.6.0", + "tmp": "0.0.33" + } + }, + "fast-deep-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", + "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "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" + } + }, + "file-entry-cache": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", + "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", + "dev": true, + "requires": { + "flat-cache": "1.3.0", + "object-assign": "4.1.1" + } + }, + "flat-cache": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz", + "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", + "dev": true, + "requires": { + "circular-json": "0.3.3", + "del": "2.2.2", + "graceful-fs": "4.1.11", + "write": "0.2.1" + } + }, + "fs-extra": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.2.tgz", + "integrity": "sha1-+RcExT0bRh+JNFKwwwfZmXZHq2s=", + "requires": { + "graceful-fs": "4.1.11", + "jsonfile": "4.0.0", + "universalify": "0.1.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true + }, + "globby": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", + "dev": true, + "requires": { + "array-union": "1.0.2", + "arrify": "1.0.1", + "glob": "7.1.2", + "object-assign": "4.1.1", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" + }, + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", + "dev": true + }, + "ignore": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.7.tgz", + "integrity": "sha512-YGG3ejvBNHRqu0559EOxxNFihD0AjpvHlC/pdGKd3X3ofe+CoJkYazwNJYTNebqpPKN+VVQbh4ZFn1DivMNuHA==", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "inquirer": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", + "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", + "dev": true, + "requires": { + "ansi-escapes": "3.0.0", + "chalk": "2.3.0", + "cli-cursor": "2.1.0", + "cli-width": "2.2.0", + "external-editor": "2.0.5", + "figures": "2.0.0", + "lodash": "4.17.4", + "mute-stream": "0.0.7", + "run-async": "2.3.0", + "rx-lite": "4.0.8", + "rx-lite-aggregates": "4.0.8", + "string-width": "2.1.1", + "strip-ansi": "4.0.0", + "through": "2.3.8" + } + }, + "interpret": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.4.tgz", + "integrity": "sha1-ggzdWIuGj/sZGoCVBtbJyPISsbA=" + }, + "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 + }, + "is-path-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", + "dev": true + }, + "is-path-in-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", + "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", + "dev": true, + "requires": { + "is-path-inside": "1.0.0" + } + }, + "is-path-inside": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", + "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=", + "dev": true, + "requires": { + "path-is-inside": "1.0.2" + } + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-resolvable": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", + "integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=", + "dev": true, + "requires": { + "tryit": "1.0.3" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "js-yaml": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", + "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", + "dev": true, + "requires": { + "argparse": "1.0.9", + "esprima": "4.0.0" + } + }, + "jschardet": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.6.0.tgz", + "integrity": "sha512-xYuhvQ7I9PDJIGBWev9xm0+SMSed3ZDBAmvVjbFR1ZRLAF+vlXcQu6cRI9uAlj81rzikElRVteehwV7DuX2ZmQ==", + "dev": true + }, + "json-beautify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-beautify/-/json-beautify-1.0.1.tgz", + "integrity": "sha1-WYtQ1Mjqm4/KWru0C34svTrUwvw=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "dev": true, + "requires": { + "jsonify": "0.0.0" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "4.1.11" + } + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "1.1.2", + "type-check": "0.3.2" + } + }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "dev": true + }, + "lru-cache": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "dev": true, + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } + }, + "mimic-fn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", + "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "1.1.8" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "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 + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1.0.2" + } + }, + "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.1.0" + } + }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, + "requires": { + "deep-is": "0.1.3", + "fast-levenshtein": "2.0.6", + "levn": "0.3.0", + "prelude-ls": "1.1.2", + "type-check": "0.3.2", + "wordwrap": "1.0.0" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=" + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "2.0.4" + } + }, + "pluralize": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", + "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", + "dev": true + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "prettyjson": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prettyjson/-/prettyjson-1.2.1.tgz", + "integrity": "sha1-/P+rQdGcq0365eV15kJGYZsS0ok=", + "requires": { + "colors": "1.1.2", + "minimist": "1.2.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + } + } + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "dev": true + }, + "progress": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "readable-stream": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", + "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" + } + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "requires": { + "resolve": "1.5.0" + } + }, + "require-uncached": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", + "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", + "dev": true, + "requires": { + "caller-path": "0.1.0", + "resolve-from": "1.0.1" + } + }, + "resolve": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", + "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", + "requires": { + "path-parse": "1.0.5" + } + }, + "resolve-from": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", + "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", + "dev": true + }, + "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.1", + "signal-exit": "3.0.2" + } + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "7.1.2" + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "2.1.0" + } + }, + "rx-lite": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", + "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", + "dev": true + }, + "rx-lite-aggregates": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", + "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", + "dev": true, + "requires": { + "rx-lite": "4.0.8" + } + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "dev": true + }, + "semver": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", + "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "shelljs": { + "version": "0.7.8", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", + "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", + "requires": { + "glob": "7.1.2", + "interpret": "1.0.4", + "rechoir": "0.6.2" + } + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "slice-ansi": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", + "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "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" + } + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, + "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" + }, + "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 + } + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "requires": { + "has-flag": "2.0.0" + } + }, + "table": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz", + "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", + "dev": true, + "requires": { + "ajv": "5.3.0", + "ajv-keywords": "2.1.1", + "chalk": "2.3.0", + "lodash": "4.17.4", + "slice-ansi": "1.0.0", + "string-width": "2.1.1" + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "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" + } + }, + "tryit": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz", + "integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics=", + "dev": true + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "1.1.2" + } + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "universalify": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz", + "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=" + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "validator": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/validator/-/validator-9.1.1.tgz", + "integrity": "sha512-1TGGX1GKilfmcEa9rm+9nI9AqIUQK8oj4jZI0DmTGLTPM5jmowBBhyBIHCks73+P1QPZk2i6oOYUq583uOetHQ==" + }, + "which": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "dev": true, + "requires": { + "isexe": "2.0.0" + } + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "write": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", + "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", + "dev": true, + "requires": { + "mkdirp": "0.5.1" + } + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + } + } } From 8f4c86b9cde4e82e4d02a9563a78e89256195836 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Wed, 8 Nov 2017 01:34:18 +0530 Subject: [PATCH 21/37] Bump package.json to 0.1.8 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1866dd6..1e6be01 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "up-serve", - "version": "0.1.5", + "version": "0.1.8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index e404e15..1e29975 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "up-serve", - "version": "0.1.5", + "version": "0.1.8", "description": "A cli tool to quickly create and manage nginx server blocks.", "main": "index.js", "scripts": { From 1de71a28cb225c16e739975f5ff1506b482b51a7 Mon Sep 17 00:00:00 2001 From: Thomas Rory Gummerson Date: Wed, 8 Nov 2017 12:29:30 +0100 Subject: [PATCH 22/37] Tabs in ESLint config --- .eslintrc.json | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 2a8c5a6..01ded7a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,21 +1,21 @@ { - "env": { - "node": true - }, - "extends": "eslint:recommended", - "rules": { - "no-console": "off", - "indent": [ - "error", - "tab" - ], - "linebreak-style": [ - "error", - "unix" - ], - "semi": [ - "error", - "always" - ] - } + "env": { + "node": true + }, + "extends": "eslint:recommended", + "rules": { + "no-console": "off", + "indent": [ + "error", + "tab" + ], + "linebreak-style": [ + "error", + "unix" + ], + "semi": [ + "error", + "always" + ] + } } \ No newline at end of file From b97daf1d676397bcc7e8711ca18cd9fc9413d6a4 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Wed, 8 Nov 2017 21:43:49 +0530 Subject: [PATCH 23/37] Removed dependency on `validator` and added local module. Working on bugs. --- .eslintrc.json | 3 +- actions/killServer.js | 2 +- actions/listServers.js | 12 + assets/tlds.txt | 1542 ++++++++++++++++++++++++++++++++++++++++++++++ build/fetchTLDS.js | 7 + index.js | 10 +- package-lock.json | 10 - package.json | 7 +- servers.up | 1 + utils/isFQDN.js | 61 ++ utils/listFile.js | 73 ++- utils/removeFromArray.js | 15 + utils/validate.js | 3 +- 13 files changed, 1684 insertions(+), 62 deletions(-) create mode 100644 actions/listServers.js create mode 100644 assets/tlds.txt create mode 100644 build/fetchTLDS.js create mode 100644 servers.up create mode 100644 utils/isFQDN.js create mode 100644 utils/removeFromArray.js diff --git a/.eslintrc.json b/.eslintrc.json index 2a8c5a6..e61caec 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,7 @@ { "env": { - "node": true + "node": true, + "es6": true }, "extends": "eslint:recommended", "rules": { diff --git a/actions/killServer.js b/actions/killServer.js index 01d62d3..333bcda 100644 --- a/actions/killServer.js +++ b/actions/killServer.js @@ -10,8 +10,8 @@ function killServer(domain, outPort) { shell.rm('-rf', conf(npath.confD(), domain, outPort)); shell.rm('-rf', npath.webRootDomain(domain, outPort)); - nginxReload(); removeFromList(domain, outPort); + nginxReload(); } module.exports = killServer; \ No newline at end of file diff --git a/actions/listServers.js b/actions/listServers.js new file mode 100644 index 0000000..349154c --- /dev/null +++ b/actions/listServers.js @@ -0,0 +1,12 @@ +var readServers = require('../utils/listFile').readServers; +var prettyjson = require('prettyjson'); + +var EOL = require('os').EOL; + +function listServers() { + var serversList = readServers(); + if(serversList) console.log(EOL + prettyjson.render(serversList) + EOL); + else console.log("\nNo servers were found! Create some using `up`!\n"); +} + +module.exports = listServers; \ No newline at end of file diff --git a/assets/tlds.txt b/assets/tlds.txt new file mode 100644 index 0000000..c87ced8 --- /dev/null +++ b/assets/tlds.txt @@ -0,0 +1,1542 @@ +# Version 2017110701, Last Updated Wed Nov 8 07:07:02 2017 UTC +AAA +AARP +ABARTH +ABB +ABBOTT +ABBVIE +ABC +ABLE +ABOGADO +ABUDHABI +AC +ACADEMY +ACCENTURE +ACCOUNTANT +ACCOUNTANTS +ACO +ACTIVE +ACTOR +AD +ADAC +ADS +ADULT +AE +AEG +AERO +AETNA +AF +AFAMILYCOMPANY +AFL +AFRICA +AG +AGAKHAN +AGENCY +AI +AIG +AIGO +AIRBUS +AIRFORCE +AIRTEL +AKDN +AL +ALFAROMEO +ALIBABA +ALIPAY +ALLFINANZ +ALLSTATE +ALLY +ALSACE +ALSTOM +AM +AMERICANEXPRESS +AMERICANFAMILY +AMEX +AMFAM +AMICA +AMSTERDAM +ANALYTICS +ANDROID +ANQUAN +ANZ +AO +AOL +APARTMENTS +APP +APPLE +AQ +AQUARELLE +AR +ARAB +ARAMCO +ARCHI +ARMY +ARPA +ART +ARTE +AS +ASDA +ASIA +ASSOCIATES +AT +ATHLETA +ATTORNEY +AU +AUCTION +AUDI +AUDIBLE +AUDIO +AUSPOST +AUTHOR +AUTO +AUTOS +AVIANCA +AW +AWS +AX +AXA +AZ +AZURE +BA +BABY +BAIDU +BANAMEX +BANANAREPUBLIC +BAND +BANK +BAR +BARCELONA +BARCLAYCARD +BARCLAYS +BAREFOOT +BARGAINS +BASEBALL +BASKETBALL +BAUHAUS +BAYERN +BB +BBC +BBT +BBVA +BCG +BCN +BD +BE +BEATS +BEAUTY +BEER +BENTLEY +BERLIN +BEST +BESTBUY +BET +BF +BG +BH +BHARTI +BI +BIBLE +BID +BIKE +BING +BINGO +BIO +BIZ +BJ +BLACK +BLACKFRIDAY +BLANCO +BLOCKBUSTER +BLOG +BLOOMBERG +BLUE +BM +BMS +BMW +BN +BNL +BNPPARIBAS +BO +BOATS +BOEHRINGER +BOFA +BOM +BOND +BOO +BOOK +BOOKING +BOOTS +BOSCH +BOSTIK +BOSTON +BOT +BOUTIQUE +BOX +BR +BRADESCO +BRIDGESTONE +BROADWAY +BROKER +BROTHER +BRUSSELS +BS +BT +BUDAPEST +BUGATTI +BUILD +BUILDERS +BUSINESS +BUY +BUZZ +BV +BW +BY +BZ +BZH +CA +CAB +CAFE +CAL +CALL +CALVINKLEIN +CAM +CAMERA +CAMP +CANCERRESEARCH +CANON +CAPETOWN +CAPITAL +CAPITALONE +CAR +CARAVAN +CARDS +CARE +CAREER +CAREERS +CARS +CARTIER +CASA +CASE +CASEIH +CASH +CASINO +CAT +CATERING +CATHOLIC +CBA +CBN +CBRE +CBS +CC +CD +CEB +CENTER +CEO +CERN +CF +CFA +CFD +CG +CH +CHANEL +CHANNEL +CHASE +CHAT +CHEAP +CHINTAI +CHRISTMAS +CHROME +CHRYSLER +CHURCH +CI +CIPRIANI +CIRCLE +CISCO +CITADEL +CITI +CITIC +CITY +CITYEATS +CK +CL +CLAIMS +CLEANING +CLICK +CLINIC +CLINIQUE +CLOTHING +CLOUD +CLUB +CLUBMED +CM +CN +CO +COACH +CODES +COFFEE +COLLEGE +COLOGNE +COM +COMCAST +COMMBANK +COMMUNITY +COMPANY +COMPARE +COMPUTER +COMSEC +CONDOS +CONSTRUCTION +CONSULTING +CONTACT +CONTRACTORS +COOKING +COOKINGCHANNEL +COOL +COOP +CORSICA +COUNTRY +COUPON +COUPONS +COURSES +CR +CREDIT +CREDITCARD +CREDITUNION +CRICKET +CROWN +CRS +CRUISE +CRUISES +CSC +CU +CUISINELLA +CV +CW +CX +CY +CYMRU +CYOU +CZ +DABUR +DAD +DANCE +DATA +DATE +DATING +DATSUN +DAY +DCLK +DDS +DE +DEAL +DEALER +DEALS +DEGREE +DELIVERY +DELL +DELOITTE +DELTA +DEMOCRAT +DENTAL +DENTIST +DESI +DESIGN +DEV +DHL +DIAMONDS +DIET +DIGITAL +DIRECT +DIRECTORY +DISCOUNT +DISCOVER +DISH +DIY +DJ +DK +DM +DNP +DO +DOCS +DOCTOR +DODGE +DOG +DOHA +DOMAINS +DOT +DOWNLOAD +DRIVE +DTV +DUBAI +DUCK +DUNLOP +DUNS +DUPONT +DURBAN +DVAG +DVR +DZ +EARTH +EAT +EC +ECO +EDEKA +EDU +EDUCATION +EE +EG +EMAIL +EMERCK +ENERGY +ENGINEER +ENGINEERING +ENTERPRISES +EPOST +EPSON +EQUIPMENT +ER +ERICSSON +ERNI +ES +ESQ +ESTATE +ESURANCE +ET +ETISALAT +EU +EUROVISION +EUS +EVENTS +EVERBANK +EXCHANGE +EXPERT +EXPOSED +EXPRESS +EXTRASPACE +FAGE +FAIL +FAIRWINDS +FAITH +FAMILY +FAN +FANS +FARM +FARMERS +FASHION +FAST +FEDEX +FEEDBACK +FERRARI +FERRERO +FI +FIAT +FIDELITY +FIDO +FILM +FINAL +FINANCE +FINANCIAL +FIRE +FIRESTONE +FIRMDALE +FISH +FISHING +FIT +FITNESS +FJ +FK +FLICKR +FLIGHTS +FLIR +FLORIST +FLOWERS +FLY +FM +FO +FOO +FOOD +FOODNETWORK +FOOTBALL +FORD +FOREX +FORSALE +FORUM +FOUNDATION +FOX +FR +FREE +FRESENIUS +FRL +FROGANS +FRONTDOOR +FRONTIER +FTR +FUJITSU +FUJIXEROX +FUN +FUND +FURNITURE +FUTBOL +FYI +GA +GAL +GALLERY +GALLO +GALLUP +GAME +GAMES +GAP +GARDEN +GB +GBIZ +GD +GDN +GE +GEA +GENT +GENTING +GEORGE +GF +GG +GGEE +GH +GI +GIFT +GIFTS +GIVES +GIVING +GL +GLADE +GLASS +GLE +GLOBAL +GLOBO +GM +GMAIL +GMBH +GMO +GMX +GN +GODADDY +GOLD +GOLDPOINT +GOLF +GOO +GOODHANDS +GOODYEAR +GOOG +GOOGLE +GOP +GOT +GOV +GP +GQ +GR +GRAINGER +GRAPHICS +GRATIS +GREEN +GRIPE +GROCERY +GROUP +GS +GT +GU +GUARDIAN +GUCCI +GUGE +GUIDE +GUITARS +GURU +GW +GY +HAIR +HAMBURG +HANGOUT +HAUS +HBO +HDFC +HDFCBANK +HEALTH +HEALTHCARE +HELP +HELSINKI +HERE +HERMES +HGTV +HIPHOP +HISAMITSU +HITACHI +HIV +HK +HKT +HM +HN +HOCKEY +HOLDINGS +HOLIDAY +HOMEDEPOT +HOMEGOODS +HOMES +HOMESENSE +HONDA +HONEYWELL +HORSE +HOSPITAL +HOST +HOSTING +HOT +HOTELES +HOTELS +HOTMAIL +HOUSE +HOW +HR +HSBC +HT +HU +HUGHES +HYATT +HYUNDAI +IBM +ICBC +ICE +ICU +ID +IE +IEEE +IFM +IKANO +IL +IM +IMAMAT +IMDB +IMMO +IMMOBILIEN +IN +INDUSTRIES +INFINITI +INFO +ING +INK +INSTITUTE +INSURANCE +INSURE +INT +INTEL +INTERNATIONAL +INTUIT +INVESTMENTS +IO +IPIRANGA +IQ +IR +IRISH +IS +ISELECT +ISMAILI +IST +ISTANBUL +IT +ITAU +ITV +IVECO +IWC +JAGUAR +JAVA +JCB +JCP +JE +JEEP +JETZT +JEWELRY +JIO +JLC +JLL +JM +JMP +JNJ +JO +JOBS +JOBURG +JOT +JOY +JP +JPMORGAN +JPRS +JUEGOS +JUNIPER +KAUFEN +KDDI +KE +KERRYHOTELS +KERRYLOGISTICS +KERRYPROPERTIES +KFH +KG +KH +KI +KIA +KIM +KINDER +KINDLE +KITCHEN +KIWI +KM +KN +KOELN +KOMATSU +KOSHER +KP +KPMG +KPN +KR +KRD +KRED +KUOKGROUP +KW +KY +KYOTO +KZ +LA +LACAIXA +LADBROKES +LAMBORGHINI +LAMER +LANCASTER +LANCIA +LANCOME +LAND +LANDROVER +LANXESS +LASALLE +LAT +LATINO +LATROBE +LAW +LAWYER +LB +LC +LDS +LEASE +LECLERC +LEFRAK +LEGAL +LEGO +LEXUS +LGBT +LI +LIAISON +LIDL +LIFE +LIFEINSURANCE +LIFESTYLE +LIGHTING +LIKE +LILLY +LIMITED +LIMO +LINCOLN +LINDE +LINK +LIPSY +LIVE +LIVING +LIXIL +LK +LOAN +LOANS +LOCKER +LOCUS +LOFT +LOL +LONDON +LOTTE +LOTTO +LOVE +LPL +LPLFINANCIAL +LR +LS +LT +LTD +LTDA +LU +LUNDBECK +LUPIN +LUXE +LUXURY +LV +LY +MA +MACYS +MADRID +MAIF +MAISON +MAKEUP +MAN +MANAGEMENT +MANGO +MAP +MARKET +MARKETING +MARKETS +MARRIOTT +MARSHALLS +MASERATI +MATTEL +MBA +MC +MCKINSEY +MD +ME +MED +MEDIA +MEET +MELBOURNE +MEME +MEMORIAL +MEN +MENU +MEO +MERCKMSD +METLIFE +MG +MH +MIAMI +MICROSOFT +MIL +MINI +MINT +MIT +MITSUBISHI +MK +ML +MLB +MLS +MM +MMA +MN +MO +MOBI +MOBILE +MOBILY +MODA +MOE +MOI +MOM +MONASH +MONEY +MONSTER +MOPAR +MORMON +MORTGAGE +MOSCOW +MOTO +MOTORCYCLES +MOV +MOVIE +MOVISTAR +MP +MQ +MR +MS +MSD +MT +MTN +MTR +MU +MUSEUM +MUTUAL +MV +MW +MX +MY +MZ +NA +NAB +NADEX +NAGOYA +NAME +NATIONWIDE +NATURA +NAVY +NBA +NC +NE +NEC +NET +NETBANK +NETFLIX +NETWORK +NEUSTAR +NEW +NEWHOLLAND +NEWS +NEXT +NEXTDIRECT +NEXUS +NF +NFL +NG +NGO +NHK +NI +NICO +NIKE +NIKON +NINJA +NISSAN +NISSAY +NL +NO +NOKIA +NORTHWESTERNMUTUAL +NORTON +NOW +NOWRUZ +NOWTV +NP +NR +NRA +NRW +NTT +NU +NYC +NZ +OBI +OBSERVER +OFF +OFFICE +OKINAWA +OLAYAN +OLAYANGROUP +OLDNAVY +OLLO +OM +OMEGA +ONE +ONG +ONL +ONLINE +ONYOURSIDE +OOO +OPEN +ORACLE +ORANGE +ORG +ORGANIC +ORIGINS +OSAKA +OTSUKA +OTT +OVH +PA +PAGE +PANASONIC +PANERAI +PARIS +PARS +PARTNERS +PARTS +PARTY +PASSAGENS +PAY +PCCW +PE +PET +PF +PFIZER +PG +PH +PHARMACY +PHD +PHILIPS +PHONE +PHOTO +PHOTOGRAPHY +PHOTOS +PHYSIO +PIAGET +PICS +PICTET +PICTURES +PID +PIN +PING +PINK +PIONEER +PIZZA +PK +PL +PLACE +PLAY +PLAYSTATION +PLUMBING +PLUS +PM +PN +PNC +POHL +POKER +POLITIE +PORN +POST +PR +PRAMERICA +PRAXI +PRESS +PRIME +PRO +PROD +PRODUCTIONS +PROF +PROGRESSIVE +PROMO +PROPERTIES +PROPERTY +PROTECTION +PRU +PRUDENTIAL +PS +PT +PUB +PW +PWC +PY +QA +QPON +QUEBEC +QUEST +QVC +RACING +RADIO +RAID +RE +READ +REALESTATE +REALTOR +REALTY +RECIPES +RED +REDSTONE +REDUMBRELLA +REHAB +REISE +REISEN +REIT +RELIANCE +REN +RENT +RENTALS +REPAIR +REPORT +REPUBLICAN +REST +RESTAURANT +REVIEW +REVIEWS +REXROTH +RICH +RICHARDLI +RICOH +RIGHTATHOME +RIL +RIO +RIP +RMIT +RO +ROCHER +ROCKS +RODEO +ROGERS +ROOM +RS +RSVP +RU +RUGBY +RUHR +RUN +RW +RWE +RYUKYU +SA +SAARLAND +SAFE +SAFETY +SAKURA +SALE +SALON +SAMSCLUB +SAMSUNG +SANDVIK +SANDVIKCOROMANT +SANOFI +SAP +SAPO +SARL +SAS +SAVE +SAXO +SB +SBI +SBS +SC +SCA +SCB +SCHAEFFLER +SCHMIDT +SCHOLARSHIPS +SCHOOL +SCHULE +SCHWARZ +SCIENCE +SCJOHNSON +SCOR +SCOT +SD +SE +SEARCH +SEAT +SECURE +SECURITY +SEEK +SELECT +SENER +SERVICES +SES +SEVEN +SEW +SEX +SEXY +SFR +SG +SH +SHANGRILA +SHARP +SHAW +SHELL +SHIA +SHIKSHA +SHOES +SHOP +SHOPPING +SHOUJI +SHOW +SHOWTIME +SHRIRAM +SI +SILK +SINA +SINGLES +SITE +SJ +SK +SKI +SKIN +SKY +SKYPE +SL +SLING +SM +SMART +SMILE +SN +SNCF +SO +SOCCER +SOCIAL +SOFTBANK +SOFTWARE +SOHU +SOLAR +SOLUTIONS +SONG +SONY +SOY +SPACE +SPIEGEL +SPOT +SPREADBETTING +SR +SRL +SRT +ST +STADA +STAPLES +STAR +STARHUB +STATEBANK +STATEFARM +STATOIL +STC +STCGROUP +STOCKHOLM +STORAGE +STORE +STREAM +STUDIO +STUDY +STYLE +SU +SUCKS +SUPPLIES +SUPPLY +SUPPORT +SURF +SURGERY +SUZUKI +SV +SWATCH +SWIFTCOVER +SWISS +SX +SY +SYDNEY +SYMANTEC +SYSTEMS +SZ +TAB +TAIPEI +TALK +TAOBAO +TARGET +TATAMOTORS +TATAR +TATTOO +TAX +TAXI +TC +TCI +TD +TDK +TEAM +TECH +TECHNOLOGY +TEL +TELECITY +TELEFONICA +TEMASEK +TENNIS +TEVA +TF +TG +TH +THD +THEATER +THEATRE +TIAA +TICKETS +TIENDA +TIFFANY +TIPS +TIRES +TIROL +TJ +TJMAXX +TJX +TK +TKMAXX +TL +TM +TMALL +TN +TO +TODAY +TOKYO +TOOLS +TOP +TORAY +TOSHIBA +TOTAL +TOURS +TOWN +TOYOTA +TOYS +TR +TRADE +TRADING +TRAINING +TRAVEL +TRAVELCHANNEL +TRAVELERS +TRAVELERSINSURANCE +TRUST +TRV +TT +TUBE +TUI +TUNES +TUSHU +TV +TVS +TW +TZ +UA +UBANK +UBS +UCONNECT +UG +UK +UNICOM +UNIVERSITY +UNO +UOL +UPS +US +UY +UZ +VA +VACATIONS +VANA +VANGUARD +VC +VE +VEGAS +VENTURES +VERISIGN +VERSICHERUNG +VET +VG +VI +VIAJES +VIDEO +VIG +VIKING +VILLAS +VIN +VIP +VIRGIN +VISA +VISION +VISTA +VISTAPRINT +VIVA +VIVO +VLAANDEREN +VN +VODKA +VOLKSWAGEN +VOLVO +VOTE +VOTING +VOTO +VOYAGE +VU +VUELOS +WALES +WALMART +WALTER +WANG +WANGGOU +WARMAN +WATCH +WATCHES +WEATHER +WEATHERCHANNEL +WEBCAM +WEBER +WEBSITE +WED +WEDDING +WEIBO +WEIR +WF +WHOSWHO +WIEN +WIKI +WILLIAMHILL +WIN +WINDOWS +WINE +WINNERS +WME +WOLTERSKLUWER +WOODSIDE +WORK +WORKS +WORLD +WOW +WS +WTC +WTF +XBOX +XEROX +XFINITY +XIHUAN +XIN +XN--11B4C3D +XN--1CK2E1B +XN--1QQW23A +XN--2SCRJ9C +XN--30RR7Y +XN--3BST00M +XN--3DS443G +XN--3E0B707E +XN--3HCRJ9C +XN--3OQ18VL8PN36A +XN--3PXU8K +XN--42C2D9A +XN--45BR5CYL +XN--45BRJ9C +XN--45Q11C +XN--4GBRIM +XN--54B7FTA0CC +XN--55QW42G +XN--55QX5D +XN--5SU34J936BGSG +XN--5TZM5G +XN--6FRZ82G +XN--6QQ986B3XL +XN--80ADXHKS +XN--80AO21A +XN--80AQECDR1A +XN--80ASEHDB +XN--80ASWG +XN--8Y0A063A +XN--90A3AC +XN--90AE +XN--90AIS +XN--9DBQ2A +XN--9ET52U +XN--9KRT00A +XN--B4W605FERD +XN--BCK1B9A5DRE4C +XN--C1AVG +XN--C2BR7G +XN--CCK2B3B +XN--CG4BKI +XN--CLCHC0EA0B2G2A9GCD +XN--CZR694B +XN--CZRS0T +XN--CZRU2D +XN--D1ACJ3B +XN--D1ALF +XN--E1A4C +XN--ECKVDTC9D +XN--EFVY88H +XN--ESTV75G +XN--FCT429K +XN--FHBEI +XN--FIQ228C5HS +XN--FIQ64B +XN--FIQS8S +XN--FIQZ9S +XN--FJQ720A +XN--FLW351E +XN--FPCRJ9C3D +XN--FZC2C9E2C +XN--FZYS8D69UVGM +XN--G2XX48C +XN--GCKR3F0F +XN--GECRJ9C +XN--GK3AT1E +XN--H2BREG3EVE +XN--H2BRJ9C +XN--H2BRJ9C8C +XN--HXT814E +XN--I1B6B1A6A2E +XN--IMR513N +XN--IO0A7I +XN--J1AEF +XN--J1AMH +XN--J6W193G +XN--JLQ61U9W7B +XN--JVR189M +XN--KCRX77D1X4A +XN--KPRW13D +XN--KPRY57D +XN--KPU716F +XN--KPUT3I +XN--L1ACC +XN--LGBBAT1AD8J +XN--MGB9AWBF +XN--MGBA3A3EJT +XN--MGBA3A4F16A +XN--MGBA7C0BBN0A +XN--MGBAAKC7DVF +XN--MGBAAM7A8H +XN--MGBAB2BD +XN--MGBAI9AZGQP6J +XN--MGBAYH7GPA +XN--MGBB9FBPOB +XN--MGBBH1A +XN--MGBBH1A71E +XN--MGBC0A9AZCG +XN--MGBCA7DZDO +XN--MGBERP4A5D4AR +XN--MGBGU82A +XN--MGBI4ECEXP +XN--MGBPL2FH +XN--MGBT3DHD +XN--MGBTX2B +XN--MGBX4CD0AB +XN--MIX891F +XN--MK1BU44C +XN--MXTQ1M +XN--NGBC5AZD +XN--NGBE9E0A +XN--NGBRX +XN--NODE +XN--NQV7F +XN--NQV7FS00EMA +XN--NYQY26A +XN--O3CW4H +XN--OGBPF8FL +XN--P1ACF +XN--P1AI +XN--PBT977C +XN--PGBS0DH +XN--PSSY2U +XN--Q9JYB4C +XN--QCKA1PMC +XN--QXAM +XN--RHQV96G +XN--ROVU88B +XN--RVC1E0AM3E +XN--S9BRJ9C +XN--SES554G +XN--T60B56A +XN--TCKWE +XN--TIQ49XQYJ +XN--UNUP4Y +XN--VERMGENSBERATER-CTB +XN--VERMGENSBERATUNG-PWB +XN--VHQUV +XN--VUQ861B +XN--W4R85EL8FHU5DNRA +XN--W4RS40L +XN--WGBH1C +XN--WGBL6A +XN--XHQ521B +XN--XKC2AL3HYE2A +XN--XKC2DL3A5EE0H +XN--Y9A3AQ +XN--YFRO4I67O +XN--YGBI2AMMX +XN--ZFR164B +XPERIA +XXX +XYZ +YACHTS +YAHOO +YAMAXUN +YANDEX +YE +YODOBASHI +YOGA +YOKOHAMA +YOU +YOUTUBE +YT +YUN +ZA +ZAPPOS +ZARA +ZERO +ZIP +ZIPPO +ZM +ZONE +ZUERICH +ZW diff --git a/build/fetchTLDS.js b/build/fetchTLDS.js new file mode 100644 index 0000000..bc796dc --- /dev/null +++ b/build/fetchTLDS.js @@ -0,0 +1,7 @@ +var https = require('https'); +var fs = require('fs-extra'); + +var file = fs.createWriteStream("./assets/tlds.txt"); +https.get("https://data.iana.org/TLD/tlds-alpha-by-domain.txt", function(response) { + response.pipe(file); +}); \ No newline at end of file diff --git a/index.js b/index.js index 1928e47..f34d099 100755 --- a/index.js +++ b/index.js @@ -3,21 +3,18 @@ // Requiring npm modules var program = require('commander'); var chalk = require('chalk'); -var fs = require('fs-extra'); -var prettyjson = require('prettyjson'); +//var fs = require('fs-extra'); // Requiring Actions var createProxyServer = require('./actions/createProxyServer'); var createStaticServer = require('./actions/createStaticServer'); var killServer = require('./actions/killServer'); +var listServers = require('./actions/listServers'); // Requiring utils var validate = require('./utils/validate'); var requirements = require('./utils/requirements'); -var appendToList = require('./utils/listFile').appendToList; -var readServers = require('./utils/listFile').readServers; -var EOL = require('os').EOL; // Check for requirements such as OS version and nginx install. Throw and exit if requirements not found. // #Roadmap: Add ability to satisfy any possible requirements. @@ -52,8 +49,7 @@ program .command('list') .description('List all available servers.') .action(function () { - var serversList = readServers(); - console.log(EOL + prettyjson.render(serversList) + EOL); + listServers(); }); program diff --git a/package-lock.json b/package-lock.json index 1e6be01..d926a88 100644 --- a/package-lock.json +++ b/package-lock.json @@ -682,11 +682,6 @@ "integrity": "sha512-xYuhvQ7I9PDJIGBWev9xm0+SMSed3ZDBAmvVjbFR1ZRLAF+vlXcQu6cRI9uAlj81rzikElRVteehwV7DuX2ZmQ==", "dev": true }, - "json-beautify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-beautify/-/json-beautify-1.0.1.tgz", - "integrity": "sha1-WYtQ1Mjqm4/KWru0C34svTrUwvw=" - }, "json-schema-traverse": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", @@ -1180,11 +1175,6 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, - "validator": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/validator/-/validator-9.1.1.tgz", - "integrity": "sha512-1TGGX1GKilfmcEa9rm+9nI9AqIUQK8oj4jZI0DmTGLTPM5jmowBBhyBIHCks73+P1QPZk2i6oOYUq583uOetHQ==" - }, "which": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", diff --git a/package.json b/package.json index 1e29975..1064781 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "A cli tool to quickly create and manage nginx server blocks.", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "build": "node ./build/fetchTLDS" }, "repository": { "type": "git", @@ -30,10 +31,8 @@ "chalk": "^2.3.0", "commander": "^2.11.0", "fs-extra": "^4.0.2", - "json-beautify": "^1.0.1", "prettyjson": "^1.2.1", - "shelljs": "^0.7.8", - "validator": "^9.1.1" + "shelljs": "^0.7.8" }, "devDependencies": { "eslint": "^4.10.0" diff --git a/servers.up b/servers.up new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/servers.up @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/utils/isFQDN.js b/utils/isFQDN.js new file mode 100644 index 0000000..5b9a6cd --- /dev/null +++ b/utils/isFQDN.js @@ -0,0 +1,61 @@ +// Module courtesy of TRGWII +// Original: https://github.com/trgwii/isFQDN + +'use strict'; + +var fs = require('fs-extra'); + +// Official list of TLDs should be fetched from: +// https://data.iana.org/TLD/tlds-alpha-by-domain.txt + +// You must have received a copy of the list along with `up` +// Run `npm run build` to update the cached list + +function isFQDN(domain) { + + // Importing and parsing `tlds.txt` file + var tlds = fs.readFileSync('./assets/tlds.txt', 'utf8') + .split(/[\r\n]+/) + .filter(x => !x.startsWith('#')); + + if (domain.length > 253) { + return false; + } + + var labels = domain.split('.').reverse(); + + if (labels.length < 2) { + return false; + } + + var tld = labels[0]; + + if (!tlds.includes(tld.toUpperCase())) { + return false; + } + + for (var label of labels) { + + const len = label.length; + + if (len > 63 || len === 0) { + return false; + } + + for (let i = 0; i < len; i++) { + + const char = label[i]; + + if ((i === 0 || i === len - 1) && char === '-') { + return false; + } + + if (!char.match(/^[a-zA-Z0-9-]$/)) { + return false; + } + } + } + return true; +}; + +module.exports = isFQDN; \ No newline at end of file diff --git a/utils/listFile.js b/utils/listFile.js index 66f19bf..d185eef 100644 --- a/utils/listFile.js +++ b/utils/listFile.js @@ -1,49 +1,48 @@ var fs = require('fs-extra'); var shell = require('shelljs'); -var beautifyJSON = require("json-beautify"); + +var removeFromArray = require('./removeFromArray'); var EOL = require('os').EOL; // \n if used on Linux, \r\n if used on Windows. -var listFilePath = "/etc/up-serve/servers.up"; +var listFilePath = "./servers.up"; function appendToList(domain, outPort, inPort) { inPort = inPort || undefined; - var jsonFile = {}; + var jsonFile = { "domains": [] }; var domBlock; if (!inPort) { domBlock = { - "type": "static", - "outPort": outPort, - "inPort": undefined - } + "domain": domain, + "type": "static", + "outPort": outPort + }; } else { domBlock = { - "type": "proxy", - "outPort": outPort, - "inPort": inPort - } + "domain": domain, + "type": "proxy", + "outPort": outPort, + "inPort": inPort + }; } if (fs.existsSync(listFilePath)) { jsonFile = fs.readFileSync(listFilePath); jsonFile = JSON.parse(jsonFile); - for (block in jsonFile) { - if (block[domain] == domain && block[domain].outPort == outPort) { - delete jsonFile.block; - return; + /*for (name in jsonFile) { + if (name == domain && jsonFile[name][outPort] == outPort) { + delete jsonFile[domain]; + console.log('\nDomain was deleted successfully.\n'); } - } - - jsonFile[domain] = domBlock; - jsonFile = beautifyJSON(jsonFile, null, 2, 30); - } - else { - jsonFile[domain] = domBlock; - jsonFile = beautifyJSON(jsonFile); + }*/ + jsonFile = removeFromArray(jsonFile.domains, domain, outPort); } + + jsonFile.domains.push(domBlock); + jsonFile = JSON.stringify(jsonFile, null, '\t'); fs.writeFileSync(listFilePath, jsonFile); } @@ -52,25 +51,25 @@ function removeFromList (domain, outPort) { if (fs.existsSync(listFilePath)) { jsonFile = fs.readFileSync(listFilePath); jsonFile = JSON.parse(jsonFile); + + // for (name in jsonFile) { + // if (name == domain && jsonFile[domain].outPort == outPort) { + // delete jsonFile[domain]; + // console.log('\nDomain was deleted successfully.\n'); + // } + // } + jsonFile = removeFromArray(jsonFile.domains, domain, outPort); - for (block in jsonFile) { - if (block[domain] == domain && block[domain].outPort == outPort) { - delete jsonFile.block; - console.log('\nDomain was deleted successfully.\n'); - return; - } - } - - jsonFile = beautifyJSON(jsonFile, null, 2, 30); + jsonFile = JSON.stringify(jsonFile, null, '\t'); + fs.writeFileSync(listFilePath, jsonFile); } - else { - console.log("\Domain was not in my list. Are you sure?\n") - } - fs.writeFileSync(listFilePath, jsonFile); + else console.log("\nNo servers were created using `up` yet.\n"); } function readServers () { - return JSON.parse(fs.readFileSync(listFilePath)); + var serversList = JSON.parse(fs.readFileSync(listFilePath)); + if(!serversList[0]) return undefined; + return serversList; } module.exports.appendToList = appendToList; diff --git a/utils/removeFromArray.js b/utils/removeFromArray.js new file mode 100644 index 0000000..38d2bba --- /dev/null +++ b/utils/removeFromArray.js @@ -0,0 +1,15 @@ +function removeFromArray (arr, dom, port) { + var shouldDelete = []; + + for(var i = 0; i < arr.length; i++) if((arr[i].domain == dom) && (arr[i].outPort == port)) shouldDelete = [true, i]; + + if (shouldDelete[0]) { + arr.splice(shouldDelete[1], 1); + console.log('\nItem was deleted!\n'); + } else { + console.log('\nItem was not found!\n'); + } + return arr; +} + +module.exports = removeFromArray; \ No newline at end of file diff --git a/utils/validate.js b/utils/validate.js index 29e3589..f8e38eb 100644 --- a/utils/validate.js +++ b/utils/validate.js @@ -1,9 +1,8 @@ -var validator = require('validator'); var parseToInt = require('./parseToInt'); var isIP = require('./isIP'); // Using Validator -var isDomain = validator.isFQDN; +var isDomain = require('./isFQDN'); function validate(domain, inPort, outPort) { // From 4565e447ac5d68af6fb907570bf71572964e330a Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Thu, 9 Nov 2017 02:08:33 +0530 Subject: [PATCH 24/37] Fixed `servers.up` parsing issues. Pending: Handle errors if `servers.up` was manually modified. --- servers.up | 1 - 1 file changed, 1 deletion(-) delete mode 100644 servers.up diff --git a/servers.up b/servers.up deleted file mode 100644 index 0637a08..0000000 --- a/servers.up +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file From 7d83c727d00e76c5f27fb45637633e2c695efd4e Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Thu, 9 Nov 2017 02:09:26 +0530 Subject: [PATCH 25/37] Fixed `servers.up` parsing issues. Pending: Handle errors if `servers.up` was manually modified. --- utils/listFile.js | 56 ++++++++++++++++-------------------------------- utils/removeFromArray.js | 3 --- 2 files changed, 19 insertions(+), 40 deletions(-) diff --git a/utils/listFile.js b/utils/listFile.js index d185eef..afd896d 100644 --- a/utils/listFile.js +++ b/utils/listFile.js @@ -1,63 +1,45 @@ var fs = require('fs-extra'); -var shell = require('shelljs'); var removeFromArray = require('./removeFromArray'); -var EOL = require('os').EOL; // \n if used on Linux, \r\n if used on Windows. - -var listFilePath = "./servers.up"; +var listFilePath = "/etc/up-serve/servers.up"; function appendToList(domain, outPort, inPort) { inPort = inPort || undefined; var jsonFile = { "domains": [] }; - var domBlock; + var domBlock = { + "domain": domain, + "outPort": outPort + }; if (!inPort) { - domBlock = { - "domain": domain, - "type": "static", - "outPort": outPort - }; + domBlock.type = "static"; } else { - domBlock = { - "domain": domain, - "type": "proxy", - "outPort": outPort, - "inPort": inPort - }; + domBlock.type = "proxy"; + domBlock.inPort = inPort; } - - if (fs.existsSync(listFilePath)) { - jsonFile = fs.readFileSync(listFilePath); - jsonFile = JSON.parse(jsonFile); - /*for (name in jsonFile) { - if (name == domain && jsonFile[name][outPort] == outPort) { - delete jsonFile[domain]; - console.log('\nDomain was deleted successfully.\n'); - } - }*/ - jsonFile = removeFromArray(jsonFile.domains, domain, outPort); + if (fs.existsSync(listFilePath)) { + var jsonBuffer = JSON.parse(fs.readFileSync(listFilePath)); + jsonFile.domains = removeFromArray(jsonBuffer.domains, domain, outPort); + console.log(jsonFile); } - + console.log(jsonFile); + console.log(jsonFile.domains); jsonFile.domains.push(domBlock); + console.log(jsonFile); jsonFile = JSON.stringify(jsonFile, null, '\t'); + console.log(jsonFile); fs.writeFileSync(listFilePath, jsonFile); } function removeFromList (domain, outPort) { - var jsonFile = {}; + var jsonFile = { "domains": [] }; if (fs.existsSync(listFilePath)) { jsonFile = fs.readFileSync(listFilePath); jsonFile = JSON.parse(jsonFile); - - // for (name in jsonFile) { - // if (name == domain && jsonFile[domain].outPort == outPort) { - // delete jsonFile[domain]; - // console.log('\nDomain was deleted successfully.\n'); - // } - // } + jsonFile = removeFromArray(jsonFile.domains, domain, outPort); jsonFile = JSON.stringify(jsonFile, null, '\t'); @@ -68,7 +50,7 @@ function removeFromList (domain, outPort) { function readServers () { var serversList = JSON.parse(fs.readFileSync(listFilePath)); - if(!serversList[0]) return undefined; + if(!serversList.domains[0]) return undefined; return serversList; } diff --git a/utils/removeFromArray.js b/utils/removeFromArray.js index 38d2bba..087d04b 100644 --- a/utils/removeFromArray.js +++ b/utils/removeFromArray.js @@ -5,9 +5,6 @@ function removeFromArray (arr, dom, port) { if (shouldDelete[0]) { arr.splice(shouldDelete[1], 1); - console.log('\nItem was deleted!\n'); - } else { - console.log('\nItem was not found!\n'); } return arr; } From 9dbf0f03c24ffeb89fe65fafb80111ca0d503ee3 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Thu, 9 Nov 2017 02:09:56 +0530 Subject: [PATCH 26/37] Revert "Fixed `servers.up` parsing issues." This reverts commit 4565e447ac5d68af6fb907570bf71572964e330a. --- servers.up | 1 + 1 file changed, 1 insertion(+) create mode 100644 servers.up diff --git a/servers.up b/servers.up new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/servers.up @@ -0,0 +1 @@ +[] \ No newline at end of file From fbff9efc90a05774fbe4120877f2b7b288aba9f8 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Thu, 9 Nov 2017 02:12:01 +0530 Subject: [PATCH 27/37] Removed `servers.up` created during testing --- servers.up | 1 - 1 file changed, 1 deletion(-) delete mode 100644 servers.up diff --git a/servers.up b/servers.up deleted file mode 100644 index 0637a08..0000000 --- a/servers.up +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file From b8850b2a4c9b88a2415b1c2cb83796b1443b12af Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Thu, 9 Nov 2017 03:31:12 +0530 Subject: [PATCH 28/37] Create CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..973df66 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at contact@thefeathers.in. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ From 1af16daf09905adfe4f2755a5cf6eb10180b0523 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Thu, 9 Nov 2017 12:25:14 +0530 Subject: [PATCH 29/37] Added feature: All servers have been killed. A backup of your old servers.up is saved in /etc/up-serve/servers.bak.up. Check this if you need to. --- .eslintrc.json | 3 +- README.md | 10 ++-- actions/createProxyServer.js | 6 +- actions/createStaticServer.js | 8 ++- actions/killALL.js | 20 +++++++ build/defaultNginx.conf | 136 ++++++++++++++++++++++++++++++++++++++++++ index.js | 13 ++++ package.json | 2 +- utils/listFile.js | 31 ++++------ utils/nginxPath.js | 36 ++++++++--- 10 files changed, 228 insertions(+), 37 deletions(-) create mode 100644 actions/killALL.js create mode 100644 build/defaultNginx.conf diff --git a/.eslintrc.json b/.eslintrc.json index 1c0dbe6..b5c6517 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -17,6 +17,7 @@ "semi": [ "error", "always" - ] + ], + "prefer-const": "error" } } \ No newline at end of file diff --git a/README.md b/README.md index 960a593..2f24478 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@ # up -> Current version: `up v.0.1.8 (Pre-Alpha)` +> Current version: `up v.0.1.9 (Pre-Alpha)` -> Notes: `up` is coming soon to `Alpha`! 🎉 Changelog will be added from `up v.0.2.0` [(Alpha/MVP)](Roadmap.md)\ +> Notes: `up` has reached MVP! 🎉 Changelog will be added from alpha version: `up v.0.2.0` [(Roadmap)](Roadmap.md)\ > ⚠️ ❌ `up` is still not ready for use yet! Do not attempt to use this in development or production until alpha! **`up`** is a command line application that creates nginx server blocks quickly with a single command. @@ -18,7 +18,7 @@ ## Installation -As of now, `up` only supports Debian and Ubuntu based distros. Support for more distros will come soon. Add an issue to bump this process. +`up` currently supports nginx mainline and nginx stable on Linux based distros. Support for more distros will come soon. Add an issue to bump this process. You will need to have [_node JS_](https://nodejs.org) and [_nginx_](https://nginx.org) installed. @@ -28,13 +28,13 @@ Install `up` from npm: > `up` is now available as a command. -## Commands +## Basic Commands Format: `up command [optional]` - `up static [outbound port]` - Create new static server at current folder. - `up proxy [outbound port]` - Create new proxy server listening at said port. -- `up list` - List currently available servers. (Doesn't work yet) +- `up list` - List currently available servers. - `up kill ` - Kill the server for this domain. ## Examples diff --git a/actions/createProxyServer.js b/actions/createProxyServer.js index d38f984..6a3285a 100644 --- a/actions/createProxyServer.js +++ b/actions/createProxyServer.js @@ -9,6 +9,9 @@ var appendToList = require('../utils/listFile').appendToList; var EOL = require('os').EOL; // \n if used on Linux, \r\n if used on Windows. function createProxyServer(domain, inPort, outPort) { + outPort = outPort || 80; + shell.mkdir('-p', npath.confD()); + fs.outputFileSync((conf(npath.confD(), domain, outPort)), "server {" + EOL + " listen " + outPort + ";" + EOL + @@ -26,7 +29,8 @@ function createProxyServer(domain, inPort, outPort) { " }" + EOL + "}" ); - shell.mkdir('-p', npath.enabledSites()); // Creates directory if doesn't exist + shell.mkdir('-p', npath.confD()); + shell.mkdir('-p', npath.enabledSites()); // Creates directories if doesn't exist shell.ln('-sf', conf(npath.confD(), domain, outPort), conf(npath.enabledSites(), domain, outPort)); // Symlink the conf file from sites-available to sites-enabled appendToList(domain, outPort, inPort); diff --git a/actions/createStaticServer.js b/actions/createStaticServer.js index 65e33e4..45619e9 100644 --- a/actions/createStaticServer.js +++ b/actions/createStaticServer.js @@ -12,11 +12,13 @@ var EOL = require('os').EOL; // \n if used on Linux, \r\n if used on Windows. function createStaticServer(domain, outPort) { outPort = outPort || 80; + shell.mkdir('-p', npath.confD()); + fs.outputFileSync((conf(npath.confD(), domain, outPort)), // Gets nginx's paths from nginxPath.js "server {" + EOL + " listen " + outPort + ";" + EOL + " listen [::]:" + outPort + ";" + EOL + - " root " + npath.webRoot() + domain + ";" + EOL + + " root " + npath.webRoot() + domain + "." + outPort + ";" + EOL + " index index.html index.htm;" + EOL + "" + EOL + " server_name " + domain + ";" + EOL + @@ -25,9 +27,9 @@ function createStaticServer(domain, outPort) { " }" + EOL + "}" ); - shell.mkdir('-p', npath.enabledSites()); // Creates directory if doesn't exist + shell.mkdir('-p', npath.enabledSites()); // Creates directories if doesn't exist shell.rm('-rf', conf(npath.enabledSites(), domain, outPort)); // Removes domain from sites-enabled if exists - shell.ln('-sf', conf(npath.confD(), domain, outPort), conf(npath.enabledSites(), domain, outPort)); // Symlink the conf file from sites-available to sites-enabled + shell.ln('-sf', conf(npath.confD(), domain, outPort), conf(npath.enabledSites(), domain, outPort)); // Symlink the conf file from confD to sites-enabled shell.rm('-rf', npath.webRootDomain(domain, outPort)); // Removes domain from webroot if exists shell.mkdir('-p', npath.webRoot()); // Creating the nginx www path if it doesn't exist so symlink doesn't fail shell.ln('-sf', currentPath, npath.webRootDomain(domain, outPort)); // Symlink current directory to nginx's web root diff --git a/actions/killALL.js b/actions/killALL.js new file mode 100644 index 0000000..5726dc9 --- /dev/null +++ b/actions/killALL.js @@ -0,0 +1,20 @@ +var shell = require('shelljs'); + +var npath = require('../utils/nginxPath'); +var conf = require('../utils/nginxConf'); + +function killALL () { + shell.rm('-Rf', npath.serversBakUp); + shell.mv(npath.serversUp(), npath.serversBakUp()); + shell.rm('-Rf', npath() + "sites-available"); + shell.rm('-Rf', npath.confD()); + shell.rm('-Rf', npath.enabledSites()); + shell.rm('-Rf', npath.webRoot()); + shell.mkdir('-p', npath.confD()); + shell.mkdir('-p', npath.enabledSites()); + shell.mkdir('-p', npath.webRoot()); + shell.cp('./build/defaultNginx.conf', conf(npath.confD())); // Create the default.conf file + shell.ln('-sf', npath.confD() + "default.conf", npath.enabledSites() + "default.conf"); // Symlink the default.conf file from confD to sites-enabled +} + +module.exports = killALL; \ No newline at end of file diff --git a/build/defaultNginx.conf b/build/defaultNginx.conf new file mode 100644 index 0000000..1e6c68f --- /dev/null +++ b/build/defaultNginx.conf @@ -0,0 +1,136 @@ +#user nobody; +#Defines which Linux system user will own and run the Nginx server + +worker_processes 1; +#Referes to single threaded process. Generally set to be equal to the number of CPUs or cores. + +#error_log logs/error.log; #error_log logs/error.log notice; +#Specifies the file where server logs. + +#pid logs/nginx.pid; +#nginx will write its master process ID(PID). + +events { + worker_connections 1024; + # worker_processes and worker_connections allows you to calculate maxclients value: + # max_clients = worker_processes * worker_connections +} + + +http { + include mime.types; + # anything written in /opt/nginx/conf/mime.types is interpreted as if written inside the http { } block + + default_type application/octet-stream; + # + + #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + # '$status $body_bytes_sent "$http_referer" ' + # '"$http_user_agent" "$http_x_forwarded_for"'; + + #access_log logs/access.log main; + + sendfile on; + # If serving locally stored static files, sendfile is essential to speed up the server, + # But if using as reverse proxy one can deactivate it + + #tcp_nopush on; + # works opposite to tcp_nodelay. Instead of optimizing delays, it optimizes the amount of data sent at once. + + #keepalive_timeout 0; + keepalive_timeout 65; + # timeout during which a keep-alive client connection will stay open. + + #gzip on; + # tells the server to use on-the-fly gzip compression. + + server { + # You would want to make a separate file with its own server block for each virtual domain + # on your server and then include them. + listen 80; + #tells Nginx the hostname and the TCP port where it should listen for HTTP connections. + # listen 80; is equivalent to listen *:80; + + server_name localhost; + # lets you doname-based virtual hosting + + #charset koi8-r; + + #access_log logs/host.access.log main; + + location / { + #The location setting lets you configure how nginx responds to requests for resources within the server. + root html; + index index.html index.htm; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root html; + } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + #location ~ \.php$ { + # root html; + # fastcgi_pass 127.0.0.1:9000; + # fastcgi_index index.php; + # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; + # include fastcgi_params; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} + } + + + # another virtual host using mix of IP-, name-, and port-based configuration + # + #server { + # listen 8000; + # listen somename:8080; + # server_name somename alias another.alias; + + # location / { + # root html; + # index index.html index.htm; + # } + #} + + + # HTTPS server + # + #server { + # listen 443 ssl; + # server_name localhost; + + # ssl_certificate cert.pem; + # ssl_certificate_key cert.key; + + # ssl_session_cache shared:SSL:1m; + # ssl_session_timeout 5m; + + # ssl_ciphers HIGH:!aNULL:!MD5; + # ssl_prefer_server_ciphers on; + + # location / { + # root html; + # index index.html index.htm; + # } + #} + +} \ No newline at end of file diff --git a/index.js b/index.js index f34d099..7650e66 100755 --- a/index.js +++ b/index.js @@ -1,5 +1,7 @@ #!/usr/bin/env node +'use strict'; + // Requiring npm modules var program = require('commander'); var chalk = require('chalk'); @@ -10,6 +12,7 @@ var createProxyServer = require('./actions/createProxyServer'); var createStaticServer = require('./actions/createStaticServer'); var killServer = require('./actions/killServer'); var listServers = require('./actions/listServers'); +var killALL = require('./actions/killALL'); // Requiring utils var validate = require('./utils/validate'); @@ -62,6 +65,16 @@ program }); program + .command('kill-all') + .description('Warning! Will completely kill all servers and reset nginx') + .action(function() { + killALL(); + console.log("\nAll servers have been killed.\n" + + "A backup of your old servers.up is saved in /etc/up-serve/servers.bak.up.\n" + + "Check this if you need to.\n"); + }); + +program .command('*') // This should pick invalid commands, but it doesn't, yet. .action(function () { console.log("\nInvalid command. Type " + chalk.cyan('up --help') + " for help.\n"); diff --git a/package.json b/package.json index 1064781..3aee64a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "up-serve", - "version": "0.1.8", + "version": "0.1.9", "description": "A cli tool to quickly create and manage nginx server blocks.", "main": "index.js", "scripts": { diff --git a/utils/listFile.js b/utils/listFile.js index afd896d..7e5b688 100644 --- a/utils/listFile.js +++ b/utils/listFile.js @@ -1,8 +1,7 @@ var fs = require('fs-extra'); var removeFromArray = require('./removeFromArray'); - -var listFilePath = "/etc/up-serve/servers.up"; +var listFilePath = require('./nginxPath').serversUp; function appendToList(domain, outPort, inPort) { @@ -20,36 +19,30 @@ function appendToList(domain, outPort, inPort) { domBlock.inPort = inPort; } - if (fs.existsSync(listFilePath)) { - var jsonBuffer = JSON.parse(fs.readFileSync(listFilePath)); + if (fs.existsSync(listFilePath())) { + var jsonBuffer = JSON.parse(fs.readFileSync(listFilePath())); jsonFile.domains = removeFromArray(jsonBuffer.domains, domain, outPort); - console.log(jsonFile); } - console.log(jsonFile); - console.log(jsonFile.domains); jsonFile.domains.push(domBlock); - console.log(jsonFile); jsonFile = JSON.stringify(jsonFile, null, '\t'); - console.log(jsonFile); - fs.writeFileSync(listFilePath, jsonFile); + fs.writeFileSync(listFilePath(), jsonFile); } function removeFromList (domain, outPort) { - var jsonFile = { "domains": [] }; - if (fs.existsSync(listFilePath)) { - jsonFile = fs.readFileSync(listFilePath); - jsonFile = JSON.parse(jsonFile); - - jsonFile = removeFromArray(jsonFile.domains, domain, outPort); + if (fs.existsSync(listFilePath())) { + var jsonFile = { "domains": [] }; + var jsonBuffer = JSON.parse(fs.readFileSync(listFilePath())); + jsonFile.domains = removeFromArray(jsonBuffer.domains, domain, outPort); - jsonFile = JSON.stringify(jsonFile, null, '\t'); - fs.writeFileSync(listFilePath, jsonFile); + jsonFile = JSON.stringify(jsonBuffer, null, '\t'); + fs.writeFileSync(listFilePath(), jsonFile); } else console.log("\nNo servers were created using `up` yet.\n"); } function readServers () { - var serversList = JSON.parse(fs.readFileSync(listFilePath)); + var serversList = JSON.parse(fs.readFileSync(listFilePath())); + if(!serversList.domains[0]) return undefined; return serversList; } diff --git a/utils/nginxPath.js b/utils/nginxPath.js index 73666c0..7d1b698 100644 --- a/utils/nginxPath.js +++ b/utils/nginxPath.js @@ -1,15 +1,24 @@ +'use strict'; + // These functions just return paths. Later, these should be modified to poll from nginx's config. -var enabled = "/etc/nginx/sites-enabled/"; -var conf = "/etc/nginx/conf.d/"; -var wwwRoot = "/etc/up-serve/static/"; +var npath = "/etc/nginx/"; +var enabled = npath + "sites-enabled/"; +var confDpath = npath + "conf.d/"; +var upPath = "/etc/up-serve/"; +var wwwRoot = upPath + "static/"; +var serverListPath = upPath + "servers"; + +function nginxPath() { + return npath; +} function enabledSites() { return enabled; } function confD() { - return conf; + return confDpath; } function webRoot() { @@ -17,11 +26,24 @@ function webRoot() { } function webRootDomain(domain, outPort) { - var rootWithDomain = wwwRoot + domain + "." + outPort; - return rootWithDomain; + const path = wwwRoot + domain + "." + outPort; + return path; +} + +function serversUp() { + const path = serverListPath + ".up"; + return path; +} + +function serversBakUp() { + const path = serverListPath + ".bak.up"; + return path; } +module.exports = nginxPath; module.exports.confD = confD; module.exports.enabledSites = enabledSites; module.exports.webRoot = webRoot; -module.exports.webRootDomain = webRootDomain; \ No newline at end of file +module.exports.webRootDomain = webRootDomain; +module.exports.serversUp = serversUp; +module.exports.serversBakUp = serversBakUp; \ No newline at end of file From a049e2fee9557045870a47cbb126e69c9401b200 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Thu, 9 Nov 2017 15:38:34 +0530 Subject: [PATCH 30/37] Almost at 0.2.0, killAllConfirm.js needs to work (async) --- actions/killAllConfirm.js | 32 ++++++++++++ index.js | 7 ++- package-lock.json | 125 +++++++++++++++++++++++++++++++++++++++++++--- package.json | 1 + 4 files changed, 154 insertions(+), 11 deletions(-) create mode 100644 actions/killAllConfirm.js diff --git a/actions/killAllConfirm.js b/actions/killAllConfirm.js new file mode 100644 index 0000000..901a017 --- /dev/null +++ b/actions/killAllConfirm.js @@ -0,0 +1,32 @@ +const prompt = require('prompt'); +const shell = require('shelljs'); + +const killAll = require('./killALL'); + +function killAllConfirm () { + // Start the prompt + + prompt.start(); + + var property = { + name: 'yesno', + message: 'This will completely destroy all configs and reset nginx. Are you sure?', + validator: /y[es]*|n[o]?/, + warning: 'Must respond yes or no', + default: 'no' + }; + + prompt.get(property, function (err, res) { + if(res.yesno == "no") { + console.log("Aborted!"); + shell.exit(0); + } + else { + console.log("Deleting all servers..."); + killAll(); + console.log("\nDone. All configs have been destroyed. Hope you're happy."); + } + }); +} + +module.exports = killAllConfirm; \ No newline at end of file diff --git a/index.js b/index.js index 7650e66..2bdbf03 100755 --- a/index.js +++ b/index.js @@ -12,7 +12,7 @@ var createProxyServer = require('./actions/createProxyServer'); var createStaticServer = require('./actions/createStaticServer'); var killServer = require('./actions/killServer'); var listServers = require('./actions/listServers'); -var killALL = require('./actions/killALL'); +var killAllConfirm = require('./actions/killAllConfirm'); // Requiring utils var validate = require('./utils/validate'); @@ -68,9 +68,8 @@ program .command('kill-all') .description('Warning! Will completely kill all servers and reset nginx') .action(function() { - killALL(); - console.log("\nAll servers have been killed.\n" + - "A backup of your old servers.up is saved in /etc/up-serve/servers.bak.up.\n" + + killAllConfirm(); + console.log("\nA backup of your old servers.up is saved in /etc/up-serve/servers.bak.up.\n" + "Check this if you need to.\n"); }); diff --git a/package-lock.json b/package-lock.json index d926a88..3029a64 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "up-serve", - "version": "0.1.8", + "version": "0.1.9", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -95,6 +95,11 @@ "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", "dev": true }, + "async": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", + "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=" + }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -264,6 +269,11 @@ "which": "1.3.0" } }, + "cycle": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", + "integrity": "sha1-IegLK+hYD5i0aPN5QwZisEbDStI=" + }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", @@ -273,6 +283,11 @@ "ms": "2.0.0" } }, + "deep-equal": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-0.2.2.tgz", + "integrity": "sha1-hLdFiW80xoTpjyzg5Cq69Du6AX0=" + }, "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", @@ -422,6 +437,11 @@ "tmp": "0.0.33" } }, + "eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A=" + }, "fast-deep-equal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", @@ -544,6 +564,11 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" }, + "i": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/i/-/i-0.3.6.tgz", + "integrity": "sha1-2WyScyB28HJxG2sQ/X1PZa2O4j0=" + }, "iconv-lite": { "version": "0.4.19", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", @@ -660,6 +685,11 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", @@ -754,14 +784,12 @@ "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, "requires": { "minimist": "0.0.8" } @@ -775,8 +803,7 @@ "mute-stream": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", - "dev": true + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=" }, "natural-compare": { "version": "1.4.0", @@ -784,6 +811,11 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, + "ncp": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ncp/-/ncp-1.0.1.tgz", + "integrity": "sha1-0VNn5cuHQyuhF9K/gP30Wuz7QkY=" + }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -864,6 +896,11 @@ "pinkie": "2.0.4" } }, + "pkginfo": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.4.1.tgz", + "integrity": "sha1-tUGO8EOd5UJfxJlQQtztFPsqhP8=" + }, "pluralize": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", @@ -904,12 +941,33 @@ "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", "dev": true }, + "prompt": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prompt/-/prompt-1.0.0.tgz", + "integrity": "sha1-jlcSPDlquYiJf7Mn/Trtw+c15P4=", + "requires": { + "colors": "1.1.2", + "pkginfo": "0.4.1", + "read": "1.0.7", + "revalidator": "0.1.8", + "utile": "0.3.0", + "winston": "2.1.1" + } + }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, + "read": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", + "integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=", + "requires": { + "mute-stream": "0.0.7" + } + }, "readable-stream": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", @@ -967,11 +1025,15 @@ "signal-exit": "3.0.2" } }, + "revalidator": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/revalidator/-/revalidator-0.1.8.tgz", + "integrity": "sha1-/s5hv6DBtSoga9axgZgYS91SOjs=" + }, "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, "requires": { "glob": "7.1.2" } @@ -1058,6 +1120,11 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=" + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -1175,6 +1242,19 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "utile": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/utile/-/utile-0.3.0.tgz", + "integrity": "sha1-E1LDQOuCDk2N26A5pPv6oy7U7zo=", + "requires": { + "async": "0.9.2", + "deep-equal": "0.2.2", + "i": "0.3.6", + "mkdirp": "0.5.1", + "ncp": "1.0.1", + "rimraf": "2.6.2" + } + }, "which": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", @@ -1184,6 +1264,37 @@ "isexe": "2.0.0" } }, + "winston": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/winston/-/winston-2.1.1.tgz", + "integrity": "sha1-PJNJ0ZYgf9G9/51LxD73JRDjoS4=", + "requires": { + "async": "1.0.0", + "colors": "1.0.3", + "cycle": "1.0.3", + "eyes": "0.1.8", + "isstream": "0.1.2", + "pkginfo": "0.3.1", + "stack-trace": "0.0.10" + }, + "dependencies": { + "async": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", + "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=" + }, + "colors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=" + }, + "pkginfo": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz", + "integrity": "sha1-Wyn2qB9wcXFC4J52W76rl7T4HiE=" + } + } + }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", diff --git a/package.json b/package.json index 3aee64a..d4e7407 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "commander": "^2.11.0", "fs-extra": "^4.0.2", "prettyjson": "^1.2.1", + "prompt": "^1.0.0", "shelljs": "^0.7.8" }, "devDependencies": { From af4ed5d211e60134e8e62acc04e87d860cdf3757 Mon Sep 17 00:00:00 2001 From: Thomas Rory Gummerson Date: Thu, 9 Nov 2017 14:33:24 +0100 Subject: [PATCH 31/37] ESLint fixes: const, newlines, destructuring --- .eslintrc.json | 6 +++++- actions/createProxyServer.js | 18 ++++++++++-------- actions/createStaticServer.js | 22 ++++++++++++---------- actions/killALL.js | 10 ++++++---- actions/killAllConfirm.js | 6 ++++-- actions/killServer.js | 14 ++++++++------ actions/listServers.js | 12 +++++++----- build/fetchTLDS.js | 10 ++++++---- index.js | 20 ++++++++++---------- utils/isFQDN.js | 14 +++++++------- utils/isIP.js | 10 ++++++---- utils/listFile.js | 22 ++++++++++++---------- utils/nginxConf.js | 4 +++- utils/nginxPath.js | 14 +++++++------- utils/nginxReload.js | 6 ++++-- utils/parseToInt.js | 6 ++++-- utils/removeFromArray.js | 10 +++++++--- utils/requirements.js | 10 ++++++---- utils/validate.js | 20 +++++++++++--------- 19 files changed, 135 insertions(+), 99 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index b5c6517..c065b39 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -18,6 +18,10 @@ "error", "always" ], - "prefer-const": "error" + "prefer-const": "error", + "prefer-destructuring": "error", + "no-var": "error", + "strict": "error", + "eol-last": "error" } } \ No newline at end of file diff --git a/actions/createProxyServer.js b/actions/createProxyServer.js index 6a3285a..7a75fd4 100644 --- a/actions/createProxyServer.js +++ b/actions/createProxyServer.js @@ -1,12 +1,14 @@ -var fs = require('fs-extra'); -var shell = require('shelljs'); +'use strict'; -var npath = require('../utils/nginxPath'); -var conf = require('../utils/nginxConf'); -var nginxReload = require('../utils/nginxReload'); -var appendToList = require('../utils/listFile').appendToList; +const fs = require('fs-extra'); +const shell = require('shelljs'); -var EOL = require('os').EOL; // \n if used on Linux, \r\n if used on Windows. +const npath = require('../utils/nginxPath'); +const conf = require('../utils/nginxConf'); +const nginxReload = require('../utils/nginxReload'); +const { appendToList } = require('../utils/listFile'); + +const { EOL } = require('os'); // \n if used on Linux, \r\n if used on Windows. function createProxyServer(domain, inPort, outPort) { outPort = outPort || 80; @@ -37,4 +39,4 @@ function createProxyServer(domain, inPort, outPort) { nginxReload(); } -module.exports = createProxyServer; \ No newline at end of file +module.exports = createProxyServer; diff --git a/actions/createStaticServer.js b/actions/createStaticServer.js index 45619e9..e3e124d 100644 --- a/actions/createStaticServer.js +++ b/actions/createStaticServer.js @@ -1,14 +1,16 @@ -var fs = require('fs-extra'); -var shell = require('shelljs'); -var path = require('path'); +'use strict'; -var npath = require('../utils/nginxPath'); -var conf = require('../utils/nginxConf'); -var nginxReload = require('../utils/nginxReload'); -var appendToList = require('../utils/listFile').appendToList; +const fs = require('fs-extra'); +const shell = require('shelljs'); +const path = require('path'); -var currentPath = path.normalize(process.cwd()); -var EOL = require('os').EOL; // \n if used on Linux, \r\n if used on Windows. +const npath = require('../utils/nginxPath'); +const conf = require('../utils/nginxConf'); +const nginxReload = require('../utils/nginxReload'); +const { appendToList } = require('../utils/listFile'); + +const currentPath = path.normalize(process.cwd()); +const { EOL } = require('os'); // \n if used on Linux, \r\n if used on Windows. function createStaticServer(domain, outPort) { outPort = outPort || 80; @@ -38,4 +40,4 @@ function createStaticServer(domain, outPort) { nginxReload(); } -module.exports = createStaticServer; \ No newline at end of file +module.exports = createStaticServer; diff --git a/actions/killALL.js b/actions/killALL.js index 5726dc9..ae937d7 100644 --- a/actions/killALL.js +++ b/actions/killALL.js @@ -1,7 +1,9 @@ -var shell = require('shelljs'); +'use strict'; -var npath = require('../utils/nginxPath'); -var conf = require('../utils/nginxConf'); +const shell = require('shelljs'); + +const npath = require('../utils/nginxPath'); +const conf = require('../utils/nginxConf'); function killALL () { shell.rm('-Rf', npath.serversBakUp); @@ -17,4 +19,4 @@ function killALL () { shell.ln('-sf', npath.confD() + "default.conf", npath.enabledSites() + "default.conf"); // Symlink the default.conf file from confD to sites-enabled } -module.exports = killALL; \ No newline at end of file +module.exports = killALL; diff --git a/actions/killAllConfirm.js b/actions/killAllConfirm.js index 901a017..21af771 100644 --- a/actions/killAllConfirm.js +++ b/actions/killAllConfirm.js @@ -1,3 +1,5 @@ +'use strict'; + const prompt = require('prompt'); const shell = require('shelljs'); @@ -8,7 +10,7 @@ function killAllConfirm () { prompt.start(); - var property = { + const property = { name: 'yesno', message: 'This will completely destroy all configs and reset nginx. Are you sure?', validator: /y[es]*|n[o]?/, @@ -29,4 +31,4 @@ function killAllConfirm () { }); } -module.exports = killAllConfirm; \ No newline at end of file +module.exports = killAllConfirm; diff --git a/actions/killServer.js b/actions/killServer.js index 333bcda..665fa42 100644 --- a/actions/killServer.js +++ b/actions/killServer.js @@ -1,9 +1,11 @@ -var shell = require('shelljs'); +'use strict'; -var npath = require('../utils/nginxPath'); -var conf = require('../utils/nginxConf'); -var nginxReload = require('../utils/nginxReload'); -var removeFromList = require('../utils/listFile').removeFromList; +const shell = require('shelljs'); + +const npath = require('../utils/nginxPath'); +const conf = require('../utils/nginxConf'); +const nginxReload = require('../utils/nginxReload'); +const { removeFromList } = require('../utils/listFile'); function killServer(domain, outPort) { shell.rm('-rf', conf(npath.enabledSites(), domain, outPort)); @@ -14,4 +16,4 @@ function killServer(domain, outPort) { nginxReload(); } -module.exports = killServer; \ No newline at end of file +module.exports = killServer; diff --git a/actions/listServers.js b/actions/listServers.js index 349154c..222643b 100644 --- a/actions/listServers.js +++ b/actions/listServers.js @@ -1,12 +1,14 @@ -var readServers = require('../utils/listFile').readServers; -var prettyjson = require('prettyjson'); +'use strict'; -var EOL = require('os').EOL; +const { readServers } = require('../utils/listFile'); +const prettyjson = require('prettyjson'); + +const { EOL } = require('os'); function listServers() { - var serversList = readServers(); + const serversList = readServers(); if(serversList) console.log(EOL + prettyjson.render(serversList) + EOL); else console.log("\nNo servers were found! Create some using `up`!\n"); } -module.exports = listServers; \ No newline at end of file +module.exports = listServers; diff --git a/build/fetchTLDS.js b/build/fetchTLDS.js index bc796dc..c9edc79 100644 --- a/build/fetchTLDS.js +++ b/build/fetchTLDS.js @@ -1,7 +1,9 @@ -var https = require('https'); -var fs = require('fs-extra'); +'use strict'; -var file = fs.createWriteStream("./assets/tlds.txt"); +const https = require('https'); +const fs = require('fs-extra'); + +const file = fs.createWriteStream("./assets/tlds.txt"); https.get("https://data.iana.org/TLD/tlds-alpha-by-domain.txt", function(response) { response.pipe(file); -}); \ No newline at end of file +}); diff --git a/index.js b/index.js index 2bdbf03..d7ed91d 100755 --- a/index.js +++ b/index.js @@ -3,20 +3,20 @@ 'use strict'; // Requiring npm modules -var program = require('commander'); -var chalk = require('chalk'); +const program = require('commander'); +const chalk = require('chalk'); //var fs = require('fs-extra'); // Requiring Actions -var createProxyServer = require('./actions/createProxyServer'); -var createStaticServer = require('./actions/createStaticServer'); -var killServer = require('./actions/killServer'); -var listServers = require('./actions/listServers'); -var killAllConfirm = require('./actions/killAllConfirm'); +const createProxyServer = require('./actions/createProxyServer'); +const createStaticServer = require('./actions/createStaticServer'); +const killServer = require('./actions/killServer'); +const listServers = require('./actions/listServers'); +const killAllConfirm = require('./actions/killAllConfirm'); // Requiring utils -var validate = require('./utils/validate'); -var requirements = require('./utils/requirements'); +const validate = require('./utils/validate'); +const requirements = require('./utils/requirements'); // Check for requirements such as OS version and nginx install. Throw and exit if requirements not found. // #Roadmap: Add ability to satisfy any possible requirements. @@ -93,4 +93,4 @@ program.on('--help', function () { }); // Parses commands passed to `up` and chooses one of the above commands. -program.parse(process.argv); \ No newline at end of file +program.parse(process.argv); diff --git a/utils/isFQDN.js b/utils/isFQDN.js index 5b9a6cd..fd0de97 100644 --- a/utils/isFQDN.js +++ b/utils/isFQDN.js @@ -3,7 +3,7 @@ 'use strict'; -var fs = require('fs-extra'); +const fs = require('fs-extra'); // Official list of TLDs should be fetched from: // https://data.iana.org/TLD/tlds-alpha-by-domain.txt @@ -14,7 +14,7 @@ var fs = require('fs-extra'); function isFQDN(domain) { // Importing and parsing `tlds.txt` file - var tlds = fs.readFileSync('./assets/tlds.txt', 'utf8') + const tlds = fs.readFileSync('./assets/tlds.txt', 'utf8') .split(/[\r\n]+/) .filter(x => !x.startsWith('#')); @@ -22,19 +22,19 @@ function isFQDN(domain) { return false; } - var labels = domain.split('.').reverse(); + const labels = domain.split('.').reverse(); if (labels.length < 2) { return false; } - var tld = labels[0]; + const [ tld ] = labels; if (!tlds.includes(tld.toUpperCase())) { return false; } - for (var label of labels) { + for (const label of labels) { const len = label.length; @@ -56,6 +56,6 @@ function isFQDN(domain) { } } return true; -}; +} -module.exports = isFQDN; \ No newline at end of file +module.exports = isFQDN; diff --git a/utils/isIP.js b/utils/isIP.js index 0a25224..864d647 100644 --- a/utils/isIP.js +++ b/utils/isIP.js @@ -1,14 +1,16 @@ +'use strict'; + // Parses a string, and returns true if it is an IP Address. function isIP(str) { - var segments = str + const segments = str .split(".") .map(Number); if (!segments.length === 4) { return false; } - for(var i = 0; i < segments.length; i++) { - var segment = segments[i]; + for(let i = 0; i < segments.length; i++) { + const segment = segments[i]; if (Number.isNaN(segment)) { return false; } @@ -22,4 +24,4 @@ function isIP(str) { return true; } -module.exports = isIP; \ No newline at end of file +module.exports = isIP; diff --git a/utils/listFile.js b/utils/listFile.js index 7e5b688..2e175f4 100644 --- a/utils/listFile.js +++ b/utils/listFile.js @@ -1,13 +1,15 @@ -var fs = require('fs-extra'); +'use strict'; -var removeFromArray = require('./removeFromArray'); -var listFilePath = require('./nginxPath').serversUp; +const fs = require('fs-extra'); + +const removeFromArray = require('./removeFromArray'); +const listFilePath = require('./nginxPath').serversUp; function appendToList(domain, outPort, inPort) { inPort = inPort || undefined; - var jsonFile = { "domains": [] }; - var domBlock = { + let jsonFile = { "domains": [] }; + const domBlock = { "domain": domain, "outPort": outPort }; @@ -20,7 +22,7 @@ function appendToList(domain, outPort, inPort) { } if (fs.existsSync(listFilePath())) { - var jsonBuffer = JSON.parse(fs.readFileSync(listFilePath())); + const jsonBuffer = JSON.parse(fs.readFileSync(listFilePath())); jsonFile.domains = removeFromArray(jsonBuffer.domains, domain, outPort); } jsonFile.domains.push(domBlock); @@ -30,8 +32,8 @@ function appendToList(domain, outPort, inPort) { function removeFromList (domain, outPort) { if (fs.existsSync(listFilePath())) { - var jsonFile = { "domains": [] }; - var jsonBuffer = JSON.parse(fs.readFileSync(listFilePath())); + let jsonFile = { "domains": [] }; + const jsonBuffer = JSON.parse(fs.readFileSync(listFilePath())); jsonFile.domains = removeFromArray(jsonBuffer.domains, domain, outPort); jsonFile = JSON.stringify(jsonBuffer, null, '\t'); @@ -41,7 +43,7 @@ function removeFromList (domain, outPort) { } function readServers () { - var serversList = JSON.parse(fs.readFileSync(listFilePath())); + const serversList = JSON.parse(fs.readFileSync(listFilePath())); if(!serversList.domains[0]) return undefined; return serversList; @@ -49,4 +51,4 @@ function readServers () { module.exports.appendToList = appendToList; module.exports.readServers = readServers; -module.exports.removeFromList = removeFromList; \ No newline at end of file +module.exports.removeFromList = removeFromList; diff --git a/utils/nginxConf.js b/utils/nginxConf.js index 5599e60..2037feb 100644 --- a/utils/nginxConf.js +++ b/utils/nginxConf.js @@ -1,7 +1,9 @@ +'use strict'; + // Simple function that takes a path and domain name, concatenates them with ".conf" and returns it. function conf(path, domain, outPort) { return (path + domain + "." + outPort + ".conf"); } -module.exports = conf; \ No newline at end of file +module.exports = conf; diff --git a/utils/nginxPath.js b/utils/nginxPath.js index 7d1b698..96feaac 100644 --- a/utils/nginxPath.js +++ b/utils/nginxPath.js @@ -2,12 +2,12 @@ // These functions just return paths. Later, these should be modified to poll from nginx's config. -var npath = "/etc/nginx/"; -var enabled = npath + "sites-enabled/"; -var confDpath = npath + "conf.d/"; -var upPath = "/etc/up-serve/"; -var wwwRoot = upPath + "static/"; -var serverListPath = upPath + "servers"; +const npath = "/etc/nginx/"; +const enabled = npath + "sites-enabled/"; +const confDpath = npath + "conf.d/"; +const upPath = "/etc/up-serve/"; +const wwwRoot = upPath + "static/"; +const serverListPath = upPath + "servers"; function nginxPath() { return npath; @@ -46,4 +46,4 @@ module.exports.enabledSites = enabledSites; module.exports.webRoot = webRoot; module.exports.webRootDomain = webRootDomain; module.exports.serversUp = serversUp; -module.exports.serversBakUp = serversBakUp; \ No newline at end of file +module.exports.serversBakUp = serversBakUp; diff --git a/utils/nginxReload.js b/utils/nginxReload.js index 8661220..ff94eff 100644 --- a/utils/nginxReload.js +++ b/utils/nginxReload.js @@ -1,4 +1,6 @@ -var execSync = require('child_process').execSync; +'use strict'; + +const { execSync } = require('child_process'); function nginxReload() { execSync('service nginx reload', function (error, stdout, stderr) { @@ -11,4 +13,4 @@ function nginxReload() { }); } -module.exports = nginxReload; \ No newline at end of file +module.exports = nginxReload; diff --git a/utils/parseToInt.js b/utils/parseToInt.js index 891d3f6..522aa75 100644 --- a/utils/parseToInt.js +++ b/utils/parseToInt.js @@ -1,8 +1,10 @@ +'use strict'; + // Parse an input string and return a number if it is an integer. If it's a float, string, or array, return undefined. function parseToInt(inputString) { - var parsing = /^\d+$/.exec(inputString); + const parsing = /^\d+$/.exec(inputString); return (parsing || [])[0]; } -module.exports = parseToInt; \ No newline at end of file +module.exports = parseToInt; diff --git a/utils/removeFromArray.js b/utils/removeFromArray.js index 087d04b..bdd0e90 100644 --- a/utils/removeFromArray.js +++ b/utils/removeFromArray.js @@ -1,7 +1,11 @@ +'use strict'; + function removeFromArray (arr, dom, port) { - var shouldDelete = []; + let shouldDelete = []; - for(var i = 0; i < arr.length; i++) if((arr[i].domain == dom) && (arr[i].outPort == port)) shouldDelete = [true, i]; + for(let i = 0; i < arr.length; i++) + if((arr[i].domain == dom) && (arr[i].outPort == port)) + shouldDelete = [true, i]; if (shouldDelete[0]) { arr.splice(shouldDelete[1], 1); @@ -9,4 +13,4 @@ function removeFromArray (arr, dom, port) { return arr; } -module.exports = removeFromArray; \ No newline at end of file +module.exports = removeFromArray; diff --git a/utils/requirements.js b/utils/requirements.js index 90727e4..159a53c 100644 --- a/utils/requirements.js +++ b/utils/requirements.js @@ -1,10 +1,12 @@ -var shell = require('shelljs'); -var chalk = require('chalk'); +'use strict'; + +const shell = require('shelljs'); +const chalk = require('chalk'); function requirements() { // Detect Linux or BSD - var isLin = /^linux|^bsd/.test(process.platform); + const isLin = /^linux|^bsd/.test(process.platform); // Throw if OS is not Linux or BSD. This should be changed to throw if not Debian based distro. Eventually, we can add more exceptions as `up` handles more cases. if(!isLin) { @@ -20,4 +22,4 @@ function requirements() { } -module.exports = requirements; \ No newline at end of file +module.exports = requirements; diff --git a/utils/validate.js b/utils/validate.js index f8e38eb..a8afa5e 100644 --- a/utils/validate.js +++ b/utils/validate.js @@ -1,8 +1,10 @@ -var parseToInt = require('./parseToInt'); -var isIP = require('./isIP'); +'use strict'; + +const parseToInt = require('./parseToInt'); +const isIP = require('./isIP'); // Using Validator -var isDomain = require('./isFQDN'); +const isDomain = require('./isFQDN'); function validate(domain, inPort, outPort) { // @@ -10,15 +12,15 @@ function validate(domain, inPort, outPort) { outPort = outPort || 80; // Error messages - var domainInvalidMsg = ["\nPlease use a domain name instead of an IP address.", "\nDomain is not valid. Please use a valid domain name."]; - var portInvalidMsg = ["\nPort should be a number.", "\nPort should be a number from 1 and 65535."]; + const domainInvalidMsg = ["\nPlease use a domain name instead of an IP address.", "\nDomain is not valid. Please use a valid domain name."]; + const portInvalidMsg = ["\nPort should be a number.", "\nPort should be a number from 1 and 65535."]; // ARGV returns a string as input. Port numbers should be parsed to int to validate them. If validation fails, these will return undefined and will fail the subsequent test. - var validInPort = parseToInt(inPort); - var validOutPort = parseToInt(outPort); + const validInPort = parseToInt(inPort); + const validOutPort = parseToInt(outPort); // The value of isInvalid will be returned back. If none of the `if`s are true, the default value `true` is returned `domain`, `inPort` and `outPort` are considered validated. - var isValid = true; + let isValid = true; // Throw if IP is given instead of domain name. if (isIP(domain)) { @@ -60,4 +62,4 @@ function validate(domain, inPort, outPort) { } } -module.exports = validate; \ No newline at end of file +module.exports = validate; From ecf735430cce8a379ffccdd88ad86640c4aeb614 Mon Sep 17 00:00:00 2001 From: Thomas Rory Gummerson Date: Thu, 9 Nov 2017 14:52:04 +0100 Subject: [PATCH 32/37] Enforcing max width and some line ending fixes --- .eslintrc.json | 3 +- actions/createProxyServer.js | 7 +++-- actions/createStaticServer.js | 22 ++++++++++----- actions/killALL.js | 7 +++-- actions/killAllConfirm.js | 8 ++++-- actions/listServers.js | 4 ++- build/fetchTLDS.js | 5 ++-- index.js | 64 ++++++++++++++++++++++++++++++++----------- utils/nginxConf.js | 3 +- utils/nginxPath.js | 3 +- utils/parseToInt.js | 3 +- utils/requirements.js | 16 +++++++++-- utils/validate.js | 46 +++++++++++++++++++++++-------- 13 files changed, 140 insertions(+), 51 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index c065b39..d9aca22 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -22,6 +22,7 @@ "prefer-destructuring": "error", "no-var": "error", "strict": "error", - "eol-last": "error" + "eol-last": "error", + "max-len": "error" } } \ No newline at end of file diff --git a/actions/createProxyServer.js b/actions/createProxyServer.js index 7a75fd4..10e9b48 100644 --- a/actions/createProxyServer.js +++ b/actions/createProxyServer.js @@ -32,8 +32,11 @@ function createProxyServer(domain, inPort, outPort) { "}" ); shell.mkdir('-p', npath.confD()); - shell.mkdir('-p', npath.enabledSites()); // Creates directories if doesn't exist - shell.ln('-sf', conf(npath.confD(), domain, outPort), conf(npath.enabledSites(), domain, outPort)); // Symlink the conf file from sites-available to sites-enabled + shell.mkdir('-p', npath.enabledSites()); + // Creates directories if doesn't exist + shell.ln('-sf', conf(npath.confD(), domain, outPort), + conf(npath.enabledSites(), domain, outPort)); + // Symlink the conf file from sites-available to sites-enabled appendToList(domain, outPort, inPort); nginxReload(); diff --git a/actions/createStaticServer.js b/actions/createStaticServer.js index e3e124d..555cca6 100644 --- a/actions/createStaticServer.js +++ b/actions/createStaticServer.js @@ -16,7 +16,8 @@ function createStaticServer(domain, outPort) { outPort = outPort || 80; shell.mkdir('-p', npath.confD()); - fs.outputFileSync((conf(npath.confD(), domain, outPort)), // Gets nginx's paths from nginxPath.js + fs.outputFileSync((conf(npath.confD(), domain, outPort)), + // Gets nginx's paths from nginxPath.js "server {" + EOL + " listen " + outPort + ";" + EOL + " listen [::]:" + outPort + ";" + EOL + @@ -29,12 +30,19 @@ function createStaticServer(domain, outPort) { " }" + EOL + "}" ); - shell.mkdir('-p', npath.enabledSites()); // Creates directories if doesn't exist - shell.rm('-rf', conf(npath.enabledSites(), domain, outPort)); // Removes domain from sites-enabled if exists - shell.ln('-sf', conf(npath.confD(), domain, outPort), conf(npath.enabledSites(), domain, outPort)); // Symlink the conf file from confD to sites-enabled - shell.rm('-rf', npath.webRootDomain(domain, outPort)); // Removes domain from webroot if exists - shell.mkdir('-p', npath.webRoot()); // Creating the nginx www path if it doesn't exist so symlink doesn't fail - shell.ln('-sf', currentPath, npath.webRootDomain(domain, outPort)); // Symlink current directory to nginx's web root + shell.mkdir('-p', npath.enabledSites()); + // Creates directories if doesn't exist + shell.rm('-rf', conf(npath.enabledSites(), domain, outPort)); + // Removes domain from sites-enabled if exists + shell.ln('-sf', conf(npath.confD(), domain, outPort), + conf(npath.enabledSites(), domain, outPort)); + // Symlink the conf file from confD to sites-enabled + shell.rm('-rf', npath.webRootDomain(domain, outPort)); + // Removes domain from webroot if exists + shell.mkdir('-p', npath.webRoot()); + // Creating the nginx www path if it doesn't exist so symlink doesn't fail + shell.ln('-sf', currentPath, npath.webRootDomain(domain, outPort)); + // Symlink current directory to nginx's web root appendToList(domain, outPort); nginxReload(); diff --git a/actions/killALL.js b/actions/killALL.js index ae937d7..4b38147 100644 --- a/actions/killALL.js +++ b/actions/killALL.js @@ -15,8 +15,11 @@ function killALL () { shell.mkdir('-p', npath.confD()); shell.mkdir('-p', npath.enabledSites()); shell.mkdir('-p', npath.webRoot()); - shell.cp('./build/defaultNginx.conf', conf(npath.confD())); // Create the default.conf file - shell.ln('-sf', npath.confD() + "default.conf", npath.enabledSites() + "default.conf"); // Symlink the default.conf file from confD to sites-enabled + shell.cp('./build/defaultNginx.conf', conf(npath.confD())); + // Create the default.conf file + shell.ln('-sf', npath.confD() + "default.conf", + npath.enabledSites() + "default.conf"); + // Symlink the default.conf file from confD to sites-enabled } module.exports = killALL; diff --git a/actions/killAllConfirm.js b/actions/killAllConfirm.js index 21af771..59d8537 100644 --- a/actions/killAllConfirm.js +++ b/actions/killAllConfirm.js @@ -1,5 +1,7 @@ 'use strict'; +const { EOL } = require('os'); + const prompt = require('prompt'); const shell = require('shelljs'); @@ -12,7 +14,8 @@ function killAllConfirm () { const property = { name: 'yesno', - message: 'This will completely destroy all configs and reset nginx. Are you sure?', + message: 'This will completely destroy all configs and reset nginx. ' + + 'Are you sure?', validator: /y[es]*|n[o]?/, warning: 'Must respond yes or no', default: 'no' @@ -26,7 +29,8 @@ function killAllConfirm () { else { console.log("Deleting all servers..."); killAll(); - console.log("\nDone. All configs have been destroyed. Hope you're happy."); + console.log(EOL + + "Done. All configs have been destroyed. Hope you're happy."); } }); } diff --git a/actions/listServers.js b/actions/listServers.js index 222643b..b9fbc9d 100644 --- a/actions/listServers.js +++ b/actions/listServers.js @@ -8,7 +8,9 @@ const { EOL } = require('os'); function listServers() { const serversList = readServers(); if(serversList) console.log(EOL + prettyjson.render(serversList) + EOL); - else console.log("\nNo servers were found! Create some using `up`!\n"); + else console.log(EOL + + "No servers were found! Create some using `up`!" + + EOL); } module.exports = listServers; diff --git a/build/fetchTLDS.js b/build/fetchTLDS.js index c9edc79..30811ae 100644 --- a/build/fetchTLDS.js +++ b/build/fetchTLDS.js @@ -4,6 +4,5 @@ const https = require('https'); const fs = require('fs-extra'); const file = fs.createWriteStream("./assets/tlds.txt"); -https.get("https://data.iana.org/TLD/tlds-alpha-by-domain.txt", function(response) { - response.pipe(file); -}); +https.get("https://data.iana.org/TLD/tlds-alpha-by-domain.txt",response => + response.pipe(file)); diff --git a/index.js b/index.js index d7ed91d..a82bb4d 100755 --- a/index.js +++ b/index.js @@ -2,6 +2,8 @@ 'use strict'; +const { EOL } = require('os'); + // Requiring npm modules const program = require('commander'); const chalk = require('chalk'); @@ -18,10 +20,12 @@ const killAllConfirm = require('./actions/killAllConfirm'); const validate = require('./utils/validate'); const requirements = require('./utils/requirements'); -// Check for requirements such as OS version and nginx install. Throw and exit if requirements not found. +// Check for requirements such as OS version and nginx install. +// Throw and exit if requirements not found. // #Roadmap: Add ability to satisfy any possible requirements. -requirements(); // Comment in development and uncomment this line in production. This should check whether the OS is compatible with this version of `up` +requirements(); // Comment in development and uncomment this line in production. +// This should check whether the OS is compatible with this version of `up` program .version('0.1.5'); @@ -29,23 +33,40 @@ program program .command('static [outPort]') .description('Create a static server at this folder.') - .action(function (domain, outPort) { //If outport is not given, 80 is set as default. Later, change this default to reflect nginx's settings. - outPort = outPort || "80"; // This is a string because regex needs to validate it. - if (!validate(domain, outPort)) return; //Validates domain and outport, and if invalid, throws and returns. + .action(function (domain, outPort) { + // If outport is not given, 80 is set as default. + // Later, change this default to reflect nginx's settings. + outPort = outPort || "80"; + // This is a string because regex needs to validate it. + if (!validate(domain, outPort)) return; + // Validates domain and outport, and if invalid, throws and returns. createStaticServer(domain, outPort); if (outPort != "80" || "443") domain = domain + ":" + outPort; - console.log("\nDone! Your static server has been set up!\nPoint your domain to this server and check " + chalk.cyan(domain) + " to verify!"); + console.log(EOL + [ + "Done! Your static server has been set up!", + "Point your domain to this server and check " + + chalk.cyan(domain) + + " to verify!" + ].join(EOL)); }); program .command('proxy [outPort]') .description('Create a proxy server, listening at port number.') - .action(function (domain, inPort, outPort) { //Inbound port is necessary, but outbound is set to 80 by default. Again, will change this to reflect nginx's settings. - outPort = outPort || "80"; // This is a string because regex needs to validate it. + .action(function (domain, inPort, outPort) { + // Inbound port is necessary, but outbound is set to 80 by default. + // Again, will change this to reflect nginx's settings. + outPort = outPort || "80"; + // This is a string because regex needs to validate it. if (!validate(domain, inPort, outPort)) return; createProxyServer(domain, inPort, outPort); if (outPort != "80" || "443") domain = domain + ":" + outPort; - console.log("\nDone! Your reverse proxy server has been set up!\nPoint your domain to this server and check " + chalk.cyan(domain) + " to verify!"); + console.log(EOL + [ + "Done! Your reverse proxy server has been set up!", + "Point your domain to this server and check " + + chalk.cyan(domain) + + " to verify!" + ].join(EOL)); }); program @@ -59,9 +80,10 @@ program .command('kill [ourPort]') .description('Kill a server.') .action(function (domain, outPort) { - outPort = outPort || "80"; // This is a string because regex needs to validate it. + outPort = outPort || "80"; + // This is a string because regex needs to validate it. killServer(domain, outPort); - console.log("\nDone! Your server has been killed!\n"); + console.log(EOL + "Done! Your server has been killed!"+ EOL); }); program @@ -69,14 +91,18 @@ program .description('Warning! Will completely kill all servers and reset nginx') .action(function() { killAllConfirm(); - console.log("\nA backup of your old servers.up is saved in /etc/up-serve/servers.bak.up.\n" + - "Check this if you need to.\n"); + console.log(EOL + [ + "A backup of your old servers.up is " + + "saved in /etc/up-serve/servers.bak.up.", + "Check this if you need to." + ].join(EOL) + EOL); }); program .command('*') // This should pick invalid commands, but it doesn't, yet. .action(function () { - console.log("\nInvalid command. Type " + chalk.cyan('up --help') + " for help.\n"); + console.log(EOL + "Invalid command. Type " + + chalk.cyan('up --help') + " for help." + EOL); }); // Adds custom help text to the automatically generated help. @@ -84,10 +110,16 @@ program.on('--help', function () { console.log(''); console.log(' Usage:'); console.log(''); - console.log(' ', chalk.yellow('$ up'), chalk.cyan('static'), chalk.blue('domain-name')); + console.log(' ', + chalk.yellow('$ up'), + chalk.cyan('static'), + chalk.blue('domain-name')); console.log(' Set up a static server at domain-name'); console.log(''); - console.log(' ', chalk.yellow('$ up'), chalk.cyan('proxy'), chalk.blue('domain-name port-number')); + console.log(' ', + chalk.yellow('$ up'), + chalk.cyan('proxy'), + chalk.blue('domain-name port-number')); console.log(' Set up a proxy server listening at port-number'); console.log(''); }); diff --git a/utils/nginxConf.js b/utils/nginxConf.js index 2037feb..bf73bcd 100644 --- a/utils/nginxConf.js +++ b/utils/nginxConf.js @@ -1,6 +1,7 @@ 'use strict'; -// Simple function that takes a path and domain name, concatenates them with ".conf" and returns it. +// Simple function that takes a path and domain name, +// concatenates them with ".conf" and returns it. function conf(path, domain, outPort) { return (path + domain + "." + outPort + ".conf"); diff --git a/utils/nginxPath.js b/utils/nginxPath.js index 96feaac..f5b71dc 100644 --- a/utils/nginxPath.js +++ b/utils/nginxPath.js @@ -1,6 +1,7 @@ 'use strict'; -// These functions just return paths. Later, these should be modified to poll from nginx's config. +// These functions just return paths. +// Later, these should be modified to poll from nginx's config. const npath = "/etc/nginx/"; const enabled = npath + "sites-enabled/"; diff --git a/utils/parseToInt.js b/utils/parseToInt.js index 522aa75..fea00d7 100644 --- a/utils/parseToInt.js +++ b/utils/parseToInt.js @@ -1,6 +1,7 @@ 'use strict'; -// Parse an input string and return a number if it is an integer. If it's a float, string, or array, return undefined. +// Parse an input string and return a number if it is an integer. +// If it's a float, string, or array, return undefined. function parseToInt(inputString) { const parsing = /^\d+$/.exec(inputString); diff --git a/utils/requirements.js b/utils/requirements.js index 159a53c..da339af 100644 --- a/utils/requirements.js +++ b/utils/requirements.js @@ -1,5 +1,7 @@ 'use strict'; +const { EOL } = require('os'); + const shell = require('shelljs'); const chalk = require('chalk'); @@ -8,15 +10,23 @@ function requirements() { // Detect Linux or BSD const isLin = /^linux|^bsd/.test(process.platform); - // Throw if OS is not Linux or BSD. This should be changed to throw if not Debian based distro. Eventually, we can add more exceptions as `up` handles more cases. + // Throw if OS is not Linux or BSD. + // This should be changed to throw if not Debian based distro. + // Eventually, we can add more exceptions as `up` handles more cases. if(!isLin) { - shell.echo("\nThis is not a Linux or freeBSD distribution. This tool not written for this distro. Please raise an issue at " + chalk.cyan("https://github.com/codefeathers/up-serve") + " if you want `up` to be ported for your distro"); + shell.echo(EOL + + "This is not a Linux or freeBSD distribution. " + + "This tool not written for this distro. " + + "Please raise an issue at " + + chalk.cyan("https://github.com/codefeathers/up-serve") + + " if you want `up` to be ported for your distro"); shell.exit(1); } // Throw if Nginx is not found if (!shell.which('nginx')) { - shell.echo('I need nginx to work. Install nginx first. https://nginx.org/'); + shell.echo( + 'I need nginx to work. Install nginx first. https://nginx.org/'); shell.exit(1); } diff --git a/utils/validate.js b/utils/validate.js index a8afa5e..e1a9d2b 100644 --- a/utils/validate.js +++ b/utils/validate.js @@ -1,5 +1,7 @@ 'use strict'; +const { EOL } = require('os'); + const parseToInt = require('./parseToInt'); const isIP = require('./isIP'); @@ -12,14 +14,26 @@ function validate(domain, inPort, outPort) { outPort = outPort || 80; // Error messages - const domainInvalidMsg = ["\nPlease use a domain name instead of an IP address.", "\nDomain is not valid. Please use a valid domain name."]; - const portInvalidMsg = ["\nPort should be a number.", "\nPort should be a number from 1 and 65535."]; + const domainInvalidMsg = [ + EOL + "Please use a domain name instead of an IP address.", + EOL + "Domain is not valid. Please use a valid domain name." + ]; + const portInvalidMsg = [ + EOL + "Port should be a number.", + EOL + "Port should be a number from 1 and 65535." + ]; - // ARGV returns a string as input. Port numbers should be parsed to int to validate them. If validation fails, these will return undefined and will fail the subsequent test. + // ARGV returns a string as input. + // Port numbers should be parsed to int to validate them. + // If validation fails, these will return undefined and + // will fail the subsequent test. const validInPort = parseToInt(inPort); const validOutPort = parseToInt(outPort); - // The value of isInvalid will be returned back. If none of the `if`s are true, the default value `true` is returned `domain`, `inPort` and `outPort` are considered validated. + // The value of isInvalid will be returned back. + // If none of the `if`s are true, the default + // value `true` is returned `domain`, `inPort` and `outPort` are considered + // validated. let isValid = true; // Throw if IP is given instead of domain name. @@ -34,31 +48,41 @@ function validate(domain, inPort, outPort) { return isValid = false; } - // Enter if `inPort` is not defined. This happens for `up static` where no inbound ports are required. + // Enter if `inPort` is not defined. + // This happens for `up static` where no inbound ports are required. if (typeof inPort == undefined) { if (!validOutPort) { console.log(portInvalidMsg[0]); // `outPort` is not an integer. return isValid = false; } if (!(validOutPort > 0 && validOutPort <= 65535)) { - console.log(portInvalidMsg[1]); // `outPort` is not within port range. + console.log(portInvalidMsg[1]); + // `outPort` is not within port range. return isValid = false; } } - // Enter if `inPort` is defined. This happens for `up proxy` where inbound port is required. + // Enter if `inPort` is defined. This happens for `up proxy` where + // inbound port is required. if (typeof inPort !== undefined) { if (!validInPort || !validOutPort) { - console.log(portInvalidMsg[0]); // Either `inPort` or `outPort` is not an integer. + console.log(portInvalidMsg[0]); + // Either `inPort` or `outPort` is not an integer. return isValid = false; } if (typeof outPort !== undefined) { - if (!((validInPort > 0 && validInPort <= 65535) && (validOutPort > 0 && validOutPort <= 65535))) { - console.log(portInvalidMsg[1]); // Either `inPort` or `outPort` are not within port range. + if (!( + (validInPort > 0 && validInPort <= 65535) && + (validOutPort > 0 && validOutPort <= 65535) + )) { + console.log(portInvalidMsg[1]); + // Either `inPort` or `outPort` are not within port range. return isValid = false; } } - return isValid; // If any of the `if`s were true, `isInvalid = false`. If not, `isInvalid = true`. + return isValid; + // If any of the `if`s were true, `isInvalid = false`. + // If not, `isInvalid = true`. } } From 07f1d5c7284218fdba28f8696436a0279bbf0d97 Mon Sep 17 00:00:00 2001 From: Thomas Rory Gummerson Date: Thu, 9 Nov 2017 14:54:30 +0100 Subject: [PATCH 33/37] Final newline fix, project should now be newline-independent --- utils/listFile.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/listFile.js b/utils/listFile.js index 2e175f4..890dcd6 100644 --- a/utils/listFile.js +++ b/utils/listFile.js @@ -1,5 +1,7 @@ 'use strict'; +const { EOL } = require('os'); + const fs = require('fs-extra'); const removeFromArray = require('./removeFromArray'); @@ -39,7 +41,7 @@ function removeFromList (domain, outPort) { jsonFile = JSON.stringify(jsonBuffer, null, '\t'); fs.writeFileSync(listFilePath(), jsonFile); } - else console.log("\nNo servers were created using `up` yet.\n"); + else console.log(EOL + "No servers were created using `up` yet." + EOL); } function readServers () { From 629cc9f0a9899b04476d2cfd99ff0341f0520518 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Mon, 13 Nov 2017 15:52:44 +0530 Subject: [PATCH 34/37] Working on kill-all confirmation prompt --- actions/killALL.js | 7 ++++++- actions/killAllConfirm.js | 41 ++++++++++++----------------------------- index.js | 1 + utils/isFQDN.js | 4 +++- 4 files changed, 22 insertions(+), 31 deletions(-) diff --git a/actions/killALL.js b/actions/killALL.js index 4b38147..b8905fa 100644 --- a/actions/killALL.js +++ b/actions/killALL.js @@ -22,4 +22,9 @@ function killALL () { // Symlink the default.conf file from confD to sites-enabled } -module.exports = killALL; +function noKill () { + console.log("\nkill-all was interrupted by user."); +} + +module.exports.kill = killALL; +module.exports.noKill = noKill; \ No newline at end of file diff --git a/actions/killAllConfirm.js b/actions/killAllConfirm.js index 59d8537..1d8a8e8 100644 --- a/actions/killAllConfirm.js +++ b/actions/killAllConfirm.js @@ -1,38 +1,21 @@ 'use strict'; -const { EOL } = require('os'); +const readline = require('readline'); +const killALL = require('./killALL').kill; +const noKill = require('./killALL').noKill; -const prompt = require('prompt'); -const shell = require('shelljs'); +function killAllConfirm() { + console.log("\nThis action will destroy all nginx servers and return to default configuration.\nAre you sure you want to do this?" + "\nConfirm y[es] / n[o]:"); + const rl = readline.createInterface({ input: process.stdin }); -const killAll = require('./killALL'); + const line = () => new Promise(resolve => rl.once('line', resolve)); -function killAllConfirm () { - // Start the prompt - - prompt.start(); - - const property = { - name: 'yesno', - message: 'This will completely destroy all configs and reset nginx. ' + - 'Are you sure?', - validator: /y[es]*|n[o]?/, - warning: 'Must respond yes or no', - default: 'no' - }; - - prompt.get(property, function (err, res) { - if(res.yesno == "no") { - console.log("Aborted!"); - shell.exit(0); - } - else { - console.log("Deleting all servers..."); - killAll(); - console.log(EOL + - "Done. All configs have been destroyed. Hope you're happy."); + line().then(line => { + line.trim(); + if((/^(y(es)?|n(o)?)$/).test(line)) { + line == "y" || "yes" ? killALL() : noKill(); } }); } -module.exports = killAllConfirm; +module.exports = killAllConfirm; \ No newline at end of file diff --git a/index.js b/index.js index a82bb4d..b7efe31 100755 --- a/index.js +++ b/index.js @@ -90,6 +90,7 @@ program .command('kill-all') .description('Warning! Will completely kill all servers and reset nginx') .action(function() { + //new Promise(resolve => killed\killAllConfirm(); killAllConfirm(); console.log(EOL + [ "A backup of your old servers.up is " + diff --git a/utils/isFQDN.js b/utils/isFQDN.js index fd0de97..3a43445 100644 --- a/utils/isFQDN.js +++ b/utils/isFQDN.js @@ -4,6 +4,7 @@ 'use strict'; const fs = require('fs-extra'); +const path = require('path'); // Official list of TLDs should be fetched from: // https://data.iana.org/TLD/tlds-alpha-by-domain.txt @@ -14,7 +15,8 @@ const fs = require('fs-extra'); function isFQDN(domain) { // Importing and parsing `tlds.txt` file - const tlds = fs.readFileSync('./assets/tlds.txt', 'utf8') + const tldspath = path.join(__dirname, '/../assets/tlds.txt'); + const tlds = fs.readFileSync(tldspath, 'utf8') .split(/[\r\n]+/) .filter(x => !x.startsWith('#')); From 34de278955cee14a476301cb694fbdb55dc2e6f9 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Mon, 20 Nov 2017 15:29:16 +0530 Subject: [PATCH 35/37] Added sudo requirement in requirements.js --- package-lock.json | 5 +++++ package.json | 1 + utils/requirements.js | 7 ++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 3029a64..fd51ec5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -983,6 +983,11 @@ "util-deprecate": "1.0.2" } }, + "readline-sync": { + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.7.tgz", + "integrity": "sha1-ABv91MBhEMPAhMY798alYCIhPzA=" + }, "rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", diff --git a/package.json b/package.json index d4e7407..0d9be20 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "fs-extra": "^4.0.2", "prettyjson": "^1.2.1", "prompt": "^1.0.0", + "readline-sync": "^1.4.7", "shelljs": "^0.7.8" }, "devDependencies": { diff --git a/utils/requirements.js b/utils/requirements.js index da339af..26b2cdb 100644 --- a/utils/requirements.js +++ b/utils/requirements.js @@ -22,6 +22,12 @@ function requirements() { " if you want `up` to be ported for your distro"); shell.exit(1); } + + // Check if sudo + if (process.getuid() != 0) { + console.log("`up` requires root privileges to work. Please use `sudo up `"); + shell.exit(1); + } // Throw if Nginx is not found if (!shell.which('nginx')) { @@ -29,7 +35,6 @@ function requirements() { 'I need nginx to work. Install nginx first. https://nginx.org/'); shell.exit(1); } - } module.exports = requirements; From 5f822feea5ab961bbe407a1b3e4244c43082da04 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Mon, 20 Nov 2017 15:46:27 +0530 Subject: [PATCH 36/37] `up kill-all` confirmation prompt added --- actions/killALL.js | 10 +++++++++- actions/killAllConfirm.js | 23 ++++++++++------------- assets/tlds.txt | 2 +- index.js | 5 ----- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/actions/killALL.js b/actions/killALL.js index b8905fa..789253d 100644 --- a/actions/killALL.js +++ b/actions/killALL.js @@ -2,6 +2,8 @@ const shell = require('shelljs'); +const { EOL } = require('os'); + const npath = require('../utils/nginxPath'); const conf = require('../utils/nginxConf'); @@ -20,6 +22,12 @@ function killALL () { shell.ln('-sf', npath.confD() + "default.conf", npath.enabledSites() + "default.conf"); // Symlink the default.conf file from confD to sites-enabled + console.log("All servers were killed and reverted to default."); + console.log(EOL + [ + "A backup of your old servers.up is " + + "saved in /etc/up-serve/servers.bak.up.", + "Check this if you need to." + ].join(EOL) + EOL); } function noKill () { @@ -27,4 +35,4 @@ function noKill () { } module.exports.kill = killALL; -module.exports.noKill = noKill; \ No newline at end of file +module.exports.noKill = noKill; diff --git a/actions/killAllConfirm.js b/actions/killAllConfirm.js index 1d8a8e8..d6cc380 100644 --- a/actions/killAllConfirm.js +++ b/actions/killAllConfirm.js @@ -1,21 +1,18 @@ 'use strict'; -const readline = require('readline'); +const readlineSync = require('readline-sync'); const killALL = require('./killALL').kill; -const noKill = require('./killALL').noKill; +const { noKill } = require('./killALL'); function killAllConfirm() { - console.log("\nThis action will destroy all nginx servers and return to default configuration.\nAre you sure you want to do this?" + "\nConfirm y[es] / n[o]:"); - const rl = readline.createInterface({ input: process.stdin }); - - const line = () => new Promise(resolve => rl.once('line', resolve)); - - line().then(line => { - line.trim(); - if((/^(y(es)?|n(o)?)$/).test(line)) { - line == "y" || "yes" ? killALL() : noKill(); - } - }); + console.log("\nThis action will destroy all nginx servers and return " + + "to default configuration."); + if (readlineSync.keyInYN("Are you sure you want to do this?")) { + killALL(); + } + else { + noKill(); + } } module.exports = killAllConfirm; \ No newline at end of file diff --git a/assets/tlds.txt b/assets/tlds.txt index c87ced8..2df92a0 100644 --- a/assets/tlds.txt +++ b/assets/tlds.txt @@ -1,4 +1,4 @@ -# Version 2017110701, Last Updated Wed Nov 8 07:07:02 2017 UTC +# Version 2017111900, Last Updated Sun Nov 19 07:07:01 2017 UTC AAA AARP ABARTH diff --git a/index.js b/index.js index b7efe31..52d1550 100755 --- a/index.js +++ b/index.js @@ -92,11 +92,6 @@ program .action(function() { //new Promise(resolve => killed\killAllConfirm(); killAllConfirm(); - console.log(EOL + [ - "A backup of your old servers.up is " + - "saved in /etc/up-serve/servers.bak.up.", - "Check this if you need to." - ].join(EOL) + EOL); }); program From 9a37384aa321fd70ad6c4f3857a21cf56501dfb6 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Mon, 20 Nov 2017 16:00:10 +0530 Subject: [PATCH 37/37] Version bump to 0.2.0, Alpha. Added Changelog.md. --- Changelog.md | 13 +++++++++++++ README.md | 6 +++--- index.js | 2 +- package.json | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 Changelog.md diff --git a/Changelog.md b/Changelog.md new file mode 100644 index 0000000..0925284 --- /dev/null +++ b/Changelog.md @@ -0,0 +1,13 @@ +# Changelog / Version history + +## `up` v. 0.2.0 + +Changelog: + +- Under the hood BREAKING changes. Working directories change. + - `/var/www/` to `/etc/up-serve/static/` + - `/etc/nginx/sites-available/` to `/etc/nginx/conf.d` +- `up static|proxy ` adds the server to `/etc/up-serve/servers.up` list. +- `up kill ` removes server from `servers.up` list. +- `up list` lists available servers from /etc/up-serve/servers.up! +- `up kill-all` destroys all servers and places a `default.conf` in `/etc/nginx/sites-enabled`. \ No newline at end of file diff --git a/README.md b/README.md index 2f24478..a4aaf06 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,10 @@ # up -> Current version: `up v.0.1.9 (Pre-Alpha)` +> Current version: `up v.0.2.0 (Alpha)` -> Notes: `up` has reached MVP! 🎉 Changelog will be added from alpha version: `up v.0.2.0` [(Roadmap)](Roadmap.md)\ -> ⚠️ ❌ `up` is still not ready for use yet! Do not attempt to use this in development or production until alpha! +> Notes: `up` is now in Alpha! 🎉 [(Changelog)](Changelog.md)\ +> ⚠️ ❌ `up` is pretty useable so far. If you're testing `up` on a development server, do give us feedback. **`up`** is a command line application that creates nginx server blocks quickly with a single command. diff --git a/index.js b/index.js index 52d1550..3f1791e 100755 --- a/index.js +++ b/index.js @@ -28,7 +28,7 @@ requirements(); // Comment in development and uncomment this line in production. // This should check whether the OS is compatible with this version of `up` program - .version('0.1.5'); + .version('0.2.0'); program .command('static [outPort]') diff --git a/package.json b/package.json index 0d9be20..74a1c31 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "up-serve", - "version": "0.1.9", + "version": "0.2.0", "description": "A cli tool to quickly create and manage nginx server blocks.", "main": "index.js", "scripts": {