Skip to content

Commit

Permalink
Add heredoc in auth/token.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
zwhitfield3 committed Apr 26, 2024
1 parent d7c3e69 commit 9a77e9b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"shell-quote": "^1.8.1",
"tmp": "^0.0.33",
"true-myth": "2.2.3",
"tsheredoc": "^1.0.1",
"tslib": "1.14.1",
"urijs": "^1.19.11",
"uuid": "3.3.2",
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/auth/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {Command, flags} from '@heroku-cli/command'
import * as Heroku from '@heroku-cli/schema'
import {FlagInput} from '@oclif/core/lib/interfaces/parser'
import {formatRelative} from 'date-fns'
import heredoc from 'tsheredoc'

export default class AuthToken extends Command {
static description = `outputs current CLI authentication token.
Expand All @@ -22,7 +23,7 @@ By default, the CLI auth token is only valid for 1 year. To generate a long-live
if (token && token.access_token.expires_in) {
const d = new Date()
d.setSeconds(d.getSeconds() + token.access_token.expires_in)
this.warn(`token will expire ${formatRelative(d, new Date())}\n${isInternal ? 'All tokens expire one year after we generate it.' : `To generate a token that expires in one year, use ${color.cmd('heroku authorizations:create')}.`}`)
this.warn(heredoc(`token will expire ${formatRelative(d, new Date())}\n${isInternal ? 'All tokens expire one year after we generate it.' : `To generate a token that expires in one year, use ${color.cmd('heroku authorizations:create')}.`}`))
}
} catch (error: any) {
this.warn(error)
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11290,6 +11290,7 @@ __metadata:
tmp: ^0.0.33
true-myth: 2.2.3
ts-node: ^10.9.1
tsheredoc: ^1.0.1
tslib: 1.14.1
typescript: 4.8.4
urijs: ^1.19.11
Expand Down Expand Up @@ -18823,6 +18824,13 @@ __metadata:
languageName: node
linkType: hard

"tsheredoc@npm:^1.0.1":
version: 1.0.1
resolution: "tsheredoc@npm:1.0.1"
checksum: 1ecf5c4dbcdb9b0edaf666a5a73252d02ca28896e36d438588f5fc0e369ed055e2d6fce2011128bd9cade473ff6530118a69413b23542295c9f28fd725b18f53
languageName: node
linkType: hard

"tslib@npm:1.14.1, tslib@npm:^1.11.1":
version: 1.14.1
resolution: "tslib@npm:1.14.1"
Expand Down

0 comments on commit 9a77e9b

Please sign in to comment.