@heroku-cli/command
Advanced tools
Comparing version 8.1.24 to 8.1.25
@@ -0,1 +1,9 @@ | ||
<a name="8.1.25"></a> | ||
## [8.1.25](https://github.com/heroku/heroku-cli-command/compare/v8.1.24...v8.1.25) (2018-06-18) | ||
### Bug Fixes | ||
* only use browser login when available ([#44](https://github.com/heroku/heroku-cli-command/issues/44)) ([b178343](https://github.com/heroku/heroku-cli-command/commit/b178343)) | ||
<a name="8.1.24"></a> | ||
@@ -2,0 +10,0 @@ ## [8.1.24](https://github.com/heroku/heroku-cli-command/compare/v8.1.23...v8.1.24) (2018-06-09) |
@@ -13,13 +13,14 @@ /// <reference types="node" /> | ||
config: CLI.Config; | ||
warn: typeof import("../node_modules/@oclif/errors/lib/index").warn; | ||
error: typeof import("../node_modules/@oclif/errors/lib/index").error; | ||
exit: typeof import("../node_modules/@oclif/errors/lib/index").exit; | ||
readonly prompt: (name: string, options?: CLI.IPromptOptions | undefined) => Promise<any>; | ||
readonly confirm: (message: string) => Promise<boolean>; | ||
warn: typeof import("@oclif/errors").warn; | ||
error: typeof import("@oclif/errors").error; | ||
exit: typeof import("@oclif/errors").exit; | ||
readonly prompt: typeof import("cli-ux/lib/prompt").prompt; | ||
readonly anykey: typeof import("cli-ux/lib/prompt").anykey; | ||
readonly confirm: typeof import("cli-ux/lib/prompt").confirm; | ||
readonly action: CLI.ActionBase; | ||
styledObject(obj: any, keys?: string[] | undefined): void; | ||
readonly styledHeader: typeof import("../node_modules/cli-ux/lib/styled/header").default; | ||
readonly styledJSON: typeof import("../node_modules/cli-ux/lib/styled/json").default; | ||
readonly styledHeader: typeof import("cli-ux/lib/styled/header").default; | ||
readonly styledJSON: typeof import("cli-ux/lib/styled/json").default; | ||
readonly table: typeof CLI.Table.default; | ||
readonly open: typeof import("../node_modules/cli-ux/lib/open").default; | ||
readonly open: typeof import("cli-ux/lib/open").default; | ||
readonly wait: (ms?: number | undefined) => Promise<{}>; | ||
@@ -26,0 +27,0 @@ done(): Promise<void>; |
@@ -5,3 +5,2 @@ "use strict"; | ||
const errors_1 = require("@oclif/errors"); | ||
const completions_1 = require("../completions"); | ||
const git_1 = require("../git"); | ||
@@ -24,3 +23,2 @@ class MultipleRemotesError extends errors_1.CLIError { | ||
char: 'a', | ||
completion: completions_1.AppCompletion, | ||
description: 'app to run command against', | ||
@@ -44,4 +42,3 @@ default: ({ options, flags }) => { | ||
char: 'r', | ||
completion: completions_1.RemoteCompletion, | ||
description: 'git remote of app to use', | ||
}); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const command_1 = require("@oclif/command"); | ||
const completions_1 = require("../completions"); | ||
exports.team = command_1.flags.build({ | ||
char: 't', | ||
completion: completions_1.TeamCompletion, | ||
description: 'team to use', | ||
@@ -9,0 +7,0 @@ default: ({ flags }) => { |
@@ -43,3 +43,4 @@ "use strict"; | ||
else if (this.enableBrowserLogin()) { | ||
input = await cli_ux_1.default.prompt(`heroku: Login with [${color_1.default.green('b')}]rowser, [${color_1.default.green('i')}]nteractive, or [${color_1.default.green('s')}]so (enterprise-only)`, { default: defaultMethod }); | ||
await cli_ux_1.default.anykey(`heroku: Press any key to open up the browser to login or ${color_1.default.yellow('q')} to exit`); | ||
input = 'browser'; | ||
} | ||
@@ -62,3 +63,3 @@ else { | ||
case 'browser': | ||
auth = await this.browser(); | ||
auth = await this.browser(opts.browser); | ||
break; | ||
@@ -129,3 +130,3 @@ case 'i': | ||
} | ||
async browser() { | ||
async browser(browser) { | ||
const { body: urls } = await http_call_1.default.post(`${this.loginHost}/auth`); | ||
@@ -135,5 +136,13 @@ // TODO: handle browser | ||
debug(`opening browser to ${url}`); | ||
const cp = await opn(url, { wait: false }); | ||
cp.on('error', cli_ux_1.default.error); | ||
const showUrl = () => cli_ux_1.default.warn(`Cannot open browser. Go to ${color_1.default.greenBright(url)} to finish login or run ${color_1.default.cmd('heroku login --interactive')}\n`); | ||
let urlDisplayed = false; | ||
const showUrl = () => { | ||
if (!urlDisplayed) | ||
cli_ux_1.default.warn(`Cannot open browser. Go to ${color_1.default.greenBright(url)} to finish login or run ${color_1.default.cmd('heroku login --interactive')}\n`); | ||
urlDisplayed = true; | ||
}; | ||
const cp = await opn(url, { app: browser, wait: false }); | ||
cp.on('error', err => { | ||
cli_ux_1.default.warn(err); | ||
showUrl(); | ||
}); | ||
if (process.env.HEROKU_TESTING_HEADLESS_LOGIN === '1') | ||
@@ -145,3 +154,3 @@ showUrl(); | ||
}); | ||
cli_ux_1.default.action.start('Waiting for login'); | ||
cli_ux_1.default.action.start('heroku: Waiting for login'); | ||
const { body: auth } = await http_call_1.default.get(`${this.loginHost}${urls.cli_url}`, { | ||
@@ -148,0 +157,0 @@ headers: { |
{ | ||
"name": "@heroku-cli/command", | ||
"description": "base class for Heroku CLI commands", | ||
"version": "8.1.24", | ||
"version": "8.1.25", | ||
"author": "Jeff Dickey @jdxcode", | ||
@@ -10,3 +10,3 @@ "bugs": "https://github.com/heroku/heroku-cli-command/issues", | ||
"@oclif/errors": "^1.1.2", | ||
"cli-ux": "^4.6.1", | ||
"cli-ux": "^4.7.1", | ||
"debug": "^3.1.0", | ||
@@ -23,10 +23,10 @@ "fs-extra": "^6.0.1", | ||
"@oclif/command": "^1.4.33", | ||
"@oclif/config": "^1.6.27", | ||
"@oclif/config": "^1.6.30", | ||
"@oclif/tslint": "^1.1.2", | ||
"@types/ansi-styles": "^3.2.0", | ||
"@types/chai": "^4.1.3", | ||
"@types/chai": "^4.1.4", | ||
"@types/fs-extra": "^5.0.3", | ||
"@types/mocha": "^5.2.1", | ||
"@types/mocha": "^5.2.2", | ||
"@types/nock": "^9.1.3", | ||
"@types/node": "^10.3.2", | ||
"@types/node": "^10.3.3", | ||
"@types/opn": "^5.1.0", | ||
@@ -37,11 +37,11 @@ "@types/proxyquire": "^1.3.28", | ||
"chai": "^4.1.2", | ||
"fancy-test": "^1.1.4", | ||
"fancy-test": "^1.2.0", | ||
"mocha": "^5.2.0", | ||
"nock": "^9.3.2", | ||
"nock": "^9.3.3", | ||
"proxyquire": "^2.0.1", | ||
"sinon": "^5.1.1", | ||
"sinon": "^6.0.0", | ||
"testdouble": "^3.8.1", | ||
"ts-node": "^6.1.0", | ||
"ts-node": "^6.1.1", | ||
"tslint": "^5.10.0", | ||
"typescript": "^2.9.1" | ||
"typescript": "^2.9.2" | ||
}, | ||
@@ -48,0 +48,0 @@ "engines": { |
50276
33
1046
Updatedcli-ux@^4.7.1