1
0
mirror of synced 2025-11-08 12:57:47 +00:00

feat(CLI): add smaller ascii art for clients with 74-84 columns

This commit is contained in:
Jason Dreyzehner
2018-03-12 18:56:21 -04:00
parent a8e0162846
commit 7e4ba94171
2 changed files with 17 additions and 1 deletions

View File

@@ -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 = `| _| || | '_ \\/ -_|_-</ _| '_| | '_ \\ _|`;
t.regex(jumbo, new RegExp(snippet));
});
const mockErr = (code?: string | number) =>
((() => {
const err = new Error();

View File

@@ -48,7 +48,17 @@ export function getIntro(columns: number | undefined): string {
|___/|_| |_|
`;
const asciiSmaller = `
_ _ _ _ _
| |_ _ _ _ __ ___ ___ __ _ _(_)_ __| |_ ___ __| |_ __ _ _ _| |_ ___ _ _
| _| || | '_ \\/ -_|_-</ _| '_| | '_ \\ _|___(_-< _/ _\` | '_| _/ -_) '_|
\\__|\\_, | .__/\\___/__/\\__|_| |_| .__/\\__| /__/\\__\\__,_|_| \\__\\___|_|
|__/|_| |_|
`;
return columns && columns >= 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`;
}