[READ-ONLY] a fast, modern browser for the npm registry
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(cli): replace picocolors with styleText (#1070)

authored by

paul valladares and committed by
GitHub
588e1a1f a51e4bd1

+10 -14
-1
cli/package.json
··· 36 36 "citty": "^0.2.0", 37 37 "h3-next": "npm:h3@^2.0.1-rc.11", 38 38 "obug": "^2.1.1", 39 - "picocolors": "^1.1.1", 40 39 "srvx": "^0.10.1", 41 40 "valibot": "^1.2.0", 42 41 "validate-npm-package-name": "^7.0.2"
+2 -2
cli/src/cli.ts
··· 1 1 #!/usr/bin/env node 2 2 import process from 'node:process' 3 3 import { spawn } from 'node:child_process' 4 + import { styleText } from 'node:util' 4 5 import * as p from '@clack/prompts' 5 - import pc from 'picocolors' 6 6 import { defineCommand, runMain } from 'citty' 7 7 import { serve } from 'srvx' 8 8 import { createConnectorApp, generateToken, CONNECTOR_VERSION } from './server.ts' ··· 52 52 53 53 // Warning message and accept prompt 54 54 logWarning( 55 - `This allows ${pc.underline('npmx.dev')} to access your npm cli and any authenticated contexts.`, 55 + `This allows ${styleText('underline', 'npmx.dev')} to access your npm cli and any authenticated contexts.`, 56 56 ) 57 57 const accept = await p.confirm({ 58 58 message: 'Do you accept?',
+8 -8
cli/src/logger.ts
··· 1 + import { styleText } from 'node:util' 1 2 import * as p from '@clack/prompts' 2 - import pc from 'picocolors' 3 3 import { createDebug } from 'obug' 4 4 5 5 let isInitialized = false ··· 10 10 export function initLogger(): void { 11 11 if (isInitialized) return 12 12 isInitialized = true 13 - p.intro(pc.bgCyan(pc.black(' npmx connector '))) 13 + p.intro(styleText(['bgCyan', 'black'], ' npmx connector ')) 14 14 } 15 15 16 16 /** 17 17 * Log when starting to execute a command 18 18 */ 19 19 export function logCommand(command: string): void { 20 - p.log.step(pc.dim('$ ') + pc.cyan(command)) 20 + p.log.step(`${styleText('dim', '$ ')}${styleText('cyan', command)}`) 21 21 } 22 22 23 23 /** 24 24 * Log successful command completion 25 25 */ 26 26 export function logSuccess(message: string): void { 27 - p.log.success(pc.green(message)) 27 + p.log.success(styleText('green', message)) 28 28 } 29 29 30 30 /** 31 31 * Log command failure 32 32 */ 33 33 export function logError(message: string): void { 34 - p.log.error(pc.red(message)) 34 + p.log.error(styleText('red', message)) 35 35 } 36 36 37 37 /** 38 38 * Log warning 39 39 */ 40 40 export function logWarning(message: string): void { 41 - p.log.warn(pc.yellow(message)) 41 + p.log.warn(styleText('yellow', message)) 42 42 } 43 43 44 44 /** ··· 61 61 62 62 p.note( 63 63 [ 64 - `Open: ${pc.bold(pc.underline(pc.cyan(connectUrl)))}`, 64 + `Open: ${styleText(['bold', 'underline', 'cyan'], connectUrl)}`, 65 65 '', 66 - pc.dim(`Or paste token manually: ${token}`), 66 + styleText('dim', `Or paste token manually: ${token}`), 67 67 ].join('\n'), 68 68 'Click to connect', 69 69 )
-3
pnpm-lock.yaml
··· 291 291 obug: 292 292 specifier: ^2.1.1 293 293 version: 2.1.1 294 - picocolors: 295 - specifier: ^1.1.1 296 - version: 1.1.1 297 294 srvx: 298 295 specifier: ^0.10.1 299 296 version: 0.10.1