Skip to content

Commit

Permalink
feat(core): automatically open the admin at startup in development (#936
Browse files Browse the repository at this point in the history
)

Would be nice not having to manually click the URL.
  • Loading branch information
sindresorhus authored and epaminond committed Sep 27, 2018
1 parent 1f4ddba commit 09db0e6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
11 changes: 3 additions & 8 deletions packages/core/botpress/package.json
Expand Up @@ -42,6 +42,7 @@
"nanoid": "^1.0.1",
"node-machine-id": "^1.1.3",
"nodemon": "^1.12.1",
"opn": "^5.4.0",
"pg": "^6.1.2",
"prepend-file": "^1.3.1",
"prompt": "^1.0.0",
Expand Down Expand Up @@ -153,11 +154,7 @@
"license": "AGPL-3.0-only",
"main": "lib/index.js",
"repository": "git+https://github.com/botpress/botpress.git",
"os": [
"darwin",
"linux",
"win32"
],
"os": ["darwin", "linux", "win32"],
"scripts": {
"prepublishOnly": "npm run compile-prod",
"compile": "./build.sh",
Expand All @@ -169,9 +166,7 @@
},
"watch": {
"compile": {
"patterns": [
"src"
],
"patterns": ["src"],
"extensions": "js,jsx,scss,json,html"
}
}
Expand Down
5 changes: 5 additions & 0 deletions packages/core/botpress/src/botpress.js
Expand Up @@ -32,6 +32,7 @@ import _ from 'lodash'
import cluster from 'cluster'
import dotenv from 'dotenv'
import ms from 'ms'
import opn from 'opn'

import createMiddlewares from './middlewares'
import createLogger from './logger'
Expand Down Expand Up @@ -405,6 +406,10 @@ class botpress {

const { botUrl } = botfile
logger.info(chalk.green.bold(`Bot launched. Visit: ${botUrl}`))

if (isDeveloping) {
opn(botUrl, { wait: false })
}
})

const middlewareAutoLoading = _.get(botfile, 'middleware.autoLoading')
Expand Down
16 changes: 13 additions & 3 deletions packages/core/botpress/yarn.lock
Expand Up @@ -78,9 +78,9 @@
lodash "^4.2.0"
to-fast-properties "^2.0.0"

"@botpress/util-roles@^10.39.0":
version "10.39.0"
resolved "https://registry.yarnpkg.com/@botpress/util-roles/-/util-roles-10.39.0.tgz#826b60d0da75d1b5f66954407e37fc21f46c8911"
"@botpress/util-roles@^10.40.0":
version "10.40.0"
resolved "https://registry.yarnpkg.com/@botpress/util-roles/-/util-roles-10.40.0.tgz#09782f34a04f970483a5971eff4f8b3613c48dc9"

"@sinonjs/formatio@^2.0.0":
version "2.0.0"
Expand Down Expand Up @@ -4147,6 +4147,10 @@ is-windows@^1.0.1, is-windows@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"

is-wsl@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d"

isarray@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
Expand Down Expand Up @@ -5343,6 +5347,12 @@ once@^1.3.0, once@^1.3.1, once@^1.4.0:
dependencies:
wrappy "1"

opn@^5.4.0:
version "5.4.0"
resolved "https://registry.yarnpkg.com/opn/-/opn-5.4.0.tgz#cb545e7aab78562beb11aa3bfabc7042e1761035"
dependencies:
is-wsl "^1.1.0"

options@>=0.0.5:
version "0.0.6"
resolved "https://registry.yarnpkg.com/options/-/options-0.0.6.tgz#ec22d312806bb53e731773e7cdaefcf1c643128f"
Expand Down

0 comments on commit 09db0e6

Please sign in to comment.