From 5844ad766e0ed674c1eece160177b3b4ecf1327b Mon Sep 17 00:00:00 2001 From: Peter Date: Mon, 1 Jun 2020 13:01:34 -0500 Subject: [PATCH 1/3] Wrap Chalk with command to enable color emission --- src/chalk.ts | 6 ++++++ src/print-pretty-error.ts | 2 +- src/screens.ts | 2 +- src/utils.ts | 2 +- src/waterfall-cli.ts | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 src/chalk.ts diff --git a/src/chalk.ts b/src/chalk.ts new file mode 100644 index 00000000..4636ffb4 --- /dev/null +++ b/src/chalk.ts @@ -0,0 +1,6 @@ +// Imports +import * as chalk from 'chalk'; + + +// Export chalk with color support enabled +export default new chalk.Instance({ level: 3 }); diff --git a/src/print-pretty-error.ts b/src/print-pretty-error.ts index ae6d3297..00a3fab4 100644 --- a/src/print-pretty-error.ts +++ b/src/print-pretty-error.ts @@ -1,5 +1,5 @@ // Dependencies -import chalk from 'chalk'; +import chalk from './chalk'; // Print a pretty error message export default function printPrettyError(message: string) { diff --git a/src/screens.ts b/src/screens.ts index c194f9de..177ae5cf 100644 --- a/src/screens.ts +++ b/src/screens.ts @@ -1,5 +1,5 @@ // Dependencies -import chalk from 'chalk'; +import chalk from './chalk'; import Table from 'cli-table'; import { Settings } from './types'; import utils from './utils'; diff --git a/src/utils.ts b/src/utils.ts index 7ec3f840..bdd79234 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,5 +1,5 @@ // Dependencies -import chalk from 'chalk'; +import chalk from './chalk'; import fs from 'fs'; import path from 'path'; import Fuse from 'fuse.js'; diff --git a/src/waterfall-cli.ts b/src/waterfall-cli.ts index 873af53f..b0a9fcd5 100644 --- a/src/waterfall-cli.ts +++ b/src/waterfall-cli.ts @@ -1,5 +1,5 @@ // Dependencies -import chalk from 'chalk'; +import chalk from './chalk'; import { spawn } from 'child_process'; import fs from 'fs'; import path from 'path'; From 76ba956019c433ed8452423f4481ab73c83d59db Mon Sep 17 00:00:00 2001 From: Peter Date: Mon, 1 Jun 2020 13:06:50 -0500 Subject: [PATCH 2/3] Have the test use the wrapped Chalk too --- test/print-pretty-error.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/print-pretty-error.test.ts b/test/print-pretty-error.test.ts index b69de664..8b63ecbb 100644 --- a/test/print-pretty-error.test.ts +++ b/test/print-pretty-error.test.ts @@ -2,7 +2,7 @@ // Dependencies const printPrettyError = require('../dist/print-pretty-error').default; -const chalk = require('chalk'); +const chalk = require('../dist/chalk').default; // Holders for capturing console.error output let spy; From 6a1cc4fd156505466459c7d47b34830033074bd5 Mon Sep 17 00:00:00 2001 From: Peter Date: Mon, 1 Jun 2020 14:00:15 -0500 Subject: [PATCH 3/3] Formatting fix --- src/chalk.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/chalk.ts b/src/chalk.ts index 4636ffb4..7f4d01e8 100644 --- a/src/chalk.ts +++ b/src/chalk.ts @@ -1,6 +1,5 @@ // Imports import * as chalk from 'chalk'; - // Export chalk with color support enabled export default new chalk.Instance({ level: 3 });