Skip to content

Commit dae6659

Browse files
LorenVSLoren Van SpronsenJoshuaKGoldberg
authored
fix: replace strip-ansi with stripVTControlCharacters (#2181)
## PR Checklist - [x] Addresses an existing open issue: fixes #2177 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/TypeStat/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/TypeStat/blob/main/.github/CONTRIBUTING.md) were taken ## Overview `stripVTControlCharacters` was added in nodejs v16.11.0 and appears to be a direct replacement for the functionality from `strip-ansi`. `TypeStat` already declares a dependency on nodejs >= 18 in its `package.json`, so depending on this new API should be safe. Fixes #2177 --------- Co-authored-by: Loren Van Spronsen <[email protected]> Co-authored-by: Josh Goldberg <[email protected]>
1 parent 2a25af4 commit dae6659

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
"commander": "13.1.0",
4747
"enquirer": "2.4.1",
4848
"glob": "11.0.1",
49-
"strip-ansi": "7.1.0",
5049
"ts-api-utils": "2.0.1"
5150
},
5251
"devDependencies": {

pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/output/createProcessOutput.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as fs from "node:fs";
22
import { EOL } from "os";
3-
import stripAnsi from "strip-ansi";
3+
import { stripVTControlCharacters } from "util";
44

55
import { ProcessOutput } from "./types.js";
66

@@ -11,7 +11,7 @@ export const createProcessOutput = (logFile?: string): ProcessOutput => {
1111
return (line: string) => {
1212
stream.write(line + EOL);
1313
log?.(
14-
stripAnsi(
14+
stripVTControlCharacters(
1515
`[${prefix}] ${line.replace(/^\r\n|\r|\n/g, "").replace(/\r\n|\r|\n$/g, "")}`,
1616
),
1717
);

0 commit comments

Comments
 (0)