Replace kleur with ansis for CLI colors

This commit is contained in:
Chris Wanstrath 2026-03-09 18:39:14 -07:00
parent 21e300df90
commit 18834fcd2b
9 changed files with 17 additions and 15 deletions

View File

@ -16,7 +16,7 @@ Personal web appliance that auto-discovers and runs multiple web apps on your ho
- **Bun** runtime (not Node)
- **Hype** (custom HTTP framework wrapping Hono) from `@because/hype`
- **Forge** (typed CSS-in-JS) from `@because/forge`
- **Commander** + **kleur** for CLI
- **Commander** + **ansis** for CLI
- TypeScript + Hono JSX
- Client renders with `hono/jsx/dom` (no build step, served directly)

View File

@ -9,9 +9,9 @@
"@because/hype": "^0.0.2",
"@because/sneaker": "^0.0.4",
"@because/toes": "^0.0.12",
"ansis": "^4.2.0",
"commander": "14.0.3",
"diff": "^8.0.3",
"kleur": "^4.1.5",
},
"devDependencies": {
"@types/bun": "latest",
@ -37,6 +37,8 @@
"@types/node": ["@types/node@25.2.3", "https://npm.nose.space/@types/node/-/node-25.2.3.tgz", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-m0jEgYlYz+mDJZ2+F4v8D1AyQb+QzsNqRuI7xg1VQX/KlKS0qT9r1Mo16yo5F/MtifXFgaofIFsdFMox2SxIbQ=="],
"ansis": ["ansis@4.2.0", "https://npm.nose.space/ansis/-/ansis-4.2.0.tgz", {}, "sha512-HqZ5rWlFjGiV0tDm3UxxgNRqsOTniqoKZu0pIAfh7TZQMGuZK+hH0drySty0si0QXj1ieop4+SkSfPZBPPkHig=="],
"bun-types": ["bun-types@1.3.10", "https://npm.nose.space/bun-types/-/bun-types-1.3.10.tgz", { "dependencies": { "@types/node": "*" } }, "sha512-tcpfCCl6XWo6nCVnpcVrxQ+9AYN1iqMIzgrSKYMB/fjLtV2eyAVEg7AxQJuCq/26R6HpKWykQXuSOq/21RYcbg=="],
"commander": ["commander@14.0.3", "https://npm.nose.space/commander/-/commander-14.0.3.tgz", {}, "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw=="],

View File

@ -48,8 +48,8 @@
"@because/hype": "^0.0.2",
"@because/sneaker": "^0.0.4",
"@because/toes": "^0.0.12",
"ansis": "^4.2.0",
"commander": "14.0.3",
"diff": "^8.0.3",
"kleur": "^4.1.5"
"diff": "^8.0.3"
}
}

View File

@ -1,5 +1,5 @@
import type { LogLine } from '@types'
import color from 'kleur'
import color from 'ansis'
import { get, getSignal, handleError, makeUrl, post } from '../http'
import { resolveAppName } from '../name'

View File

@ -1,4 +1,4 @@
import color from 'kleur'
import color from 'ansis'
import { del, get, handleError, post } from '../http'
import { resolveAppName } from '../name'
@ -43,7 +43,7 @@ async function globalEnvSet(keyOrKeyValue: string, valueArg?: string) {
export async function envList(name: string | undefined, opts: { global?: boolean }) {
if (opts.global) {
const vars = await get<EnvVar[]>('/api/env')
console.log(color.bold().cyan('Global Environment Variables'))
console.log(color.bold.cyan('Global Environment Variables'))
console.log()
if (!vars || vars.length === 0) {
console.log(color.gray(' No global environment variables set'))
@ -68,7 +68,7 @@ export async function envList(name: string | undefined, opts: { global?: boolean
return
}
console.log(color.bold().cyan(`Environment Variables for ${appName}`))
console.log(color.bold.cyan(`Environment Variables for ${appName}`))
console.log()
const appKeys = new Set(vars.map(v => v.key))

View File

@ -1,6 +1,6 @@
import type { App } from '@types'
import { generateTemplates, type TemplateType } from '%templates'
import color from 'kleur'
import color from 'ansis'
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs'
import { basename, join } from 'path'
import { buildAppUrl } from '@urls'

View File

@ -1,4 +1,4 @@
import color from 'kleur'
import color from 'ansis'
import { get } from '../http'
import { resolveAppName } from '../name'

View File

@ -1,6 +1,6 @@
import { program } from 'commander'
import color from 'kleur'
import color from 'ansis'
import pkg from '../../package.json'
import { SHA } from './sha'
@ -33,7 +33,7 @@ program
.version(`v${pkg.version}-${SHA}`, '-v, --version')
.addHelpText('beforeAll', (ctx) => {
if (ctx.command === program) {
return color.bold().cyan('🐾 Toes') + color.gray(' - personal web appliance\n')
return color.bold.cyan('🐾 Toes') + color.gray(' - personal web appliance\n')
}
return ''
})

View File

@ -2,7 +2,7 @@ import type { App } from '@types'
import * as readline from 'readline'
import color from 'kleur'
import color from 'ansis'
import { get, handleError, HOST, withSignal } from './http'
import { program } from './setup'
@ -66,7 +66,7 @@ function getCommandNames(): string[] {
async function printBanner(): Promise<void> {
const apps = await get<App[]>('/api/apps')
if (!apps) {
console.log(color.bold().cyan(' \u{1F43E} Toes') + ` ${HOST}`)
console.log(color.bold.cyan(' \u{1F43E} Toes') + ` ${HOST}`)
console.log()
return
}
@ -78,7 +78,7 @@ async function printBanner(): Promise<void> {
const visibleApps = apps.filter(a => !a.tool)
console.log()
console.log(color.bold().cyan(' \u{1F43E} Toes') + ` ${HOST}`)
console.log(color.bold.cyan(' \u{1F43E} Toes') + ` ${HOST}`)
console.log()
// App status line