Skip to content

Commit

Permalink
Merge pull request #10329 from yannbf/feat/reuse-tab-when-possible
Browse files Browse the repository at this point in the history
CLI: Reuse existing chromium tab if possible
  • Loading branch information
shilman authored Apr 14, 2020
2 parents 83a94ad + 8f3046b commit 40ca654
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"babel-plugin-emotion": "^10.0.20",
"babel-plugin-macros": "^2.8.0",
"babel-preset-minify": "^0.5.0 || 0.6.0-alpha.5",
"better-opn": "^2.0.0",
"boxen": "^4.1.0",
"case-sensitive-paths-webpack-plugin": "^2.2.0",
"chalk": "^3.0.0",
Expand Down Expand Up @@ -86,7 +87,6 @@
"lazy-universal-dotenv": "^3.0.1",
"micromatch": "^4.0.2",
"node-fetch": "^2.6.0",
"open": "^7.0.1",
"pkg-dir": "^4.2.0",
"pnp-webpack-plugin": "1.6.4",
"postcss-flexbugs-fixes": "^4.1.0",
Expand Down
8 changes: 5 additions & 3 deletions lib/core/src/server/build-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import chalk from 'chalk';
import { logger, colors, instance as npmLog } from '@storybook/node-logger';
import fetch from 'node-fetch';
import Cache from 'file-system-cache';
import open from 'open';
import open from 'better-opn';
import boxen from 'boxen';
import semver from 'semver';
import dedent from 'ts-dedent';
Expand Down Expand Up @@ -234,13 +234,15 @@ async function outputStats(previewStats, managerStats) {
}

function openInBrowser(address) {
open(address).catch(() => {
try {
open(address);
} catch (error) {
logger.error(dedent`
Could not open ${address} inside a browser. If you're running this command inside a
docker container or on a CI, you need to pass the '--ci' flag to prevent opening a
browser by default.
`);
});
}
}

export async function buildDevStandalone(options) {
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7342,6 +7342,13 @@ better-assert@~1.0.0:
dependencies:
callsite "1.0.0"

better-opn@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/better-opn/-/better-opn-2.0.0.tgz#c70d198e51164bdc220306a28a885d9ac7a14c44"
integrity sha512-PPbGRgO/K0LowMHbH/JNvaV3qY3Vt+A2nH28fzJxy16h/DfR5OsVti6ldGl6S9SMsyUqT13sltikiAVtI6tKLA==
dependencies:
open "^7.0.3"

bfj@^6.1.1:
version "6.1.2"
resolved "https://registry.yarnpkg.com/bfj/-/bfj-6.1.2.tgz#325c861a822bcb358a41c78a33b8e6e2086dde7f"
Expand Down Expand Up @@ -21679,7 +21686,7 @@ onetime@^5.1.0:
dependencies:
mimic-fn "^2.1.0"

open@7.0.3, open@^7.0.1, open@^7.0.2:
open@7.0.3, open@^7.0.2, open@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/open/-/open-7.0.3.tgz#db551a1af9c7ab4c7af664139930826138531c48"
integrity sha512-sP2ru2v0P290WFfv49Ap8MF6PkzGNnGlAwHweB4WR4mr5d2d0woiCluUeJ218w7/+PmoBy9JmYgD5A4mLcWOFA==
Expand Down

0 comments on commit 40ca654

Please sign in to comment.