Skip to content

Commit 6f83688

Browse files
authored
feat: replace picocolors with ansis (#74)
1 parent 0a09aab commit 6f83688

7 files changed

+22
-20
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@
8181
"@types/node": "^22.13.1",
8282
"@types/prompts": "^2.4.9",
8383
"@types/semver": "^7.5.8",
84+
"ansis": "^3.12.0",
8485
"eslint": "^9.19.0",
8586
"esno": "^4.8.0",
86-
"picocolors": "^1.1.1",
8787
"rimraf": "^6.0.1",
8888
"tiny-conventional-commits-parser": "^0.0.1",
8989
"typescript": "^5.7.3",

pnpm-lock.yaml

+9-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli/parse-args.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { VersionBumpOptions } from '../types/version-bump-options'
22
import process from 'node:process'
3+
import c from 'ansis'
34
import cac from 'cac'
4-
import c from 'picocolors'
55
import { valid as isValidVersion } from 'semver'
66
import { version } from '../../package.json'
77
import { bumpConfigDefaults, loadBumpConfig } from '../config'

src/cli/symbols.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import c from 'picocolors'
1+
import c from 'ansis'
22

33
export const symbols = {
44
success: c.green('✔'),

src/get-new-version.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { BumpRelease, PromptRelease } from './normalize-options'
33
import type { Operation } from './operation'
44
import type { ReleaseType } from './release-type'
55
import process from 'node:process'
6-
import c from 'picocolors'
6+
import c from 'ansis'
77
import prompts from 'prompts'
88
import semver, { clean as cleanVersion, valid as isValidVersion, SemVer } from 'semver'
99
import { isPrerelease, releaseTypes } from './release-type'

src/print-commits.ts

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { GitCommit } from 'tiny-conventional-commits-parser'
2-
import c from 'picocolors'
2+
import c from 'ansis'
33

44
const messageColorMap: Record<string, (c: string) => string> = {
55
feat: c.green,
@@ -35,13 +35,13 @@ export function formatParsedCommits(commits: GitCommit[]) {
3535
return commits.map((commit) => {
3636
let color = messageColorMap[commit.type] || ((c: string) => c)
3737
if (commit.isBreaking) {
38-
color = s => c.inverse(c.red(s))
38+
color = s => c.inverse.red(s)
3939
}
4040

4141
const paddedType = commit.type.padStart(typeLength + 1, ' ')
4242
const paddedScope = !commit.scope
4343
? ' '.repeat(scopeLength ? scopeLength + 2 : 0)
44-
: c.dim('(') + commit.scope + c.dim(')') + ' '.repeat(scopeLength - commit.scope.length)
44+
: c.dim`(` + commit.scope + c.dim`)` + ' '.repeat(scopeLength - commit.scope.length)
4545

4646
return [
4747
c.dim(commit.shortHash),
@@ -59,19 +59,15 @@ export function formatParsedCommits(commits: GitCommit[]) {
5959
export function printRecentCommits(commits: GitCommit[]): void {
6060
if (!commits.length) {
6161
console.log()
62-
console.log(c.blue(`i`) + c.gray(` No commits since the last version`))
62+
console.log(c.blue`i` + c.gray` No commits since the last version`)
6363
console.log()
6464
return
6565
}
6666

6767
const prettified = formatParsedCommits(commits)
6868

6969
console.log()
70-
console.log(
71-
c.bold(
72-
`${c.green(commits.length)} Commits since the last version:`,
73-
),
74-
)
70+
console.log(c.bold`${c.green(commits.length)} Commits since the last version:`)
7571
console.log()
7672
console.log(prettified.join('\n'))
7773
console.log()

src/version-bump.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { VersionBumpOptions } from './types/version-bump-options'
22
import type { VersionBumpResults } from './types/version-bump-results'
33
import process from 'node:process'
44
import { tokenizeArgs } from 'args-tokenizer'
5-
import c from 'picocolors'
5+
import c from 'ansis'
66
import prompts from 'prompts'
77
import { getRecentCommits } from 'tiny-conventional-commits-parser'
88
import { x } from 'tinyexec'
@@ -146,12 +146,12 @@ function printSummary(operation: Operation) {
146146
if (operation.options.execute)
147147
console.log(` execute ${c.bold(typeof operation.options.execute === 'function' ? 'function' : operation.options.execute)}`)
148148
if (operation.options.push)
149-
console.log(` push ${c.cyan(c.bold('yes'))}`)
149+
console.log(` push ${c.cyan.bold('yes')}`)
150150
if (operation.options.install)
151-
console.log(` install ${c.cyan(c.bold('yes'))}`)
151+
console.log(` install ${c.cyan.bold('yes')}`)
152152
console.log()
153153
console.log(` from ${c.bold(operation.state.currentVersion)}`)
154-
console.log(` to ${c.green(c.bold(operation.state.newVersion))}`)
154+
console.log(` to ${c.green.bold(operation.state.newVersion)}`)
155155
console.log()
156156
}
157157

0 commit comments

Comments
 (0)