Skip to content

Commit b73d2c0

Browse files
theoephraimclaude
andcommitted
Replace custom ANSI codes with ansis, fix CLI version display, update CI workflows
- Switch logger to ansis for proper NO_COLOR/FORCE_COLOR support - Fix help output showing "undefined" (log.bold returns void, use colorize) - Add @varlock/bumpy as root workspace dep for local usage - Update CI workflows to build before running bumpy - Fix changelog formatter import to use package name Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 225ca12 commit b73d2c0

8 files changed

Lines changed: 28 additions & 41 deletions

File tree

.bumpy/changelog-formatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ChangelogFormatter } from '../packages/bumpy/src/core/changelog.ts';
1+
import type { ChangelogFormatter } from '@varlock/bumpy';
22

33
const formatter: ChangelogFormatter = (ctx) => {
44
const { release, changesets, date } = ctx;

.github/workflows/ci.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ jobs:
1919
- uses: actions/checkout@v4
2020
- uses: oven-sh/setup-bun@v2
2121
- run: bun install
22-
# Using local source since this is bumpy's own repo — normally use the published package:
23-
# - run: bunx @varlock/bumpy ci check
24-
- run: bun packages/bumpy/src/cli.ts ci check
22+
# Build first since we use the local workspace package
23+
- run: bun run --filter @varlock/bumpy build
24+
- run: bunx bumpy ci check
2525
env:
2626
GH_TOKEN: ${{ github.token }}

.github/workflows/release.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ jobs:
1616
fetch-depth: 0
1717
- uses: oven-sh/setup-bun@v2
1818
- run: bun install
19-
# Using local source since this is bumpy's own repo — normally use the published package:
20-
# - run: bunx @varlock/bumpy ci release
21-
- run: bun packages/bumpy/src/cli.ts ci release
19+
# Build first since we use the local workspace package
20+
- run: bun run --filter @varlock/bumpy build
21+
- run: bunx bumpy ci release
2222
env:
2323
GH_TOKEN: ${{ github.token }}

bun.lock

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"postinstall": "lefthook install"
2020
},
2121
"devDependencies": {
22+
"@varlock/bumpy": "workspace:*",
2223
"lefthook": "^2.1.5",
2324
"oxfmt": "^0.45.0",
2425
"oxlint": "^1.60.0"

packages/bumpy/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"@types/bun": "latest",
2626
"@types/js-yaml": "^4.0.9",
2727
"@types/semver": "^7.7.0",
28+
"ansis": "^4.2.0",
2829
"js-yaml": "^4.1.0",
2930
"semver": "^7.7.2",
3031
"tsdown": "catalog:"

packages/bumpy/src/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22

33
import { findRoot } from './core/config.ts';
4-
import { log } from './utils/logger.ts';
4+
import { log, colorize } from './utils/logger.ts';
55

66
const args = process.argv.slice(2);
77
const command = args[0];
@@ -163,7 +163,7 @@ async function main() {
163163

164164
function printHelp() {
165165
console.log(`
166-
${log.bold('🐸 bumpy')} - Modern monorepo versioning
166+
${colorize('🐸 bumpy', 'bold')} - Modern monorepo versioning
167167
168168
Usage: bumpy <command> [options]
169169

packages/bumpy/src/utils/logger.ts

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,26 @@
1-
const RESET = '\x1b[0m';
2-
const BOLD = '\x1b[1m';
3-
const DIM = '\x1b[2m';
4-
const RED = '\x1b[31m';
5-
const GREEN = '\x1b[32m';
6-
const YELLOW = '\x1b[33m';
7-
const BLUE = '\x1b[34m';
8-
const CYAN = '\x1b[36m';
1+
import { blue, green, yellow, red, cyan, dim, bold } from 'ansis';
92

103
export const log = {
114
info(msg: string) {
12-
console.log(`${BLUE}info${RESET} ${msg}`);
5+
console.log(`${blue`info`} ${msg}`);
136
},
147
success(msg: string) {
15-
console.log(`${GREEN}done${RESET} ${msg}`);
8+
console.log(`${green`done`} ${msg}`);
169
},
1710
warn(msg: string) {
18-
console.log(`${YELLOW}warn${RESET} ${msg}`);
11+
console.log(`${yellow`warn`} ${msg}`);
1912
},
2013
error(msg: string) {
21-
console.error(`${RED}error${RESET} ${msg}`);
14+
console.error(`${red`error`} ${msg}`);
2215
},
2316
step(msg: string) {
24-
console.log(`${CYAN}=>${RESET} ${msg}`);
17+
console.log(`${cyan`=>`} ${msg}`);
2518
},
2619
dim(msg: string) {
27-
console.log(`${DIM}${msg}${RESET}`);
20+
console.log(dim`${msg}`);
2821
},
2922
bold(msg: string) {
30-
console.log(`${BOLD}${msg}${RESET}`);
23+
console.log(bold`${msg}`);
3124
},
3225
table(rows: string[][]) {
3326
if (rows.length === 0) return;
@@ -39,14 +32,6 @@ export const log = {
3932
};
4033

4134
export function colorize(text: string, color: 'red' | 'green' | 'yellow' | 'blue' | 'cyan' | 'dim' | 'bold'): string {
42-
const codes: Record<string, string> = {
43-
red: RED,
44-
green: GREEN,
45-
yellow: YELLOW,
46-
blue: BLUE,
47-
cyan: CYAN,
48-
dim: DIM,
49-
bold: BOLD,
50-
};
51-
return `${codes[color]}${text}${RESET}`;
35+
const colors = { red, green, yellow, blue, cyan, dim, bold };
36+
return colors[color](text);
5237
}

0 commit comments

Comments
 (0)