From a69bc1e2c6a65a0d0c95ae65bbab8d42c26b3e4e Mon Sep 17 00:00:00 2001 From: Jeremy Scheff Date: Sun, 19 Jan 2025 16:40:55 -0500 Subject: [PATCH] yoctocolors -> Node.js built-in styleText --- package.json | 3 +-- pnpm-lock.yaml | 9 --------- tools/watch/spinners.ts | 17 ++++++++--------- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index e17f9e9e50..f70b67569b 100644 --- a/package.json +++ b/package.json @@ -169,8 +169,7 @@ "sass": "1.77.6", "typescript": "^5.7.3", "typescript-eslint": "^8.20.0", - "workbox-build": "^7.3.0", - "yoctocolors": "^2.1.1" + "workbox-build": "^7.3.0" }, "engines": { "node": "^22.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 77d92dfe87..cb55e0556e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -420,9 +420,6 @@ importers: workbox-build: specifier: ^7.3.0 version: 7.3.0(@types/babel__core@7.20.5) - yoctocolors: - specifier: ^2.1.1 - version: 2.1.1 packages: @@ -5472,10 +5469,6 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} - yoctocolors@2.1.1: - resolution: {integrity: sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ==} - engines: {node: '>=18'} - zustand@5.0.3: resolution: {integrity: sha512-14fwWQtU3pH4dE0dOpdMiWjddcH+QzKIgk1cl8epwSE7yag43k/AD/m4L6+K7DytAOr9gGBe3/EXj9g7cdostg==} engines: {node: '>=12.20.0'} @@ -11450,8 +11443,6 @@ snapshots: yocto-queue@0.1.0: {} - yoctocolors@2.1.1: {} - zustand@5.0.3(@types/react@19.0.7)(react@19.0.0)(use-sync-external-store@1.4.0(react@19.0.0)): optionalDependencies: '@types/react': 19.0.7 diff --git a/tools/watch/spinners.ts b/tools/watch/spinners.ts index 16766f7b98..59eb935334 100644 --- a/tools/watch/spinners.ts +++ b/tools/watch/spinners.ts @@ -2,8 +2,7 @@ import process from "node:process"; import type { WriteStream } from "node:tty"; -import { stripVTControlCharacters } from "util"; -import yoctocolors from "yoctocolors"; +import { stripVTControlCharacters, styleText } from "node:util"; const isUnicodeSupported = process.platform !== "win32" || Boolean(process.env.WT_SESSION); @@ -13,14 +12,14 @@ const isInteractive = (stream: WriteStream) => stream.isTTY && process.env.TERM !== "dumb" && !("CI" in process.env), ); -const successSymbol = yoctocolors.green(isUnicodeSupported ? "✔" : "√"); -const errorSymbol = yoctocolors.red(isUnicodeSupported ? "✖" : "×"); +const successSymbol = styleText("green", isUnicodeSupported ? "✔" : "√"); +const errorSymbol = styleText("red", isUnicodeSupported ? "✖" : "×"); const frames = ( isUnicodeSupported ? ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"] : ["-", "\\", "|", "/"] -).map(frame => yoctocolors.cyan(frame)); +).map(frame => styleText("cyan", frame)); const interval = 80; @@ -309,9 +308,9 @@ export const spinners = new Spinners( const time = dateStart.toLocaleTimeString(); let coloredTime; if (millisecondsElapsed > TIME_CUTOFF_SPIN_2) { - coloredTime = yoctocolors.red(time); + coloredTime = styleText("red", time); } else if (millisecondsElapsed > TIME_CUTOFF_SPIN_1) { - coloredTime = yoctocolors.yellow(time); + coloredTime = styleText("yellow", time); } else { coloredTime = time; } @@ -333,9 +332,9 @@ export const spinners = new Spinners( const time = dateEnd.toLocaleTimeString(); let coloredTime; if (millisecondsElapsed < TIME_CUTOFF_SUCCESS_1) { - coloredTime = yoctocolors.green(time); + coloredTime = styleText("green", time); } else if (millisecondsElapsed < TIME_CUTOFF_SUCCESS_2) { - coloredTime = yoctocolors.yellow(time); + coloredTime = styleText("yellow", time); } else { coloredTime = time; }