diff --git a/cli/package.json b/cli/package.json index 0dc83ead5..f95122382 100644 --- a/cli/package.json +++ b/cli/package.json @@ -36,7 +36,6 @@ "citty": "^0.2.0", "h3-next": "npm:h3@^2.0.1-rc.11", "obug": "^2.1.1", - "picocolors": "^1.1.1", "srvx": "^0.10.1", "valibot": "^1.2.0", "validate-npm-package-name": "^7.0.2" diff --git a/cli/src/cli.ts b/cli/src/cli.ts index d589c77f0..d648bff19 100644 --- a/cli/src/cli.ts +++ b/cli/src/cli.ts @@ -1,8 +1,8 @@ #!/usr/bin/env node import process from 'node:process' import { spawn } from 'node:child_process' +import { styleText } from 'node:util' import * as p from '@clack/prompts' -import pc from 'picocolors' import { defineCommand, runMain } from 'citty' import { serve } from 'srvx' import { createConnectorApp, generateToken, CONNECTOR_VERSION } from './server.ts' @@ -52,7 +52,7 @@ const main = defineCommand({ // Warning message and accept prompt logWarning( - `This allows ${pc.underline('npmx.dev')} to access your npm cli and any authenticated contexts.`, + `This allows ${styleText('underline', 'npmx.dev')} to access your npm cli and any authenticated contexts.`, ) const accept = await p.confirm({ message: 'Do you accept?', diff --git a/cli/src/logger.ts b/cli/src/logger.ts index f6a63a2a0..0cbce4adc 100644 --- a/cli/src/logger.ts +++ b/cli/src/logger.ts @@ -1,5 +1,5 @@ +import { styleText } from 'node:util' import * as p from '@clack/prompts' -import pc from 'picocolors' import { createDebug } from 'obug' let isInitialized = false @@ -10,35 +10,35 @@ let isInitialized = false export function initLogger(): void { if (isInitialized) return isInitialized = true - p.intro(pc.bgCyan(pc.black(' npmx connector '))) + p.intro(styleText(['bgCyan', 'black'], ' npmx connector ')) } /** * Log when starting to execute a command */ export function logCommand(command: string): void { - p.log.step(pc.dim('$ ') + pc.cyan(command)) + p.log.step(`${styleText('dim', '$ ')}${styleText('cyan', command)}`) } /** * Log successful command completion */ export function logSuccess(message: string): void { - p.log.success(pc.green(message)) + p.log.success(styleText('green', message)) } /** * Log command failure */ export function logError(message: string): void { - p.log.error(pc.red(message)) + p.log.error(styleText('red', message)) } /** * Log warning */ export function logWarning(message: string): void { - p.log.warn(pc.yellow(message)) + p.log.warn(styleText('yellow', message)) } /** @@ -61,9 +61,9 @@ export function showToken(token: string, port: number, frontendUrl: string): voi p.note( [ - `Open: ${pc.bold(pc.underline(pc.cyan(connectUrl)))}`, + `Open: ${styleText(['bold', 'underline', 'cyan'], connectUrl)}`, '', - pc.dim(`Or paste token manually: ${token}`), + styleText('dim', `Or paste token manually: ${token}`), ].join('\n'), 'Click to connect', ) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 79d94fb3a..b69725cf1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -288,9 +288,6 @@ importers: obug: specifier: ^2.1.1 version: 2.1.1 - picocolors: - specifier: ^1.1.1 - version: 1.1.1 srvx: specifier: ^0.10.1 version: 0.10.1