From 7e4ba941717f9475f351862906fa10479ea31f90 Mon Sep 17 00:00:00 2001 From: Jason Dreyzehner Date: Mon, 12 Mar 2018 18:56:21 -0400 Subject: [PATCH] feat(CLI): add smaller ascii art for clients with 74-84 columns --- src/cli/tests/cli.unit.spec.ts | 6 ++++++ src/cli/utils.ts | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/cli/tests/cli.unit.spec.ts b/src/cli/tests/cli.unit.spec.ts index 21c0020..9163390 100644 --- a/src/cli/tests/cli.unit.spec.ts +++ b/src/cli/tests/cli.unit.spec.ts @@ -107,6 +107,12 @@ test('ascii art shows if stdout has 85+ columns', async t => { t.regex(jumbo, new RegExp(snippet)); }); +test('small ascii art shows if stdout has 74-84 columns', async t => { + const jumbo = getIntro(80); + const snippet = `| _| || | '_ \\/ -_|_- ((() => { const err = new Error(); diff --git a/src/cli/utils.ts b/src/cli/utils.ts index e375703..254b112 100644 --- a/src/cli/utils.ts +++ b/src/cli/utils.ts @@ -48,7 +48,17 @@ export function getIntro(columns: number | undefined): string { |___/|_| |_| `; + const asciiSmaller = ` +_ _ _ _ _ +| |_ _ _ _ __ ___ ___ __ _ _(_)_ __| |_ ___ __| |_ __ _ _ _| |_ ___ _ _ +| _| || | '_ \\/ -_|_-= 85 ? chalk.bold(gradient.mind(ascii)) - : `\n${chalk.cyan.bold.underline('typescript-starter')}\n`; + : columns && columns >= 74 + ? chalk.bold(gradient.mind(asciiSmaller)) + : `\n${chalk.cyan.bold.underline('typescript-starter')}\n`; }