From 22105425cc8875f996a419a8d1d7bfa73e2e0bb9 Mon Sep 17 00:00:00 2001 From: mvelten Date: Fri, 25 Oct 2024 03:55:37 +0200 Subject: [PATCH] removed chalk and using jsr std format instead --- deno.json | 2 +- deno.lock | 25 ++++++------------------- src/utils/logging/logUtils.ts | 12 ++++++------ 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/deno.json b/deno.json index f5b90a0..09d2c3a 100644 --- a/deno.json +++ b/deno.json @@ -26,12 +26,12 @@ "@std/collections": "jsr:@std/collections@^1.0.9", "@std/crypto": "jsr:@std/crypto@^1.0.3", "@std/expect": "jsr:@std/expect@^1.0.4", + "@std/fmt": "jsr:@std/fmt@^1.0.3", "@std/path": "jsr:@std/path@^1.0.6", "@std/testing": "jsr:@std/testing@^1.0.3", "@types/figlet": "npm:@types/figlet@^1.5.8", "@types/lodash": "npm:@types/lodash@^4.17.9", "@types/seedrandom": "npm:@types/seedrandom@^3.0.8", - "chalk": "npm:chalk@4", "cli-progress": "npm:cli-progress@^3.12.0", "commander": "npm:commander@^12.1.0", "figlet": "npm:figlet@^1.7.0", diff --git a/deno.lock b/deno.lock index d3da0af..81d7ef1 100644 --- a/deno.lock +++ b/deno.lock @@ -9,6 +9,7 @@ "jsr:@std/data-structures@^1.0.4": "1.0.4", "jsr:@std/expect@*": "1.0.4", "jsr:@std/expect@^1.0.4": "1.0.4", + "jsr:@std/fmt@^1.0.3": "1.0.3", "jsr:@std/fs@^1.0.4": "1.0.4", "jsr:@std/internal@^1.0.4": "1.0.4", "jsr:@std/path@*": "1.0.6", @@ -19,7 +20,6 @@ "npm:@types/lodash@^4.17.9": "4.17.10", "npm:@types/node@*": "22.5.4", "npm:@types/seedrandom@^3.0.8": "3.0.8", - "npm:chalk@4": "4.1.2", "npm:cli-progress@^3.12.0": "3.12.0", "npm:commander@^12.1.0": "12.1.0", "npm:figlet@^1.7.0": "1.8.0", @@ -52,6 +52,9 @@ "jsr:@std/internal" ] }, + "@std/fmt@1.0.3": { + "integrity": "97765c16aa32245ff4e2204ecf7d8562496a3cb8592340a80e7e554e0bb9149f" + }, "@std/fs@1.0.4": { "integrity": "2907d32d8d1d9e540588fd5fe0ec21ee638134bd51df327ad4e443aaef07123c", "dependencies": [ @@ -337,13 +340,6 @@ "color-convert" ] }, - "chalk@4.1.2": { - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dependencies": [ - "ansi-styles", - "supports-color" - ] - }, "chalk@5.3.0": { "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==" }, @@ -405,13 +401,10 @@ "gradient-string@3.0.0": { "integrity": "sha512-frdKI4Qi8Ihp4C6wZNB565de/THpIaw3DjP5ku87M+N9rNSGmPTjfkq61SdRXB7eCaL8O1hkKDvf6CDMtOzIAg==", "dependencies": [ - "chalk@5.3.0", + "chalk", "tinygradient" ] }, - "has-flag@4.0.0": { - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" - }, "iconv-lite@0.4.24": { "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dependencies": [ @@ -517,12 +510,6 @@ "ansi-regex" ] }, - "supports-color@7.2.0": { - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dependencies": [ - "has-flag" - ] - }, "tinycolor2@1.6.0": { "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==" }, @@ -676,12 +663,12 @@ "jsr:@std/collections@^1.0.9", "jsr:@std/crypto@^1.0.3", "jsr:@std/expect@^1.0.4", + "jsr:@std/fmt@^1.0.3", "jsr:@std/path@^1.0.6", "jsr:@std/testing@^1.0.3", "npm:@types/figlet@^1.5.8", "npm:@types/lodash@^4.17.9", "npm:@types/seedrandom@^3.0.8", - "npm:chalk@4", "npm:cli-progress@^3.12.0", "npm:commander@^12.1.0", "npm:figlet@^1.7.0", diff --git a/src/utils/logging/logUtils.ts b/src/utils/logging/logUtils.ts index 59b6afa..6818e84 100644 --- a/src/utils/logging/logUtils.ts +++ b/src/utils/logging/logUtils.ts @@ -2,7 +2,7 @@ import type { ILogFacility, ILogger } from '../../@types/index.ts'; -import chalk from 'chalk'; +import { blue, green, magenta, red, yellow } from '@std/fmt/colors'; const loggerMap: Record = {}; @@ -29,31 +29,31 @@ class Logger implements ILogger { ) {} info(message: string) { - const msg = chalk.blue(`[INFO] ${this.name} :: ${message}`); + const msg = blue(`[INFO] ${this.name} :: ${message}`); this.logger.log(msg); this.infoMessages.push(msg); } success(message: string) { - const msg = chalk.green(`[SUCCESS] ${this.name} :: ${message}`); + const msg = green(`[SUCCESS] ${this.name} :: ${message}`); this.logger.log(msg); this.successMessages.push(msg); } warn(message: string) { - const msg = chalk.yellow(`[WARNING] ${this.name} :: ${message}`); + const msg = yellow(`[WARNING] ${this.name} :: ${message}`); this.logger.warn(msg); this.warnMessages.push(msg); } error(message: string) { - const msg = chalk.red(`[ERROR] ${this.name} :: ${message}`); + const msg = red(`[ERROR] ${this.name} :: ${message}`); this.logger.error(msg); this.errorMessages.push(message); } debug(message: string) { - const msg = chalk.magenta(`[DEBUG] ${this.name} :: ${message}`); + const msg = magenta(`[DEBUG] ${this.name} :: ${message}`); if (this.verbose) { this.logger.log(msg); }