Skip to content

Commit

Permalink
Merge pull request #133 from lifeomic/upgrade-open
Browse files Browse the repository at this point in the history
Upgrade open and work around incompatibility between open and pkg on …
  • Loading branch information
Anthony Roach authored Feb 27, 2020
2 parents 7dd8e8c + cc1225b commit e387257
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
10 changes: 9 additions & 1 deletion lib/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,15 @@ function showLogin (environment, state, verifier) {

const url = `${config.get(`${environment}.apiUrl`)}/v1/oauth/authorize?${querystring.stringify(opts)}`;
debug(`opening ${url}`);
open(url).then(() => {

const openOptions = {};
// This is a hack to make open work on Linux when bundling lo as an EXE.
// The xdg-open embedded in the EXE does not work:
if (process.argv[0].endsWith('lo') && process.platform === 'linux') {
openOptions.app = 'xdg-open';
}

open(url, openOptions).then(() => {
console.log(chalk.green('Opened browser for auth...'));
}).catch((e) => {
console.log(chalk.red('Failed to open browser.', e));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.11",
"mkdirp": "^0.5.1",
"open": "^6.3.0",
"open": "^7.0.2",
"prettyoutput": "^1.2.0",
"queue": "^4.5.1",
"recursive-readdir": "^2.2.2",
Expand Down
24 changes: 15 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2749,6 +2749,11 @@ is-descriptor@^1.0.0, is-descriptor@^1.0.2:
is-data-descriptor "^1.0.0"
kind-of "^6.0.2"

is-docker@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.0.0.tgz#2cb0df0e75e2d064fe1864c37cdeacb7b2dcf25b"
integrity sha512-pJEdRugimx4fBMra5z2/5iRdZ63OhYV0vr0Dwm5+xtW4D1FvRkB8hamMIhnWfyJeDdyr/aa7BDyNbtG38VxgoQ==

is-dotfile@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1"
Expand Down Expand Up @@ -2982,10 +2987,10 @@ is-windows@^1.0.2:
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"
integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==

is-wsl@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d"
integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=
is-wsl@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.1.1.tgz#4a1c152d429df3d441669498e2486d3596ebaf1d"
integrity sha512-umZHcSrwlDHo2TGMXv0DZ8dIUGunZ2Iv68YZnrmCiBPkZ4aaOhtv7pXJKeki9k3qJ3RJr0cDyitcl5wEH3AYog==

[email protected]:
version "0.0.1"
Expand Down Expand Up @@ -3862,12 +3867,13 @@ onetime@^5.1.0:
dependencies:
mimic-fn "^2.1.0"

open@^6.3.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/open/-/open-6.3.0.tgz#60d0b845ee38fae0631f5d739a21bd40e3d2a527"
integrity sha512-6AHdrJxPvAXIowO/aIaeHZ8CeMdDf7qCyRNq8NwJpinmCdXhz+NZR7ie1Too94lpciCDsG+qHGO9Mt0svA4OqA==
open@^7.0.2:
version "7.0.2"
resolved "https://registry.yarnpkg.com/open/-/open-7.0.2.tgz#fb3681f11f157f2361d2392307548ca1792960e8"
integrity sha512-70E/pFTPr7nZ9nLDPNTcj3IVqnNvKuP4VsBmoKV9YGTnChe0mlS3C4qM7qKarhZ8rGaHKLfo+vBTHXDp6ZSyLQ==
dependencies:
is-wsl "^1.1.0"
is-docker "^2.0.0"
is-wsl "^2.1.1"

option-chain@^1.0.0:
version "1.0.0"
Expand Down

0 comments on commit e387257

Please sign in to comment.