From f14812f9ab7812d8f78af8c77171d1a8c25d068e Mon Sep 17 00:00:00 2001 From: Luca Mattiazzi Date: Fri, 29 Nov 2019 16:36:11 +0100 Subject: [PATCH 01/15] when using --exposed, yarn start will expose the server on the interwebs --- packages/accurapp-scripts/scripts/start.js | 17 +++++-- packages/accurapp-scripts/utils/git-utils.js | 20 ++++++++ .../accurapp-scripts/utils/reverse-tunnel.js | 45 ++++++++++++++++++ .../accurapp-scripts/utils/tunnel-client.js | 46 +++++++++++++++++++ 4 files changed, 124 insertions(+), 4 deletions(-) create mode 100644 packages/accurapp-scripts/utils/reverse-tunnel.js create mode 100644 packages/accurapp-scripts/utils/tunnel-client.js diff --git a/packages/accurapp-scripts/scripts/start.js b/packages/accurapp-scripts/scripts/start.js index 9102ad92..19ad7af4 100644 --- a/packages/accurapp-scripts/scripts/start.js +++ b/packages/accurapp-scripts/scripts/start.js @@ -10,6 +10,7 @@ const WebpackDevServer = require('webpack-dev-server') const openOrRefreshBrowser = require('react-dev-utils/openBrowser') const { prepareUrls } = require('react-dev-utils/WebpackDevServerUtils') const { log, coloredBanner } = require('../utils/logging-utils') +const { tunnelPort, generateSubdomain } = require('../utils/tunnel-client') const { createWebpackCompiler, readWebpackConfig } = require('../utils/webpack-utils') const { verifyTypeScriptSetup } = require('../utils/verifyTypeScriptSetup') const { @@ -27,6 +28,7 @@ process.env.LATEST_TAG = extractLatestTag() const HOST = process.env.HOST || '0.0.0.0' const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 8000 const PROTOCOL = process.env.HTTPS === 'true' ? 'https' : 'http' +const EXPOSED = process.argv.includes('--exposed') const appDir = process.cwd() verifyTypeScriptSetup(appDir) @@ -51,6 +53,15 @@ function runDevServer(port) { openOrRefreshBrowser(urls.localUrlForBrowser) }) + EXPOSED && + tunnelPort(port, generateSubdomain()) + .then(url => { + log.info(`App exposed to the interwebs on: ${chalk.cyan(url)}`) + }) + .catch(err => { + log.err(err) + }) + const shutDownServer = () => { devServer.close() process.exit() @@ -63,14 +74,12 @@ console.log(coloredBanner('/||||/| accurapp')) detect(DEFAULT_PORT) .then(port => { - if (port === DEFAULT_PORT) { - runDevServer(port) - } else { + if (!port === DEFAULT_PORT) { log.ok( `Something is already running on port ${DEFAULT_PORT}, switching to ${chalk.blue(port)}...` ) - runDevServer(port) } + runDevServer(port) return port }) .catch(err => { diff --git a/packages/accurapp-scripts/utils/git-utils.js b/packages/accurapp-scripts/utils/git-utils.js index 50765429..a43402cd 100644 --- a/packages/accurapp-scripts/utils/git-utils.js +++ b/packages/accurapp-scripts/utils/git-utils.js @@ -36,9 +36,29 @@ function extractLatestTag() { } } +function extractCurrentBranch() { + try { + return cp.execSync('git rev-parse --abbrev-ref HEAD') + } catch (e) { + // Probably git is not available, return an empty string instead + return '' + } +} + +function extractCurrentRepo() { + try { + return cp.execSync('basename -s .git `git config --get remote.origin.url`') + } catch (e) { + // Probably git is not available, return an empty string instead + return '' + } +} + module.exports = { extractBrowserslistString, extractLatestCommitHash, extractLatestCommitTimestamp, extractLatestTag, + extractCurrentBranch, + extractCurrentRepo, } diff --git a/packages/accurapp-scripts/utils/reverse-tunnel.js b/packages/accurapp-scripts/utils/reverse-tunnel.js new file mode 100644 index 00000000..b20eb58d --- /dev/null +++ b/packages/accurapp-scripts/utils/reverse-tunnel.js @@ -0,0 +1,45 @@ +const { Client } = require('ssh2') +const { Socket } = require('net') + +function noop() {} + +function createClient(config, onReadyCb = noop, onConnectionCb = noop) { + const conn = new Client() + const errors = [] + + conn.on('ready', function() { + onReadyCb() + conn.forwardIn(config.dstHost, config.dstPort, (err, port) => { + if (err) return errors.push(err) + conn.emit('forward-in', port) + }) + }) + + conn.on('tcp connection', (info, accept, reject) => { + let remote + const srcSocket = new Socket() + + srcSocket.on('error', err => { + errors.push(err) + if (remote === undefined) { + reject() + } else { + remote.end() + } + }) + + srcSocket.connect(config.srcPort, config.srcHost, () => { + remote = accept() + srcSocket.pipe(remote).pipe(srcSocket) + if (errors.length === 0) { + onConnectionCb(null, conn) + } else { + onConnectionCb(errors, null) + } + }) + }) + conn.connect(config) + return conn +} + +module.exports = { createClient } diff --git a/packages/accurapp-scripts/utils/tunnel-client.js b/packages/accurapp-scripts/utils/tunnel-client.js new file mode 100644 index 00000000..63a90307 --- /dev/null +++ b/packages/accurapp-scripts/utils/tunnel-client.js @@ -0,0 +1,46 @@ +const got = require('got') +const os = require('os') +const { createClient } = require('./reverse-tunnel') +const { extractCurrentRepo, extractCurrentBranch } = require('../utils/git-utils') + +const { USER, SSH_AUTH_SOCK } = process.env + +const DOMAIN = 'internal.accurat.io' + +function generateSubdomain() { + const repo = extractCurrentRepo() + const branch = extractCurrentBranch() + if (!repo) return os.hostname() + if (branch === 'master') return repo.trim() + return `${branch.trim()}.${repo.trim()}` +} + +function tunnelPort(localPort, subdomain) { + return got + .post(`https://${DOMAIN}?subdomain=${subdomain}`, { json: true }) + .then(res => { + const { port, error } = res.body + if (error) throw error + return port + }) + .then(dstPort => { + return new Promise((resolve, reject) => { + return createClient( + { + host: DOMAIN, + port: 2222, + dstHost: 'localhost', + dstPort: dstPort, + srcHost: 'localhost', + srcPort: localPort, + keepAlive: true, + agent: SSH_AUTH_SOCK, + username: USER, + }, + () => resolve(`https://${subdomain}.${DOMAIN}`) + ) + }) + }) +} + +module.exports = { tunnelPort, generateSubdomain } From 87375b931a3089488a3982773f766e34d531c847 Mon Sep 17 00:00:00 2001 From: Luca Mattiazzi Date: Fri, 29 Nov 2019 16:49:38 +0100 Subject: [PATCH 02/15] feat: added base domain that defaults to ours --- packages/accurapp-scripts/utils/tunnel-client.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/accurapp-scripts/utils/tunnel-client.js b/packages/accurapp-scripts/utils/tunnel-client.js index 63a90307..ad8c3a93 100644 --- a/packages/accurapp-scripts/utils/tunnel-client.js +++ b/packages/accurapp-scripts/utils/tunnel-client.js @@ -3,9 +3,7 @@ const os = require('os') const { createClient } = require('./reverse-tunnel') const { extractCurrentRepo, extractCurrentBranch } = require('../utils/git-utils') -const { USER, SSH_AUTH_SOCK } = process.env - -const DOMAIN = 'internal.accurat.io' +const { USER, SSH_AUTH_SOCK, BASE_DOMAIN = 'internal.accurat.io' } = process.env function generateSubdomain() { const repo = extractCurrentRepo() @@ -17,7 +15,7 @@ function generateSubdomain() { function tunnelPort(localPort, subdomain) { return got - .post(`https://${DOMAIN}?subdomain=${subdomain}`, { json: true }) + .post(`https://${BASE_DOMAIN}?subdomain=${subdomain}`, { json: true }) .then(res => { const { port, error } = res.body if (error) throw error @@ -27,7 +25,7 @@ function tunnelPort(localPort, subdomain) { return new Promise((resolve, reject) => { return createClient( { - host: DOMAIN, + host: BASE_DOMAIN, port: 2222, dstHost: 'localhost', dstPort: dstPort, @@ -37,7 +35,7 @@ function tunnelPort(localPort, subdomain) { agent: SSH_AUTH_SOCK, username: USER, }, - () => resolve(`https://${subdomain}.${DOMAIN}`) + () => resolve(`https://${subdomain}.${BASE_DOMAIN}`) ) }) }) From 60ec4471647321f16659aba3ee8817fe532d4357 Mon Sep 17 00:00:00 2001 From: Luca Mattiazzi Date: Fri, 29 Nov 2019 17:04:45 +0100 Subject: [PATCH 03/15] docs: documented the --exposed flag --- README.md | 56 ++++++++++++------- .../accurapp-scripts/utils/reverse-tunnel.js | 4 +- .../accurapp-scripts/utils/tunnel-client.js | 10 ++-- 3 files changed, 44 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 6573c8c5..60ac1889 100644 --- a/README.md +++ b/README.md @@ -17,30 +17,32 @@ but significant amounts of code were rewritten and simplified. Here are some shi - **JSON5 webpack loader** to import .json5 files. [Read more about JSON5 here](https://json5.org/). ## Table of contents +- [!Accurapp](#accurapp) +- [Table of contents](#table-of-contents) - [Creating a new project](#creating-a-new-project) + - [Setting up github](#setting-up-github) + - [Setting up the automatic deploy](#setting-up-the-automatic-deploy) + - [Commands](#commands) - [Customization](#customization) - - [Customizing Webpack](#customizing-webpack) - - [Customizing Eslint](#customizing-eslint) - - [Customizing Babel](#customizing-babel) - - [Setting Env Variables](#setting-env-variables) - - [Customizing Env Variables](#customizing-env-variables) + - [Customizing Webpack](#customizing-webpack) + - [Customizing Eslint](#customizing-eslint) + - [Customizing Babel](#customizing-babel) + - [Setting Env Variables](#setting-env-variables) + - [Customizing Env Variables](#customizing-env-variables) - [Available Env Variables](#available-env-variables) - [Project Scaffolding](#project-scaffolding) - [F.A.Q.](#faq) - - [How do I enable hot reloading for the state?](#faq) - - [Where do I put the images?](#faq) - - [Where do I put the custom fonts?](#faq) - - [What is the public folder for?](#faq) - - [How do I handle svg files?](#faq) - - [How do I enable TypeScript?](#faq) - - [How do I override a webpack loader?](#faq) - - [What's all the fuss about FUSS?](#faq) - - [How do I enable prettier?](#faq) - - [I need to support IE11. What do I do?](#faq) - - [How do I use a web worker?](#faq) - - [How do I use a service worker?](#faq) - - [I need title and meta tags for each route for SEO. How do I do it?](#faq) - - [I need to build for Electron. How do I do it?](#faq) +- [Install `react-helmet` and `react-snap`](#install-react-helmet-and-react-snap) +- [Add meta tags for each route in the `render` function](#add-meta-tags-for-each-route-in-the-render-function) +- [Add `react-snap` in `src/index.js`](#add-react-snap-in-srcindexjs) +- [Add `react-snap` to `package.json`](#add-react-snap-to-packagejson) +- [Add the `react-snap` config in `bitbucket-pipelines.yml`](#add-the-react-snap-config-in-bitbucket-pipelinesyml) +- [OK, setup done! Now, how do I check if it is working?](#ok-setup-done-now-how-do-i-check-if-it-is-working) +- [Basic troubleshooting: `react-snap` works properly, but no links are found](#basic-troubleshooting-react-snap-works-properly-but-no-links-are-found) +- [Basic troubleshooting: I get a weird error for 404 pages](#basic-troubleshooting-i-get-a-weird-error-for-404-pages) +- [Basic troubleshooting: There is unknown code in my built index.html. Is it malicious? How do I remove it?](#basic-troubleshooting-there-is-unknown-code-in-my-built-indexhtml-is-it-malicious-how-do-i-remove-it) +- [Further troubleshooting](#further-troubleshooting) +- [What goes in the ``?](#what-goes-in-the-head) - [Contributing](#contributing) ## Creating a new project @@ -735,6 +737,22 @@ Please, see [`@joshbuchea`'s head repo](https://gethead.info/). [This guide](https://gist.github.com/matthewjberger/6f42452cb1a2253667942d333ff53404) is a good one to follow, and [here is a working example](https://github.com/nkint/accurapp-electron) of accurapp with electron. Good luck! +
+Someone else needs to see what I'm working on, how can I show it? + +When running `yarn start` you can add `--exposed` as a flag. + +The webpack server will try allocate a subdomain on a remote server and open an ssh reverse tunnel in order to receive every request that the remote will receive on that domain. As soon as the subdomain is allocated, the remote server will also generate a valid https certificate. + +The remote domain is set as the env variable `TUNNEL_DOMAIN` and defaults to `internal.accurat.io`, but can be set to whatever server is running an instance of the [SSH-Tuna server infrastucture](https://github.com/accurat/ssh-tuna) + +The allocated domain will have the following structure: +- If the script is running from inside a git project and is on a branch different than master: `{branch}.{repo}.{TUNNEL_DOMAIN}` +- If the script is running from inside a git project and is on master: `{repo}.{TUNNEL_DOMAIN}` +- If the script is running from outside a git project: `{hostname}.{TUNNEL_DOMAIN}` + +
+ ## Contributing If you make some edits and wish to test them locally you can run `yarn test` for an end-to-end test, or `yarn create-test-app` which creates a test app using the local packages. diff --git a/packages/accurapp-scripts/utils/reverse-tunnel.js b/packages/accurapp-scripts/utils/reverse-tunnel.js index b20eb58d..b5b776bc 100644 --- a/packages/accurapp-scripts/utils/reverse-tunnel.js +++ b/packages/accurapp-scripts/utils/reverse-tunnel.js @@ -1,5 +1,5 @@ -const { Client } = require('ssh2') const { Socket } = require('net') +const { Client } = require('ssh2') function noop() {} @@ -7,7 +7,7 @@ function createClient(config, onReadyCb = noop, onConnectionCb = noop) { const conn = new Client() const errors = [] - conn.on('ready', function() { + conn.on('ready', () => { onReadyCb() conn.forwardIn(config.dstHost, config.dstPort, (err, port) => { if (err) return errors.push(err) diff --git a/packages/accurapp-scripts/utils/tunnel-client.js b/packages/accurapp-scripts/utils/tunnel-client.js index ad8c3a93..7f8bad08 100644 --- a/packages/accurapp-scripts/utils/tunnel-client.js +++ b/packages/accurapp-scripts/utils/tunnel-client.js @@ -1,9 +1,9 @@ -const got = require('got') const os = require('os') +const got = require('got') const { createClient } = require('./reverse-tunnel') const { extractCurrentRepo, extractCurrentBranch } = require('../utils/git-utils') -const { USER, SSH_AUTH_SOCK, BASE_DOMAIN = 'internal.accurat.io' } = process.env +const { USER, SSH_AUTH_SOCK, TUNNEL_DOMAIN = 'internal.accurat.io' } = process.env function generateSubdomain() { const repo = extractCurrentRepo() @@ -15,7 +15,7 @@ function generateSubdomain() { function tunnelPort(localPort, subdomain) { return got - .post(`https://${BASE_DOMAIN}?subdomain=${subdomain}`, { json: true }) + .post(`https://${TUNNEL_DOMAIN}?subdomain=${subdomain}`, { json: true }) .then(res => { const { port, error } = res.body if (error) throw error @@ -25,7 +25,7 @@ function tunnelPort(localPort, subdomain) { return new Promise((resolve, reject) => { return createClient( { - host: BASE_DOMAIN, + host: TUNNEL_DOMAIN, port: 2222, dstHost: 'localhost', dstPort: dstPort, @@ -35,7 +35,7 @@ function tunnelPort(localPort, subdomain) { agent: SSH_AUTH_SOCK, username: USER, }, - () => resolve(`https://${subdomain}.${BASE_DOMAIN}`) + () => resolve(`https://${subdomain}.${TUNNEL_DOMAIN}`) ) }) }) From 6ca16c1da2c7978e8b043f556f696e7b3f1440fc Mon Sep 17 00:00:00 2001 From: Luca Mattiazzi Date: Fri, 29 Nov 2019 17:28:22 +0100 Subject: [PATCH 04/15] fix: installed dependencies --- packages/accurapp-scripts/package.json | 2 ++ yarn.lock | 40 +++++++++++++++----------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/packages/accurapp-scripts/package.json b/packages/accurapp-scripts/package.json index 41214deb..34771816 100644 --- a/packages/accurapp-scripts/package.json +++ b/packages/accurapp-scripts/package.json @@ -35,6 +35,7 @@ "filesize": "4.1.2", "fs-extra": "8.0.1", "globby": "9.2.0", + "got": "^9.6.0", "gzip-size": "5.1.1", "indent-string": "4.0.0", "latest-version": "5.1.0", @@ -46,6 +47,7 @@ "react-dev-utils": "9.0.1", "resolve": "1.11.0", "semver": "6.1.1", + "ssh2": "^0.8.6", "webpack": "4.34.0", "webpack-dev-server": "3.2.1" } diff --git a/yarn.lock b/yarn.lock index 6b352503..0c9e967b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2593,7 +2593,7 @@ asn1.js@^4.0.0: inherits "^2.0.1" minimalistic-assert "^1.0.0" -asn1@~0.2.3: +asn1@~0.2.0, asn1@~0.2.3: version "0.2.4" resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== @@ -2778,7 +2778,7 @@ batch@0.6.1: resolved "https://registry.yarnpkg.com/batch/-/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16" integrity sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY= -bcrypt-pbkdf@^1.0.0: +bcrypt-pbkdf@^1.0.0, bcrypt-pbkdf@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= @@ -4637,21 +4637,6 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1 resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -eslint-config-accurapp@./packages/eslint-config-accurapp: - version "4.2.8" - dependencies: - "@babel/core" "7.4.5" - babel-eslint "11.0.0-beta.0" - eslint "5.16.0" - eslint-config-standard "12.0.0" - eslint-plugin-import "2.17.3" - eslint-plugin-no-copy-paste-default-export "0.0.3" - eslint-plugin-node "9.1.0" - eslint-plugin-promise "4.1.1" - eslint-plugin-react "7.13.0" - eslint-plugin-react-hooks "1.6.0" - eslint-plugin-standard "4.0.0" - eslint-config-standard@12.0.0: version "12.0.0" resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-12.0.0.tgz#638b4c65db0bd5a41319f96bba1f15ddad2107d9" @@ -10835,6 +10820,22 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= +ssh2-streams@~0.4.7: + version "0.4.7" + resolved "https://registry.yarnpkg.com/ssh2-streams/-/ssh2-streams-0.4.7.tgz#093b89069de9cf5f06feff0601a5301471b01611" + integrity sha512-JhF8BNfeguOqVHOLhXjzLlRKlUP8roAEhiT/y+NcBQCqpRUupLNrRf2M+549OPNVGx21KgKktug4P3MY/IvTig== + dependencies: + asn1 "~0.2.0" + bcrypt-pbkdf "^1.0.2" + streamsearch "~0.1.2" + +ssh2@^0.8.6: + version "0.8.6" + resolved "https://registry.yarnpkg.com/ssh2/-/ssh2-0.8.6.tgz#dcc62e1d3b9e58a21f711f5186f043e4e792e6da" + integrity sha512-T0cPmEtmtC8WxSupicFDjx3vVUdNXO8xu2a/D5bjt8ixOUCe387AgvxU3mJgEHpu7+Sq1ZYx4d3P2pl/yxMH+w== + dependencies: + ssh2-streams "~0.4.7" + sshpk@^1.7.0: version "1.16.1" resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" @@ -10907,6 +10908,11 @@ stream-shift@^1.0.0: resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952" integrity sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI= +streamsearch@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-0.1.2.tgz#808b9d0e56fc273d809ba57338e929919a1a9f1a" + integrity sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo= + strict-uri-encode@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" From 283f720934778d884aa1ecd63810c43a4f3978d6 Mon Sep 17 00:00:00 2001 From: Luca Mattiazzi Date: Mon, 2 Dec 2019 12:49:22 +0100 Subject: [PATCH 05/15] fix: guess what? same length! --- packages/accurapp-scripts/scripts/start.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/accurapp-scripts/scripts/start.js b/packages/accurapp-scripts/scripts/start.js index 19ad7af4..1966f626 100644 --- a/packages/accurapp-scripts/scripts/start.js +++ b/packages/accurapp-scripts/scripts/start.js @@ -56,7 +56,7 @@ function runDevServer(port) { EXPOSED && tunnelPort(port, generateSubdomain()) .then(url => { - log.info(`App exposed to the interwebs on: ${chalk.cyan(url)}`) + log.info(`Even from far away at: ${chalk.cyan(url)}`) }) .catch(err => { log.err(err) From 390dc1491e42387868260c9ca2e44ff6cfca0338 Mon Sep 17 00:00:00 2001 From: Luca Mattiazzi Date: Fri, 6 Dec 2019 15:00:10 +0100 Subject: [PATCH 06/15] fix: begun fixing merge comments --- README.md | 40 ++++++++--------- .../accurapp-scripts/utils/reverse-tunnel.js | 45 ------------------- .../accurapp-scripts/utils/tunnel-client.js | 44 +++++++++++++++++- 3 files changed, 62 insertions(+), 67 deletions(-) delete mode 100644 packages/accurapp-scripts/utils/reverse-tunnel.js diff --git a/README.md b/README.md index 60ac1889..67f00e0d 100644 --- a/README.md +++ b/README.md @@ -17,32 +17,30 @@ but significant amounts of code were rewritten and simplified. Here are some shi - **JSON5 webpack loader** to import .json5 files. [Read more about JSON5 here](https://json5.org/). ## Table of contents -- [!Accurapp](#accurapp) -- [Table of contents](#table-of-contents) - [Creating a new project](#creating-a-new-project) - - [Setting up github](#setting-up-github) - - [Setting up the automatic deploy](#setting-up-the-automatic-deploy) - - [Commands](#commands) - [Customization](#customization) - - [Customizing Webpack](#customizing-webpack) - - [Customizing Eslint](#customizing-eslint) - - [Customizing Babel](#customizing-babel) - - [Setting Env Variables](#setting-env-variables) - - [Customizing Env Variables](#customizing-env-variables) + - [Customizing Webpack](#customizing-webpack) + - [Customizing Eslint](#customizing-eslint) + - [Customizing Babel](#customizing-babel) + - [Setting Env Variables](#setting-env-variables) + - [Customizing Env Variables](#customizing-env-variables) - [Available Env Variables](#available-env-variables) - [Project Scaffolding](#project-scaffolding) - [F.A.Q.](#faq) -- [Install `react-helmet` and `react-snap`](#install-react-helmet-and-react-snap) -- [Add meta tags for each route in the `render` function](#add-meta-tags-for-each-route-in-the-render-function) -- [Add `react-snap` in `src/index.js`](#add-react-snap-in-srcindexjs) -- [Add `react-snap` to `package.json`](#add-react-snap-to-packagejson) -- [Add the `react-snap` config in `bitbucket-pipelines.yml`](#add-the-react-snap-config-in-bitbucket-pipelinesyml) -- [OK, setup done! Now, how do I check if it is working?](#ok-setup-done-now-how-do-i-check-if-it-is-working) -- [Basic troubleshooting: `react-snap` works properly, but no links are found](#basic-troubleshooting-react-snap-works-properly-but-no-links-are-found) -- [Basic troubleshooting: I get a weird error for 404 pages](#basic-troubleshooting-i-get-a-weird-error-for-404-pages) -- [Basic troubleshooting: There is unknown code in my built index.html. Is it malicious? How do I remove it?](#basic-troubleshooting-there-is-unknown-code-in-my-built-indexhtml-is-it-malicious-how-do-i-remove-it) -- [Further troubleshooting](#further-troubleshooting) -- [What goes in the ``?](#what-goes-in-the-head) + - [How do I enable hot reloading for the state?](#faq) + - [Where do I put the images?](#faq) + - [Where do I put the custom fonts?](#faq) + - [What is the public folder for?](#faq) + - [How do I handle svg files?](#faq) + - [How do I enable TypeScript?](#faq) + - [How do I override a webpack loader?](#faq) + - [What's all the fuss about FUSS?](#faq) + - [How do I enable prettier?](#faq) + - [I need to support IE11. What do I do?](#faq) + - [How do I use a web worker?](#faq) + - [How do I use a service worker?](#faq) + - [I need title and meta tags for each route for SEO. How do I do it?](#faq) + - [I need to build for Electron. How do I do it?](#faq) - [Contributing](#contributing) ## Creating a new project diff --git a/packages/accurapp-scripts/utils/reverse-tunnel.js b/packages/accurapp-scripts/utils/reverse-tunnel.js deleted file mode 100644 index b5b776bc..00000000 --- a/packages/accurapp-scripts/utils/reverse-tunnel.js +++ /dev/null @@ -1,45 +0,0 @@ -const { Socket } = require('net') -const { Client } = require('ssh2') - -function noop() {} - -function createClient(config, onReadyCb = noop, onConnectionCb = noop) { - const conn = new Client() - const errors = [] - - conn.on('ready', () => { - onReadyCb() - conn.forwardIn(config.dstHost, config.dstPort, (err, port) => { - if (err) return errors.push(err) - conn.emit('forward-in', port) - }) - }) - - conn.on('tcp connection', (info, accept, reject) => { - let remote - const srcSocket = new Socket() - - srcSocket.on('error', err => { - errors.push(err) - if (remote === undefined) { - reject() - } else { - remote.end() - } - }) - - srcSocket.connect(config.srcPort, config.srcHost, () => { - remote = accept() - srcSocket.pipe(remote).pipe(srcSocket) - if (errors.length === 0) { - onConnectionCb(null, conn) - } else { - onConnectionCb(errors, null) - } - }) - }) - conn.connect(config) - return conn -} - -module.exports = { createClient } diff --git a/packages/accurapp-scripts/utils/tunnel-client.js b/packages/accurapp-scripts/utils/tunnel-client.js index 7f8bad08..e9222923 100644 --- a/packages/accurapp-scripts/utils/tunnel-client.js +++ b/packages/accurapp-scripts/utils/tunnel-client.js @@ -1,8 +1,50 @@ const os = require('os') +const { Socket } = require('net') const got = require('got') -const { createClient } = require('./reverse-tunnel') +const { Client } = require('ssh2') const { extractCurrentRepo, extractCurrentBranch } = require('../utils/git-utils') +function noop() {} + +function createClient(config, onReadyCb = noop, onConnectionCb = noop) { + const conn = new Client() + const errors = [] + + conn.on('ready', () => { + onReadyCb() + conn.forwardIn(config.dstHost, config.dstPort, (err, port) => { + if (err) return errors.push(err) + conn.emit('forward-in', port) + }) + }) + + conn.on('tcp connection', (info, accept, reject) => { + let remote + const srcSocket = new Socket() + + srcSocket.on('error', err => { + errors.push(err) + if (remote === undefined) { + reject() + } else { + remote.end() + } + }) + + srcSocket.connect(config.srcPort, config.srcHost, () => { + remote = accept() + srcSocket.pipe(remote).pipe(srcSocket) + if (errors.length === 0) { + onConnectionCb(null, conn) + } else { + onConnectionCb(errors, null) + } + }) + }) + conn.connect(config) + return conn +} + const { USER, SSH_AUTH_SOCK, TUNNEL_DOMAIN = 'internal.accurat.io' } = process.env function generateSubdomain() { From 325d4f9f3350cf09b141eca98f5194a0821be7f4 Mon Sep 17 00:00:00 2001 From: Luca Mattiazzi Date: Fri, 6 Dec 2019 17:20:57 +0100 Subject: [PATCH 07/15] fix: using library to open tunnel --- packages/accurapp-scripts/package.json | 2 +- packages/accurapp-scripts/scripts/start.js | 20 +- packages/accurapp-scripts/utils/git-utils.js | 12 +- .../accurapp-scripts/utils/tunnel-client.js | 86 ------ .../accurapp-scripts/utils/tunnel-utils.js | 12 + yarn.lock | 282 +++++++++++++++++- 6 files changed, 306 insertions(+), 108 deletions(-) delete mode 100644 packages/accurapp-scripts/utils/tunnel-client.js create mode 100644 packages/accurapp-scripts/utils/tunnel-utils.js diff --git a/packages/accurapp-scripts/package.json b/packages/accurapp-scripts/package.json index 34771816..1628849d 100644 --- a/packages/accurapp-scripts/package.json +++ b/packages/accurapp-scripts/package.json @@ -35,7 +35,6 @@ "filesize": "4.1.2", "fs-extra": "8.0.1", "globby": "9.2.0", - "got": "^9.6.0", "gzip-size": "5.1.1", "indent-string": "4.0.0", "latest-version": "5.1.0", @@ -47,6 +46,7 @@ "react-dev-utils": "9.0.1", "resolve": "1.11.0", "semver": "6.1.1", + "ssh-tuna": "^1.0.0", "ssh2": "^0.8.6", "webpack": "4.34.0", "webpack-dev-server": "3.2.1" diff --git a/packages/accurapp-scripts/scripts/start.js b/packages/accurapp-scripts/scripts/start.js index 1966f626..a3ca589f 100644 --- a/packages/accurapp-scripts/scripts/start.js +++ b/packages/accurapp-scripts/scripts/start.js @@ -9,8 +9,9 @@ const detect = require('detect-port') const WebpackDevServer = require('webpack-dev-server') const openOrRefreshBrowser = require('react-dev-utils/openBrowser') const { prepareUrls } = require('react-dev-utils/WebpackDevServerUtils') +const { tunnelPort } = require('ssh-tuna') const { log, coloredBanner } = require('../utils/logging-utils') -const { tunnelPort, generateSubdomain } = require('../utils/tunnel-client') +const { generateSubdomain } = require('../utils/tunnel-utils') const { createWebpackCompiler, readWebpackConfig } = require('../utils/webpack-utils') const { verifyTypeScriptSetup } = require('../utils/verifyTypeScriptSetup') const { @@ -28,6 +29,8 @@ process.env.LATEST_TAG = extractLatestTag() const HOST = process.env.HOST || '0.0.0.0' const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 8000 const PROTOCOL = process.env.HTTPS === 'true' ? 'https' : 'http' +const TUNNEL_DOMAIN = process.env.TUNNEL_DOMAIN || 'internal.accurat.io' +const TUNNEL_SSH_PORT = process.env.TUNNEL_SSH_PORT || 2222 const EXPOSED = process.argv.includes('--exposed') const appDir = process.cwd() @@ -38,6 +41,10 @@ function runDevServer(port) { const compiler = createWebpackCompiler(() => { log.info(`The app is running at: ${chalk.cyan(urls.localUrlForTerminal)}`) log.info(`Or on your network at: ${chalk.cyan(urls.lanUrlForTerminal)}`) + if (!EXPOSED) return + tunnelPort(port, generateSubdomain(), TUNNEL_DOMAIN, TUNNEL_SSH_PORT) + .then(url => log.info(`Even from far away at: ${chalk.cyan(url)}`)) + .catch(err => log.err(err)) }) const devServerConfig = { @@ -53,15 +60,6 @@ function runDevServer(port) { openOrRefreshBrowser(urls.localUrlForBrowser) }) - EXPOSED && - tunnelPort(port, generateSubdomain()) - .then(url => { - log.info(`Even from far away at: ${chalk.cyan(url)}`) - }) - .catch(err => { - log.err(err) - }) - const shutDownServer = () => { devServer.close() process.exit() @@ -74,7 +72,7 @@ console.log(coloredBanner('/||||/| accurapp')) detect(DEFAULT_PORT) .then(port => { - if (!port === DEFAULT_PORT) { + if (port !== DEFAULT_PORT) { log.ok( `Something is already running on port ${DEFAULT_PORT}, switching to ${chalk.blue(port)}...` ) diff --git a/packages/accurapp-scripts/utils/git-utils.js b/packages/accurapp-scripts/utils/git-utils.js index a43402cd..389c6edc 100644 --- a/packages/accurapp-scripts/utils/git-utils.js +++ b/packages/accurapp-scripts/utils/git-utils.js @@ -38,16 +38,20 @@ function extractLatestTag() { function extractCurrentBranch() { try { - return cp.execSync('git rev-parse --abbrev-ref HEAD') + return cp.execSync('git rev-parse --abbrev-ref HEAD').trim() } catch (e) { // Probably git is not available, return an empty string instead return '' } } -function extractCurrentRepo() { +function extractRepoName() { try { - return cp.execSync('basename -s .git `git config --get remote.origin.url`') + return cp + .execSync('basename -s .git `git config --get remote.origin.url`', { + stdio: ['pipe', 'pipe', 'ignore'], + }) + .trim() } catch (e) { // Probably git is not available, return an empty string instead return '' @@ -60,5 +64,5 @@ module.exports = { extractLatestCommitTimestamp, extractLatestTag, extractCurrentBranch, - extractCurrentRepo, + extractRepoName, } diff --git a/packages/accurapp-scripts/utils/tunnel-client.js b/packages/accurapp-scripts/utils/tunnel-client.js deleted file mode 100644 index e9222923..00000000 --- a/packages/accurapp-scripts/utils/tunnel-client.js +++ /dev/null @@ -1,86 +0,0 @@ -const os = require('os') -const { Socket } = require('net') -const got = require('got') -const { Client } = require('ssh2') -const { extractCurrentRepo, extractCurrentBranch } = require('../utils/git-utils') - -function noop() {} - -function createClient(config, onReadyCb = noop, onConnectionCb = noop) { - const conn = new Client() - const errors = [] - - conn.on('ready', () => { - onReadyCb() - conn.forwardIn(config.dstHost, config.dstPort, (err, port) => { - if (err) return errors.push(err) - conn.emit('forward-in', port) - }) - }) - - conn.on('tcp connection', (info, accept, reject) => { - let remote - const srcSocket = new Socket() - - srcSocket.on('error', err => { - errors.push(err) - if (remote === undefined) { - reject() - } else { - remote.end() - } - }) - - srcSocket.connect(config.srcPort, config.srcHost, () => { - remote = accept() - srcSocket.pipe(remote).pipe(srcSocket) - if (errors.length === 0) { - onConnectionCb(null, conn) - } else { - onConnectionCb(errors, null) - } - }) - }) - conn.connect(config) - return conn -} - -const { USER, SSH_AUTH_SOCK, TUNNEL_DOMAIN = 'internal.accurat.io' } = process.env - -function generateSubdomain() { - const repo = extractCurrentRepo() - const branch = extractCurrentBranch() - if (!repo) return os.hostname() - if (branch === 'master') return repo.trim() - return `${branch.trim()}.${repo.trim()}` -} - -function tunnelPort(localPort, subdomain) { - return got - .post(`https://${TUNNEL_DOMAIN}?subdomain=${subdomain}`, { json: true }) - .then(res => { - const { port, error } = res.body - if (error) throw error - return port - }) - .then(dstPort => { - return new Promise((resolve, reject) => { - return createClient( - { - host: TUNNEL_DOMAIN, - port: 2222, - dstHost: 'localhost', - dstPort: dstPort, - srcHost: 'localhost', - srcPort: localPort, - keepAlive: true, - agent: SSH_AUTH_SOCK, - username: USER, - }, - () => resolve(`https://${subdomain}.${TUNNEL_DOMAIN}`) - ) - }) - }) -} - -module.exports = { tunnelPort, generateSubdomain } diff --git a/packages/accurapp-scripts/utils/tunnel-utils.js b/packages/accurapp-scripts/utils/tunnel-utils.js new file mode 100644 index 00000000..28665e5c --- /dev/null +++ b/packages/accurapp-scripts/utils/tunnel-utils.js @@ -0,0 +1,12 @@ +const os = require('os') +const { extractRepoName, extractCurrentBranch } = require('../utils/git-utils') + +function generateSubdomain() { + const repo = extractRepoName() + const branch = extractCurrentBranch() + if (!repo) return os.hostname() + if (branch === 'master') return repo + return `${branch}.${repo}` +} + +module.exports = { generateSubdomain } diff --git a/yarn.lock b/yarn.lock index 0c9e967b..f2f9efa9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1917,6 +1917,16 @@ dependencies: "@types/node" ">= 8" +"@root/mkdirp@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@root/mkdirp/-/mkdirp-1.0.0.tgz#f200e29568d711d3357151af0d2648e7eaf21b6f" + integrity sha512-hxGAYUx5029VggfG+U9naAhQkoMSXtOeXtbql97m3Hi6/sQSRL/4khKZPyOF6w11glyCOU38WCNLu9nUcSjOfA== + +"@root/request@^1.3.11": + version "1.4.2" + resolved "https://registry.yarnpkg.com/@root/request/-/request-1.4.2.tgz#a51e93c64eb8b9b0df06f34677e63d8239c4311c" + integrity sha512-J8FM4+SJuc7WRC+Jz17m+VT2lgI7HtatHhxN1F2ck5aIKUAxJEaR4u/gLBsgT60mVHevKCjKN0O8115UtJjwLw== + "@sindresorhus/is@^0.14.0": version "0.14.0" resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" @@ -2304,6 +2314,26 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7: mime-types "~2.1.24" negotiator "0.6.2" +acme-dns-01-cli@^3.0.0: + version "3.0.7" + resolved "https://registry.yarnpkg.com/acme-dns-01-cli/-/acme-dns-01-cli-3.0.7.tgz#cd5d0e3d455eba88db3a9e8e955aa8f8e48ebbc5" + integrity sha512-Aa4bUpq6ftX1VODiShOetOY5U0tsXY5EV7+fQwme3Q8Y9rjYBArBXHgFCAVKtK1AF+Ev8pIuF6Z42hzMFa73/w== + +acme-v2@^1.8.6: + version "1.8.6" + resolved "https://registry.yarnpkg.com/acme-v2/-/acme-v2-1.8.6.tgz#6ace9de394beb6d0c170388f2ec0dea8e8e591f6" + integrity sha512-LWdicUYHTGDtYX7LlgsQurmM9txwfAFydg7mQLPKHrFMnNNtfJEtHC2fWfr+pFGNb3XKIbvyFUoyFB6cOmWRpA== + dependencies: + "@root/request" "^1.3.11" + rsa-compat "^2.0.8" + +acme@^1.3.5: + version "1.3.5" + resolved "https://registry.yarnpkg.com/acme/-/acme-1.3.5.tgz#f0bd98475c3ec6be0a3f4dd9eec5623257079ccf" + integrity sha512-KIFVyMho7y3RxRSTzkuX031TmfXwzl0ioy8+r2pnfLz6YWFQ5q7a/cYUDTgIbrFMPe/syY26Qv1DOdHQ5ARWcw== + dependencies: + acme-v2 "^1.8.6" + acorn-dynamic-import@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz#482210140582a36b83c3e342e1cfebcaa9240948" @@ -2800,6 +2830,18 @@ binary-extensions@^1.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" integrity sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw== +bindings@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" + integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== + dependencies: + file-uri-to-path "1.0.0" + +bluebird@^2.9.24: + version "2.11.0" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-2.11.0.tgz#534b9033c022c9579c56ba3b3e5a5caafbb650e1" + integrity sha1-U0uQM8AiyVecVro7Plpcqvu2UOE= + bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5: version "3.7.2" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" @@ -3016,6 +3058,16 @@ builtins@^1.0.3: resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88" integrity sha1-y5T662HIaWRR2zZTThQi+U8K7og= +bunyan@^1.8.1: + version "1.8.12" + resolved "https://registry.yarnpkg.com/bunyan/-/bunyan-1.8.12.tgz#f150f0f6748abdd72aeae84f04403be2ef113797" + integrity sha1-8VDw9nSKvdcq6uhPBEA74u8RN5c= + optionalDependencies: + dtrace-provider "~0.8" + moment "^2.10.6" + mv "~2" + safe-json-stringify "~1" + byline@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/byline/-/byline-5.0.0.tgz#741c5216468eadc457b03410118ad77de8c1ddb1" @@ -3211,6 +3263,11 @@ caseless@~0.12.0: resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= +cert-info@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/cert-info/-/cert-info-1.5.1.tgz#90078c9ea2d18abaa8a4ed9068a46320ecf0d519" + integrity sha512-eoQC/yAgW3gKTKxjzyClvi+UzuY97YCjcl+lSqbsGIy7HeGaWxCPOQFivhUYm27hgsBMhsJJFya3kGvK6PMIcQ== + chalk@2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba" @@ -4067,6 +4124,14 @@ dateformat@^3.0.0: resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== +deasync@^0.1.13: + version "0.1.16" + resolved "https://registry.yarnpkg.com/deasync/-/deasync-0.1.16.tgz#44195eb4330fc9fc487f31ec614cbbdd57633897" + integrity sha512-FNCjDwxGbhK+Ye8fmE3p2ahIjERhkbuwX+WVGZPtSbAh9LfE1Saa2p0l+f0t11sIlk9D8W+Bym+cDp6r5yghAQ== + dependencies: + bindings "^1.5.0" + node-addon-api "^1.7.1" + debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" @@ -4376,6 +4441,15 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" +dolphin@*: + version "0.1.14" + resolved "https://registry.yarnpkg.com/dolphin/-/dolphin-0.1.14.tgz#a545ae22762c0bc9ab9b818d9b4eff8bff28bf3e" + integrity sha1-pUWuInYsC8mrm4GNm07/i/8ovz4= + dependencies: + bluebird "^2.9.24" + lodash "^4.15.0" + request "^2.65.0" + dom-converter@^0.2: version "0.2.0" resolved "https://registry.yarnpkg.com/dom-converter/-/dom-converter-0.2.0.tgz#6721a9daee2e293682955b6afe416771627bb768" @@ -4467,6 +4541,18 @@ dotenv@^6.2.0: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064" integrity sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w== +dotenv@^8.2.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a" + integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw== + +dtrace-provider@~0.8: + version "0.8.8" + resolved "https://registry.yarnpkg.com/dtrace-provider/-/dtrace-provider-0.8.8.tgz#2996d5490c37e1347be263b423ed7b297fb0d97e" + integrity sha512-b7Z7cNtHPhH9EJhNNbbeqTcXB8LGFFZhq1PGgEvpeHlzd36bhbdTWoE/Ba/YguqpBSlAPKnARWhVlhunCMwfxg== + dependencies: + nan "^2.14.0" + duplexer3@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" @@ -4495,6 +4581,11 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" +eckles@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/eckles/-/eckles-1.4.1.tgz#5e97fefa8554a7af594070c461e6b25fe3819382" + integrity sha512-auWyk/k8oSkVHaD4RxkPadKsLUcIwKgr/h8F7UZEueFDBO7BsE4y+H6IMUDbfqKIFPg/9MxV6KcBdJCmVVcxSA== + ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -5189,6 +5280,11 @@ file-loader@^2.0.0: loader-utils "^1.0.2" schema-utils "^1.0.0" +file-uri-to-path@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" + integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== + filesize@3.6.1: version "3.6.1" resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.6.1.tgz#090bb3ee01b6f801a8a8be99d31710b3422bb317" @@ -5606,6 +5702,17 @@ glob-to-regexp@^0.4.0: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== +glob@^6.0.1: + version "6.0.4" + resolved "https://registry.yarnpkg.com/glob/-/glob-6.0.4.tgz#0f08860f6a155127b2fadd4f9ce24b1aab6e4d22" + integrity sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI= + dependencies: + inflight "^1.0.4" + inherits "2" + minimatch "2 || 3" + once "^1.3.0" + path-is-absolute "^1.0.0" + glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" @@ -5834,6 +5941,30 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.3 resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== +greenlock-store-fs@^3.0.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/greenlock-store-fs/-/greenlock-store-fs-3.2.2.tgz#e404d3cc1fbaf88dec6914ea2c10d4b31256faa2" + integrity sha512-92ejLB4DyV4qv/2b6VLGF2nKfYQeIfg3o+e/1cIoYLjlIaUFdbBXkzLTRozFlHsQPZt2ALi5qYrpC9IwH7GK8A== + dependencies: + "@root/mkdirp" "^1.0.0" + safe-replace "^1.1.0" + +greenlock@^2.6.7: + version "2.8.8" + resolved "https://registry.yarnpkg.com/greenlock/-/greenlock-2.8.8.tgz#d4fafc8560b8c2bf7f8320b1d184881fb3cd41a1" + integrity sha512-U2pqxXXf0naeZc2363Xe174C6/T9lXGZYQjXBqa/PMb1CYRQuHwXlAqFEUu75JkxyHAzFGj/uliqSyQwIc91Yg== + dependencies: + acme "^1.3.5" + acme-dns-01-cli "^3.0.0" + acme-v2 "^1.8.6" + cert-info "^1.5.1" + greenlock-store-fs "^3.0.2" + keypairs "^1.2.14" + le-challenge-fs "^2.0.2" + le-sni-auto "^2.1.9" + le-store-certbot "^2.2.3" + rsa-compat "^2.0.8" + gzip-size@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-5.0.0.tgz#a55ecd99222f4c48fd8c01c625ce3b349d0a0e80" @@ -6970,6 +7101,14 @@ jsx-ast-utils@^2.1.0: array-includes "^3.0.3" object.assign "^4.1.0" +keypairs@^1.2.14: + version "1.2.14" + resolved "https://registry.yarnpkg.com/keypairs/-/keypairs-1.2.14.tgz#c971e8d03ae2d048fc6879117e0509bae6543887" + integrity sha512-ZoZfZMygyB0QcjSlz7Rh6wT2CJasYEHBPETtmHZEfxuJd7bnsOG5AdtPZqHZBT+hoHvuWCp/4y8VmvTvH0Y9uA== + dependencies: + eckles "^1.4.1" + rasha "^1.2.4" + keyv@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/keyv/-/keyv-3.1.0.tgz#ecc228486f69991e49e9476485a5be1e8fc5c4d9" @@ -7044,6 +7183,27 @@ lcid@^2.0.0: dependencies: invert-kv "^2.0.0" +le-challenge-fs@^2.0.2, le-challenge-fs@^2.0.8: + version "2.0.9" + resolved "https://registry.yarnpkg.com/le-challenge-fs/-/le-challenge-fs-2.0.9.tgz#0431fd6ad75543c03ec9a55257d861279f9f332b" + integrity sha512-stzI6rxd+aXGxBl87QJKKY/i/wl3uz6EoWzX2xSazJvCPSYBQys1RVNgOcf0SfUQPh6TBCFJFSJkiR4mznb4sg== + dependencies: + "@root/mkdirp" "^1.0.0" + +le-sni-auto@^2.1.9: + version "2.1.9" + resolved "https://registry.yarnpkg.com/le-sni-auto/-/le-sni-auto-2.1.9.tgz#0e394079113511129b9ae24afbb180df2c188584" + integrity sha512-QmQHNwQDi/56GY8+qczFZ06FZbxaeJQjbjEhwwQHhkJ9IHhIQFkPfCT/OyDfLj4gqLIrg5ZX8CemxxVZnLEYfg== + +le-store-certbot@^2.2.1, le-store-certbot@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/le-store-certbot/-/le-store-certbot-2.2.3.tgz#72eee5c86a1753a3cde0871f462c07a16eb95b62" + integrity sha512-c4ACR+v+JKMiAOOshLh6gdCKA7wIWR16+mROMLpQjq3rXJ3Vm8FaBHe2H+crT+flP+g7FmciAwUlfOJEJpIuCQ== + dependencies: + "@root/mkdirp" "^1.0.0" + pyconf "^1.1.7" + safe-replace "^1.1.0" + lerna@3.13.1: version "3.13.1" resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.13.1.tgz#feaff562176f304bd82329ca29ce46ab6c033463" @@ -7251,7 +7411,7 @@ lodash@4.17.14: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba" integrity sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw== -lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0: +lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== @@ -7642,7 +7802,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= -minimatch@3.0.4, minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4: +"minimatch@2 || 3", minimatch@3.0.4, minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -7731,6 +7891,11 @@ modify-values@^1.0.0: resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== +moment@^2.10.6: + version "2.24.0" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" + integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg== + move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" @@ -7796,7 +7961,16 @@ mute-stream@~0.0.4: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== -nan@^2.12.1: +mv@~2: + version "2.1.1" + resolved "https://registry.yarnpkg.com/mv/-/mv-2.1.1.tgz#ae6ce0d6f6d5e0a4f7d893798d03c1ea9559b6a2" + integrity sha1-rmzg1vbV4KT32JN5jQPB6pVZtqI= + dependencies: + mkdirp "~0.5.1" + ncp "~2.0.0" + rimraf "~2.4.0" + +nan@^2.12.1, nan@^2.14.0: version "2.14.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== @@ -7823,6 +7997,11 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= +ncp@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ncp/-/ncp-2.0.0.tgz#195a21d6c46e361d2fb1281ba38b91e9df7bdbb3" + integrity sha1-GVoh1sRuNh0vsSgbo4uR6d9727M= + needle@^2.2.1: version "2.4.0" resolved "https://registry.yarnpkg.com/needle/-/needle-2.4.0.tgz#6833e74975c444642590e15a750288c5f939b57c" @@ -7854,6 +8033,21 @@ no-case@^2.2.0: dependencies: lower-case "^1.1.1" +node-addon-api@^1.7.1: + version "1.7.1" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-1.7.1.tgz#cf813cd69bb8d9100f6bdca6755fc268f54ac492" + integrity sha512-2+DuKodWvwRTrCfKOeR24KIc5unKjOh8mz17NCzVnHWfjAdDqbfbjqh7gUT+BkXBRQM52+xCHciKWonJ3CbJMQ== + +node-etcd@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/node-etcd/-/node-etcd-7.0.0.tgz#87416d56d44104049822ca242e47d01728a34ed3" + integrity sha512-kGnYVoxdDuUU2ojCt0GnZhR2wMRZWyJvq0OsWX+adExUbiX0z7D+8//nlv9Gnve1dIvNEQ/mvM+72aSKnWVp5Q== + dependencies: + deasync "^0.1.13" + lodash "^4.17.10" + request "^2.87.0" + url-parse "^1.4.3" + node-fetch-npm@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/node-fetch-npm/-/node-fetch-npm-2.0.2.tgz#7258c9046182dca345b4208eda918daf33697ff7" @@ -7863,7 +8057,7 @@ node-fetch-npm@^2.0.2: json-parse-better-errors "^1.0.0" safe-buffer "^5.1.1" -node-fetch@^2.3.0: +node-fetch@^2.3.0, node-fetch@^2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== @@ -8128,7 +8322,7 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" -object-hash@^1.1.4: +object-hash@^1.1.4, object-hash@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-1.3.1.tgz#fde452098a951cb145f039bb7d455449ddc126df" integrity sha512-OSuu/pU4ENM9kmREg0BdNrUDIl1heYa4mBZacJc+vVWz4GtAwu7jO8s4AIt2aGRUTqxykpWzI3Oqnsm13tTMDA== @@ -9660,6 +9854,13 @@ punycode@^2.1.0: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== +pyconf@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/pyconf/-/pyconf-1.1.7.tgz#d48c3a8e10a050e304d0728b2e39803691829e7d" + integrity sha512-v4clh33m68sjtMsh8XMpjhGWb/MQODAYZ1y7ORG5Qv58UK25OddoB+oXyexgDkK8ttFui/lZm2sQDgA2Ftjfkw== + dependencies: + safe-replace "^1.0.2" + q@^1.1.2, q@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" @@ -9723,6 +9924,11 @@ range-parser@^1.2.1, range-parser@~1.2.1: resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== +rasha@^1.2.4: + version "1.2.5" + resolved "https://registry.yarnpkg.com/rasha/-/rasha-1.2.5.tgz#72668da31dcc68ac277c5b73d610e087cd33b031" + integrity sha512-KxtX+/fBk+wM7O3CNgwjSh5elwFilLvqWajhr6wFr2Hd63JnKTTi43Tw+Jb1hxJQWOwoya+NZWR2xztn3hCrTw== + raw-body@2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.4.0.tgz#a1ce6fb9c9bc356ca52e89256ab59059e13d0332" @@ -9946,6 +10152,26 @@ recursive-readdir@2.2.2: dependencies: minimatch "3.0.4" +redbird@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/redbird/-/redbird-0.9.1.tgz#62948183c43b20d6035f38523a3956db3dc50049" + integrity sha512-JIUFEHp4edCj58Z53+J2JUwdNHbaTKPgkDVeW0z87rw4IwYCVOWH4y5bOdi9Gi/t5nkvY+uuxUfSx4/jCoVN1Q== + dependencies: + bluebird "^3.5.3" + bunyan "^1.8.1" + dolphin "*" + greenlock "^2.6.7" + http-proxy "^1.17.0" + le-challenge-fs "^2.0.8" + le-store-certbot "^2.2.1" + lodash "^4.17.11" + lru-cache "^5.1.1" + node-etcd "^7.0.0" + object-hash "^1.3.1" + safetimeout "^0.1.2" + spdy "^4.0.0" + valid-url "^1.0.9" + redent@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" @@ -10119,7 +10345,7 @@ repeating@^2.0.0: dependencies: is-finite "^1.0.0" -request@^2.87.0: +request@^2.65.0, request@^2.87.0: version "2.88.0" resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== @@ -10295,6 +10521,13 @@ rimraf@2.6.3, rimraf@~2.6.2: dependencies: glob "^7.1.3" +rimraf@~2.4.0: + version "2.4.5" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.4.5.tgz#ee710ce5d93a8fdb856fb5ea8ff0e2d75934b2da" + integrity sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto= + dependencies: + glob "^6.0.1" + ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" @@ -10303,6 +10536,13 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" +rsa-compat@^2.0.8: + version "2.0.8" + resolved "https://registry.yarnpkg.com/rsa-compat/-/rsa-compat-2.0.8.tgz#14ae5a8b3b05e15dea5aa5b23c2ed2084c20d8de" + integrity sha512-BFiiSEbuxzsVdaxpejbxfX07qs+rtous49Y6mL/zw6YHh9cranDvm2BvBmqT3rso84IsxNlP5BXnuNvm1Wn3Tw== + dependencies: + keypairs "^1.2.14" + run-async@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" @@ -10358,6 +10598,11 @@ safe-buffer@>=5.1.0, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== +safe-json-stringify@~1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/safe-json-stringify/-/safe-json-stringify-1.2.0.tgz#356e44bc98f1f93ce45df14bcd7c01cda86e0afd" + integrity sha512-gH8eh2nZudPQO6TytOvbxnuhYBOvDBBLW52tz5q6X58lJcd/tkmqFR+5Z9adS8aJtURSXWThWy/xJtJwixErvg== + safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" @@ -10365,11 +10610,21 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" +safe-replace@^1.0.2, safe-replace@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-replace/-/safe-replace-1.1.0.tgz#432821b5a8139a38b534678d712f0850fe3e5235" + integrity sha512-9/V2E0CDsKs9DWOOwJH7jYpSl9S3N05uyevNjvsnDauBqRowBPOyot1fIvV5N2IuZAbYyvrTXrYFVG0RZInfFw== + "safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== +safetimeout@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/safetimeout/-/safetimeout-0.1.2.tgz#d285e3a9fd8dd6d9bab546e255795d6aadd3cd74" + integrity sha512-aSHXtzSwpO82gYr7zbDqBv8MFxT+X7d3FJEGXrZJwgZeyu8u7EHrTJcGmPeCEvvCPZDTdPwpvPtaq6qG0DzCoA== + sax@^1.2.4, sax@~1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" @@ -10820,6 +11075,16 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= +ssh-tuna@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/ssh-tuna/-/ssh-tuna-1.0.0.tgz#26f910825f94337a3b3985e795a68d0babc27337" + integrity sha512-53oZIdz26jE61L4jExM2fvQZOPhjMOvFf6h5KzuzaNuOr4wt/Ydbl8UK2IUE4JzG/e7e1RsbLic41OaJH/o0Gw== + dependencies: + dotenv "^8.2.0" + node-fetch "^2.6.0" + redbird "^0.9.1" + ssh2 "^0.8.6" + ssh2-streams@~0.4.7: version "0.4.7" resolved "https://registry.yarnpkg.com/ssh2-streams/-/ssh2-streams-0.4.7.tgz#093b89069de9cf5f06feff0601a5301471b01611" @@ -11679,6 +11944,11 @@ uuid@^3.0.1, uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== +valid-url@^1.0.9: + version "1.0.9" + resolved "https://registry.yarnpkg.com/valid-url/-/valid-url-1.0.9.tgz#1c14479b40f1397a75782f115e4086447433a200" + integrity sha1-HBRHm0DxOXp1eC8RXkCGRHQzogA= + validate-npm-package-license@^3.0.1, validate-npm-package-license@^3.0.3: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" From c50bbccc8f386794f29938d38644984c39a04b10 Mon Sep 17 00:00:00 2001 From: Luca Mattiazzi Date: Fri, 6 Dec 2019 17:32:16 +0100 Subject: [PATCH 08/15] fix: better git utils --- packages/accurapp-scripts/utils/git-utils.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/accurapp-scripts/utils/git-utils.js b/packages/accurapp-scripts/utils/git-utils.js index 389c6edc..acac47ea 100644 --- a/packages/accurapp-scripts/utils/git-utils.js +++ b/packages/accurapp-scripts/utils/git-utils.js @@ -38,7 +38,10 @@ function extractLatestTag() { function extractCurrentBranch() { try { - return cp.execSync('git rev-parse --abbrev-ref HEAD').trim() + return cp + .execSync('git rev-parse --abbrev-ref HEAD') + .toString() + .trim() } catch (e) { // Probably git is not available, return an empty string instead return '' @@ -51,6 +54,7 @@ function extractRepoName() { .execSync('basename -s .git `git config --get remote.origin.url`', { stdio: ['pipe', 'pipe', 'ignore'], }) + .toString() .trim() } catch (e) { // Probably git is not available, return an empty string instead From 85e7c1bb8fa24beffbc50b0ddd2ca5cba521fbd3 Mon Sep 17 00:00:00 2001 From: Luca Mattiazzi Date: Fri, 6 Dec 2019 17:40:35 +0100 Subject: [PATCH 09/15] fix: corrected logger --- packages/accurapp-scripts/scripts/start.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/accurapp-scripts/scripts/start.js b/packages/accurapp-scripts/scripts/start.js index a3ca589f..b410dc9d 100644 --- a/packages/accurapp-scripts/scripts/start.js +++ b/packages/accurapp-scripts/scripts/start.js @@ -42,8 +42,12 @@ function runDevServer(port) { log.info(`The app is running at: ${chalk.cyan(urls.localUrlForTerminal)}`) log.info(`Or on your network at: ${chalk.cyan(urls.lanUrlForTerminal)}`) if (!EXPOSED) return - tunnelPort(port, generateSubdomain(), TUNNEL_DOMAIN, TUNNEL_SSH_PORT) - .then(url => log.info(`Even from far away at: ${chalk.cyan(url)}`)) + const subdomain = generateSubdomain() + tunnelPort(port, subdomain, TUNNEL_DOMAIN, TUNNEL_SSH_PORT) + .then(client => { + const url = `https://${subdomain}.${TUNNEL_DOMAIN}` + log.info(`Even from far away at: ${chalk.cyan(url)}`) + }) .catch(err => log.err(err)) }) From 72599754a3c9f77a31bd446e4178b71666046e25 Mon Sep 17 00:00:00 2001 From: Luca Mattiazzi Date: Fri, 6 Dec 2019 17:42:21 +0100 Subject: [PATCH 10/15] fix: new step in test --- test/e2e.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/e2e.sh b/test/e2e.sh index 91ad4633..977e13fe 100755 --- a/test/e2e.sh +++ b/test/e2e.sh @@ -32,6 +32,12 @@ PID=$! sleep 20s kill $PID +# Test the start with typescript and exposing to the internet +BROWSER=false yarn start --exposed & +PID=$! +sleep 20s +kill $PID + # Test the build with typescript yarn build From d5d12f27e6eef864665178c27b954cf0e4dcf99b Mon Sep 17 00:00:00 2001 From: Luca Mattiazzi Date: Fri, 6 Dec 2019 18:12:27 +0100 Subject: [PATCH 11/15] fix: removed unused library --- packages/accurapp-scripts/package.json | 1 - yarn.lock | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/accurapp-scripts/package.json b/packages/accurapp-scripts/package.json index 1628849d..978dd5a4 100644 --- a/packages/accurapp-scripts/package.json +++ b/packages/accurapp-scripts/package.json @@ -47,7 +47,6 @@ "resolve": "1.11.0", "semver": "6.1.1", "ssh-tuna": "^1.0.0", - "ssh2": "^0.8.6", "webpack": "4.34.0", "webpack-dev-server": "3.2.1" } diff --git a/yarn.lock b/yarn.lock index f2f9efa9..dec51a80 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4728,6 +4728,21 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1 resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= +eslint-config-accurapp@./packages/eslint-config-accurapp: + version "4.2.8" + dependencies: + "@babel/core" "7.4.5" + babel-eslint "11.0.0-beta.0" + eslint "5.16.0" + eslint-config-standard "12.0.0" + eslint-plugin-import "2.17.3" + eslint-plugin-no-copy-paste-default-export "0.0.3" + eslint-plugin-node "9.1.0" + eslint-plugin-promise "4.1.1" + eslint-plugin-react "7.13.0" + eslint-plugin-react-hooks "1.6.0" + eslint-plugin-standard "4.0.0" + eslint-config-standard@12.0.0: version "12.0.0" resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-12.0.0.tgz#638b4c65db0bd5a41319f96bba1f15ddad2107d9" From b21b080d199a8f3dc3ffb24597b7a1dac6800b32 Mon Sep 17 00:00:00 2001 From: Marco Fugaro Date: Mon, 9 Dec 2019 15:04:54 +0100 Subject: [PATCH 12/15] =?UTF-8?q?chore:=20=F0=9F=93=96=20Update=20README?= =?UTF-8?q?=20for=20--exposed=20flag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 67f00e0d..ed3cbc02 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ Then you just `cd project-name`, run `yarn start` and start creating awesome stu #### Commands These are the available commands once you created a project: - `yarn start` starts a server locally, accessible both from your browser and from another machine using your same wi-fi +- `yarn start --exposed` starts a server locally and exposes it to the internet, accessible from everyone having the link, kinda like ngrok. The link created looks like `{branch}.{repo}.internal.accurat.io` if you're in a branch, or `{repo}.internal.accurat.io` if you're on master. It uses a server with an instance of [SSH-Tuna](https://github.com/accurat/ssh-tuna) to achieve this. - `yarn build` builds the project for production, ready to be deployed from the `build/` folder - `yarn lint` lints with eslint the `src/` folder. You can pass any [eslint options](https://eslint.org/docs/user-guide/command-line-interface#options) to the lint command, for example if you want to use eslint's fix option, you do it like this: ```json @@ -242,6 +243,8 @@ render() { - **WATCH_NODE_MODULES** - Set this to true if you want to recompile when any of the used `node_modules` changes (default `false`) +- **TUNNEL_DOMAIN** - The domain that the command `yarn start --exposed` will use as a request tunnel, it must be the domain of a server with an instance of [SSH-Tuna](https://github.com/accurat/ssh-tuna) on it (default `internal.accurat.io`) + ## Available Env Variables These are the Env Variables that Accurapp provides you, you cannot modify them directly: - **NODE_ENV** - It is equal to `'development'` in the `yarn start` command and `'production'` in the `yarn build` command @@ -735,22 +738,6 @@ Please, see [`@joshbuchea`'s head repo](https://gethead.info/). [This guide](https://gist.github.com/matthewjberger/6f42452cb1a2253667942d333ff53404) is a good one to follow, and [here is a working example](https://github.com/nkint/accurapp-electron) of accurapp with electron. Good luck! -
-Someone else needs to see what I'm working on, how can I show it? - -When running `yarn start` you can add `--exposed` as a flag. - -The webpack server will try allocate a subdomain on a remote server and open an ssh reverse tunnel in order to receive every request that the remote will receive on that domain. As soon as the subdomain is allocated, the remote server will also generate a valid https certificate. - -The remote domain is set as the env variable `TUNNEL_DOMAIN` and defaults to `internal.accurat.io`, but can be set to whatever server is running an instance of the [SSH-Tuna server infrastucture](https://github.com/accurat/ssh-tuna) - -The allocated domain will have the following structure: -- If the script is running from inside a git project and is on a branch different than master: `{branch}.{repo}.{TUNNEL_DOMAIN}` -- If the script is running from inside a git project and is on master: `{repo}.{TUNNEL_DOMAIN}` -- If the script is running from outside a git project: `{hostname}.{TUNNEL_DOMAIN}` - -
- ## Contributing If you make some edits and wish to test them locally you can run `yarn test` for an end-to-end test, or `yarn create-test-app` which creates a test app using the local packages. From 37296c3a9ff30664ce5f3575d86005114a0d002d Mon Sep 17 00:00:00 2001 From: Luca Mattiazzi Date: Mon, 9 Dec 2019 15:45:24 +0100 Subject: [PATCH 13/15] fix: updated test, updated ssh-tuna version --- packages/accurapp-scripts/package.json | 2 +- packages/accurapp-scripts/scripts/start.js | 2 ++ test/e2e.sh | 6 ++++++ yarn.lock | 23 ++++------------------ 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/packages/accurapp-scripts/package.json b/packages/accurapp-scripts/package.json index 978dd5a4..28073922 100644 --- a/packages/accurapp-scripts/package.json +++ b/packages/accurapp-scripts/package.json @@ -46,7 +46,7 @@ "react-dev-utils": "9.0.1", "resolve": "1.11.0", "semver": "6.1.1", - "ssh-tuna": "^1.0.0", + "ssh-tuna": "^1.0.2", "webpack": "4.34.0", "webpack-dev-server": "3.2.1" } diff --git a/packages/accurapp-scripts/scripts/start.js b/packages/accurapp-scripts/scripts/start.js index b410dc9d..373cae62 100644 --- a/packages/accurapp-scripts/scripts/start.js +++ b/packages/accurapp-scripts/scripts/start.js @@ -45,6 +45,8 @@ function runDevServer(port) { const subdomain = generateSubdomain() tunnelPort(port, subdomain, TUNNEL_DOMAIN, TUNNEL_SSH_PORT) .then(client => { + if (client.state === 'error') return log.err('Could not connect') + client.onerror = err => log.err(err) const url = `https://${subdomain}.${TUNNEL_DOMAIN}` log.info(`Even from far away at: ${chalk.cyan(url)}`) }) diff --git a/test/e2e.sh b/test/e2e.sh index 977e13fe..2bb0558a 100755 --- a/test/e2e.sh +++ b/test/e2e.sh @@ -18,6 +18,12 @@ PID=$! sleep 20s kill $PID +# Test the start exposing to the internet +BROWSER=false yarn start --exposed & +PID=$! +sleep 20s +kill $PID + # Test the build command yarn build diff --git a/yarn.lock b/yarn.lock index dec51a80..f9c23163 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4728,21 +4728,6 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1 resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -eslint-config-accurapp@./packages/eslint-config-accurapp: - version "4.2.8" - dependencies: - "@babel/core" "7.4.5" - babel-eslint "11.0.0-beta.0" - eslint "5.16.0" - eslint-config-standard "12.0.0" - eslint-plugin-import "2.17.3" - eslint-plugin-no-copy-paste-default-export "0.0.3" - eslint-plugin-node "9.1.0" - eslint-plugin-promise "4.1.1" - eslint-plugin-react "7.13.0" - eslint-plugin-react-hooks "1.6.0" - eslint-plugin-standard "4.0.0" - eslint-config-standard@12.0.0: version "12.0.0" resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-12.0.0.tgz#638b4c65db0bd5a41319f96bba1f15ddad2107d9" @@ -11090,10 +11075,10 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= -ssh-tuna@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/ssh-tuna/-/ssh-tuna-1.0.0.tgz#26f910825f94337a3b3985e795a68d0babc27337" - integrity sha512-53oZIdz26jE61L4jExM2fvQZOPhjMOvFf6h5KzuzaNuOr4wt/Ydbl8UK2IUE4JzG/e7e1RsbLic41OaJH/o0Gw== +ssh-tuna@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/ssh-tuna/-/ssh-tuna-1.0.2.tgz#0b7a9a82a2fe0f6ebe0d380b79baa93a05d87359" + integrity sha512-v19Fga8IjbkPzyLcRzc/wAMkuGmks9K4nTL+KSCN+gu/+NyIJS1FNSwk8SqYhrzfWZUmhPHthKjmyKSB8q1TnQ== dependencies: dotenv "^8.2.0" node-fetch "^2.6.0" From 3a461416f021dade94931136a6f79954759191e2 Mon Sep 17 00:00:00 2001 From: Marco Fugaro Date: Mon, 9 Dec 2019 18:27:22 +0100 Subject: [PATCH 14/15] =?UTF-8?q?feat:=20=F0=9F=9A=A8=20Better=20error=20m?= =?UTF-8?q?essages=20for=20the=20exposed=20flag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- package.json | 2 +- packages/accurapp-scripts/package.json | 2 +- packages/accurapp-scripts/scripts/start.js | 29 ++++++++++++++-------- test/e2e.sh | 6 ----- yarn.lock | 23 ++++++++++++++--- 6 files changed, 41 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index ed3cbc02..9fd63a3f 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ Then you just `cd project-name`, run `yarn start` and start creating awesome stu #### Commands These are the available commands once you created a project: - `yarn start` starts a server locally, accessible both from your browser and from another machine using your same wi-fi -- `yarn start --exposed` starts a server locally and exposes it to the internet, accessible from everyone having the link, kinda like ngrok. The link created looks like `{branch}.{repo}.internal.accurat.io` if you're in a branch, or `{repo}.internal.accurat.io` if you're on master. It uses a server with an instance of [SSH-Tuna](https://github.com/accurat/ssh-tuna) to achieve this. +- `yarn start --exposed` starts a server locally and exposes it to the internet, accessible from everyone having the link, kinda like ngrok, but works only if you have an accurat ssh key. The link created looks like `{branch}.{repo}.internal.accurat.io` if you're in a branch, or `{repo}.internal.accurat.io` if you're on master. It uses a server with an instance of [SSH-Tuna](https://github.com/accurat/ssh-tuna) to achieve this. - `yarn build` builds the project for production, ready to be deployed from the `build/` folder - `yarn lint` lints with eslint the `src/` folder. You can pass any [eslint options](https://eslint.org/docs/user-guide/command-line-interface#options) to the lint command, for example if you want to use eslint's fix option, you do it like this: ```json diff --git a/package.json b/package.json index 633f9c4c..bd3ed2a3 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "test": "./test/e2e.sh", "create-test-app": "./test/create-test-app.sh", "create-test-app-build": "(yarn create-test-app && cd test-app/ && yarn build)", - "create-test-app-start": "(yarn create-test-app && cd test-app/ && BROWSER=false yarn start)", + "create-test-app-start": "(yarn create-test-app && cd test-app/ && BROWSER=false yarn start --exposed)", "publish": "is-git-status-clean && lerna publish --conventional-commits --message 'chore: 🚀 Publish'" }, "husky": { diff --git a/packages/accurapp-scripts/package.json b/packages/accurapp-scripts/package.json index 28073922..3cc8994f 100644 --- a/packages/accurapp-scripts/package.json +++ b/packages/accurapp-scripts/package.json @@ -46,7 +46,7 @@ "react-dev-utils": "9.0.1", "resolve": "1.11.0", "semver": "6.1.1", - "ssh-tuna": "^1.0.2", + "ssh-tuna": "^1.0.3", "webpack": "4.34.0", "webpack-dev-server": "3.2.1" } diff --git a/packages/accurapp-scripts/scripts/start.js b/packages/accurapp-scripts/scripts/start.js index 373cae62..65ce320c 100644 --- a/packages/accurapp-scripts/scripts/start.js +++ b/packages/accurapp-scripts/scripts/start.js @@ -41,16 +41,25 @@ function runDevServer(port) { const compiler = createWebpackCompiler(() => { log.info(`The app is running at: ${chalk.cyan(urls.localUrlForTerminal)}`) log.info(`Or on your network at: ${chalk.cyan(urls.lanUrlForTerminal)}`) - if (!EXPOSED) return - const subdomain = generateSubdomain() - tunnelPort(port, subdomain, TUNNEL_DOMAIN, TUNNEL_SSH_PORT) - .then(client => { - if (client.state === 'error') return log.err('Could not connect') - client.onerror = err => log.err(err) - const url = `https://${subdomain}.${TUNNEL_DOMAIN}` - log.info(`Even from far away at: ${chalk.cyan(url)}`) - }) - .catch(err => log.err(err)) + + if (EXPOSED) { + const subdomain = generateSubdomain() + tunnelPort(port, subdomain, TUNNEL_DOMAIN, TUNNEL_SSH_PORT) + .then(client => { + // If the connection hangs up or something else goes wrong + client.onerror = err => log.err(`Error occurred while tunneling to the exposed port: ${err}`) + + const url = `https://${subdomain}.${TUNNEL_DOMAIN}` + log.info(`Even from far away at: ${chalk.cyan(url)}`) + }) + .catch(err => { + if (err.message.includes('authentication methods failed')) { + err = 'Could not authenticate to the tunneling server, please make sure you can access the server via ssh.' + } + + log.err(`Could not expose the local port: ${err}`) + }) + } }) const devServerConfig = { diff --git a/test/e2e.sh b/test/e2e.sh index 2bb0558a..83c7227f 100755 --- a/test/e2e.sh +++ b/test/e2e.sh @@ -38,12 +38,6 @@ PID=$! sleep 20s kill $PID -# Test the start with typescript and exposing to the internet -BROWSER=false yarn start --exposed & -PID=$! -sleep 20s -kill $PID - # Test the build with typescript yarn build diff --git a/yarn.lock b/yarn.lock index f9c23163..8f9e1316 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4728,6 +4728,21 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1 resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= +eslint-config-accurapp@./packages/eslint-config-accurapp: + version "4.2.8" + dependencies: + "@babel/core" "7.4.5" + babel-eslint "11.0.0-beta.0" + eslint "5.16.0" + eslint-config-standard "12.0.0" + eslint-plugin-import "2.17.3" + eslint-plugin-no-copy-paste-default-export "0.0.3" + eslint-plugin-node "9.1.0" + eslint-plugin-promise "4.1.1" + eslint-plugin-react "7.13.0" + eslint-plugin-react-hooks "1.6.0" + eslint-plugin-standard "4.0.0" + eslint-config-standard@12.0.0: version "12.0.0" resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-12.0.0.tgz#638b4c65db0bd5a41319f96bba1f15ddad2107d9" @@ -11075,10 +11090,10 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= -ssh-tuna@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/ssh-tuna/-/ssh-tuna-1.0.2.tgz#0b7a9a82a2fe0f6ebe0d380b79baa93a05d87359" - integrity sha512-v19Fga8IjbkPzyLcRzc/wAMkuGmks9K4nTL+KSCN+gu/+NyIJS1FNSwk8SqYhrzfWZUmhPHthKjmyKSB8q1TnQ== +ssh-tuna@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/ssh-tuna/-/ssh-tuna-1.0.3.tgz#3209454698f2c4c5ae6559affea7c4b1b9f182d6" + integrity sha512-WjXqbL3t3AN1GpLsvf8pOrxvTiWRG6lAo59r2YJ5L8w0nON7hZWWw4aqlx1SIXMurILJs4jSqXmlK5pEDl9hqA== dependencies: dotenv "^8.2.0" node-fetch "^2.6.0" From 4daf4a85903115afff5616393a0290ad4f3c9afc Mon Sep 17 00:00:00 2001 From: Luca Mattiazzi Date: Mon, 9 Dec 2019 18:36:28 +0100 Subject: [PATCH 15/15] fix: error message fix --- packages/accurapp-scripts/scripts/start.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/accurapp-scripts/scripts/start.js b/packages/accurapp-scripts/scripts/start.js index 65ce320c..18759232 100644 --- a/packages/accurapp-scripts/scripts/start.js +++ b/packages/accurapp-scripts/scripts/start.js @@ -45,16 +45,15 @@ function runDevServer(port) { if (EXPOSED) { const subdomain = generateSubdomain() tunnelPort(port, subdomain, TUNNEL_DOMAIN, TUNNEL_SSH_PORT) - .then(client => { - // If the connection hangs up or something else goes wrong - client.onerror = err => log.err(`Error occurred while tunneling to the exposed port: ${err}`) - + .then(() => { const url = `https://${subdomain}.${TUNNEL_DOMAIN}` log.info(`Even from far away at: ${chalk.cyan(url)}`) }) .catch(err => { - if (err.message.includes('authentication methods failed')) { - err = 'Could not authenticate to the tunneling server, please make sure you can access the server via ssh.' + const message = err.message || err + if (message.includes('authentication methods failed')) { + err = + 'Could not authenticate to the tunneling server, please make sure you can access the server via ssh.' } log.err(`Could not expose the local port: ${err}`)