From 9a77e9b197f0de732ad2efe413f62eefcfe138dc Mon Sep 17 00:00:00 2001 From: Zane Whitfield Date: Thu, 25 Apr 2024 19:52:21 -0700 Subject: [PATCH] Add heredoc in auth/token.ts --- packages/cli/package.json | 1 + packages/cli/src/commands/auth/token.ts | 3 ++- yarn.lock | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 4a1beeaca1..21c335c558 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -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", diff --git a/packages/cli/src/commands/auth/token.ts b/packages/cli/src/commands/auth/token.ts index f4a4a8b6ea..958d1c73bf 100644 --- a/packages/cli/src/commands/auth/token.ts +++ b/packages/cli/src/commands/auth/token.ts @@ -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. @@ -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) diff --git a/yarn.lock b/yarn.lock index 7ee1fbc126..f813770cc4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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 @@ -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"