From 97b20b50b6df3e13bb317b4f078dbe8904d75ff1 Mon Sep 17 00:00:00 2001 From: LouisAntoninLesieur Date: Sun, 25 May 2025 00:49:52 +0200 Subject: [PATCH 1/4] chore: remove strip-ansi dependency --- package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 05368e7a..2b55a482 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@nodesecure/cli", + "name": "@nodesecure/cli",strip-ansi "version": "3.1.0", "description": "Node.js security CLI", "main": "./bin/index.js", @@ -77,8 +77,7 @@ "pkg-ok": "^3.0.0", "pretty-bytes": "^7.0.0", "rimraf": "^6.0.1", - "server-destroy": "^1.0.1", - "strip-ansi": "^7.1.0" + "server-destroy": "^1.0.1" }, "dependencies": { "@nodesecure/documentation-ui": "^1.3.0", From a6ac32204998ff62f1f7eb5541377cb02fda6c41 Mon Sep 17 00:00:00 2001 From: LouisAntoninLesieur Date: Sun, 25 May 2025 00:52:37 +0200 Subject: [PATCH 2/4] test: replace strip-ansi with util.stripVTControlCharacters in tests --- test/commands/summary.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/commands/summary.test.js b/test/commands/summary.test.js index ac59e851..fb0cd72a 100644 --- a/test/commands/summary.test.js +++ b/test/commands/summary.test.js @@ -5,9 +5,9 @@ dotenv.config(); import { fileURLToPath } from "node:url"; import path from "node:path"; import { describe, it } from "node:test"; +import { stripVTControlCharacters } from "node:util"; // Import Third-party Dependencies -import stripAnsi from "strip-ansi"; import * as i18n from "@nodesecure/i18n"; // Import Internal Dependencies @@ -47,7 +47,7 @@ describe("CLI Commands: summary", () => { for await (const line of runProcess(processOptions)) { const regexp = lines.shift(); t.assert.ok(regexp, "we are expecting this line"); - t.assert.ok(regexp.test(stripAnsi(line)), `line (${line}) matches ${regexp}`); + t.assert.ok(regexp.test(stripVTControlCharacters(line)), `line (${line}) matches ${regexp}`); } }); @@ -66,7 +66,7 @@ describe("CLI Commands: summary", () => { for await (const line of runProcess(processOptions)) { const expectedLineRegex = expectedLines.shift(); - const formattedLine = stripAnsi(line); + const formattedLine = stripVTControlCharacters(line); t.assert.ok(expectedLineRegex, "we are expecting this line"); t.assert.ok(expectedLineRegex.test(formattedLine), `line (${formattedLine}) should match ${expectedLineRegex}`); } From 96030a8cecf6481f8e4c1ab811d029b2b81dc9c5 Mon Sep 17 00:00:00 2001 From: LouisAntoninLesieur Date: Sun, 25 May 2025 00:53:05 +0200 Subject: [PATCH 3/4] refactor: replace strip-ansi with util.stripVTControlCharacters --- test/helpers/cliCommandRunner.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/helpers/cliCommandRunner.js b/test/helpers/cliCommandRunner.js index 18880631..76812dc4 100644 --- a/test/helpers/cliCommandRunner.js +++ b/test/helpers/cliCommandRunner.js @@ -1,10 +1,10 @@ // Import Node.js Dependencies import { fork } from "node:child_process"; import { createInterface } from "node:readline"; +import { stripVTControlCharacters } from "node:util"; // Import Third-party Dependencies import { MockAgent, setGlobalDispatcher } from "undici"; -import stripAnsi from "strip-ansi"; export async function* runProcess(options) { const { path, args = [], cwd = process.cwd(), undiciMockAgentOptions = null } = options; @@ -20,7 +20,7 @@ export async function* runProcess(options) { const rStream = createInterface(childProcess.stdout); for await (const line of rStream) { - yield stripAnsi(line); + yield stripVTControlCharacters(line); } } finally { From e7c2636b2ea09f6bdbd8cd29dddf1a689d396573 Mon Sep 17 00:00:00 2001 From: LouisAntoninLesieur Date: Sun, 25 May 2025 01:09:32 +0200 Subject: [PATCH 4/4] fix: correct hardcoded field name in package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2b55a482..d0856b27 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@nodesecure/cli",strip-ansi + "name": "@nodesecure/cli", "version": "3.1.0", "description": "Node.js security CLI", "main": "./bin/index.js",