From b37f235c2233d2b2820eb787267c2b2791f85300 Mon Sep 17 00:00:00 2001 From: Ihor Date: Wed, 22 Nov 2023 15:52:37 +0000 Subject: [PATCH] =?UTF-8?q?refactor:=20=E2=9E=96=20remove=20`chalk`=20as?= =?UTF-8?q?=20dependency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes: #43 --- index.js | 8 +++++++- package.json | 3 --- yarn.lock | 10 +++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index 2f57f28..e98c219 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,11 @@ const util = require('util') -const chalk = require('chalk') + +const chalk = { + red: (str) => `\u001b[31m${str}`, + gray: (str) => `\u001b[90m${str}`, + white: (str) => `\u001b[37m${str}`, + bold: (str) => `\u001b[1m${str}` +}; const defaultErrorMessage = (methodName, bold) => `Expected test not to call ${bold(`console.${methodName}()`)}.\n\n` + diff --git a/package.json b/package.json index 01bd63b..1b0306c 100644 --- a/package.json +++ b/package.json @@ -19,9 +19,6 @@ "test": "jest tests/index.test.js", "type-check": "tsc --noEmit index.d.ts" }, - "dependencies": { - "chalk": "^4.1.0" - }, "devDependencies": { "jest": "^27.5.1", "np": "^7.2.0", diff --git a/yarn.lock b/yarn.lock index 79fe732..92d89f4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1635,9 +1635,9 @@ fs.realpath@^1.0.0: integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= fsevents@^2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== function-bind@^1.1.1: version "1.1.1" @@ -2613,7 +2613,7 @@ jest-worker@^27.5.1: jest@^27.5.1: version "27.5.1" - resolved "https://registry.yarnpkg.com/jest/-/jest-27.5.1.tgz#dadf33ba70a779be7a6fc33015843b51494f63fc" + resolved "https://registry.npmjs.org/jest/-/jest-27.5.1.tgz" integrity sha512-Yn0mADZB89zTtjkPJEXwrac3LHudkQMR+Paqa8uxJHCBr9agxztUifWCyiYrjhMPBoUVBjyny0I7XH6ozDr7QQ== dependencies: "@jest/core" "^27.5.1" @@ -4048,7 +4048,7 @@ typedarray-to-buffer@^3.1.5: typescript@^4.8.2: version "4.8.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.2.tgz#e3b33d5ccfb5914e4eeab6699cf208adee3fd790" + resolved "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz" integrity sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw== unique-string@^2.0.0: