11/* eslint-disable no-console */
22import process from 'node:process'
3- import { blue , bold , cyan , dim , red , yellow } from 'kolorist'
43import { Command } from 'commander'
54import { getGitDiff , parseGitCommit } from 'changelogen'
5+ import { vipColor } from '@142vip/utils'
66import { name as packageName , version as packageVersion } from '../../package.json'
77import {
88 generateMarkdown ,
@@ -111,20 +111,20 @@ async function dealChangelog(args: ChangelogOptions) {
111111
112112 try {
113113 console . log ( )
114- console . log ( dim ( `${ bold ( '@142vip/changelog' ) } ` ) + dim ( `v${ packageVersion } ` ) )
114+ console . log ( vipColor . dim ( `${ vipColor . bold ( '@142vip/changelog' ) } ` ) + vipColor . dim ( `v${ packageVersion } ` ) )
115115
116116 const { config, markdown, commits } = await generate ( args )
117117 webUrl = generateWebUrl ( config , markdown )
118118
119- console . log ( cyan ( config . from ) + dim ( ' -> ' ) + blue ( config . to ) + dim ( ` (${ commits . length } commits)` ) )
120- console . log ( dim ( '--------------' ) )
119+ console . log ( vipColor . cyan ( config . from ) + vipColor . dim ( ' -> ' ) + vipColor . blue ( config . to ) + vipColor . dim ( ` (${ commits . length } commits)` ) )
120+ console . log ( vipColor . dim ( '--------------' ) )
121121 console . log ( )
122122 console . log ( markdown . replace ( / & n b s p ; / g, '' ) )
123123 console . log ( )
124- console . log ( dim ( '--------------' ) )
124+ console . log ( vipColor . dim ( '--------------' ) )
125125
126126 if ( config . dry ) {
127- console . log ( yellow ( '试运行。已跳过版本发布。' ) )
127+ console . log ( vipColor . yellow ( '试运行。已跳过版本发布。' ) )
128128 printUrl ( webUrl )
129129 return
130130 }
@@ -137,14 +137,14 @@ async function dealChangelog(args: ChangelogOptions) {
137137
138138 // 带token上传
139139 if ( ! config . tokens ) {
140- console . error ( red ( '未找到 GitHub 令牌,请通过 GITHUB_TOKEN 环境变量指定。已跳过版本发布。' ) )
140+ console . error ( vipColor . red ( '未找到 GitHub 令牌,请通过 GITHUB_TOKEN 环境变量指定。已跳过版本发布。' ) )
141141 printUrl ( webUrl )
142142 process . exitCode = 1
143143 return
144144 }
145145
146146 if ( ! commits . length && await isRepoShallow ( ) ) {
147- console . error ( yellow ( '存储库似乎克隆得很浅,这使得更改日志无法生成。您可能希望在 CI 配置中指定 \'fetch-depth: 0\'。' ) )
147+ console . error ( vipColor . yellow ( '存储库似乎克隆得很浅,这使得更改日志无法生成。您可能希望在 CI 配置中指定 \'fetch-depth: 0\'。' ) )
148148 printUrl ( webUrl )
149149 process . exitCode = 1
150150 return
@@ -154,9 +154,9 @@ async function dealChangelog(args: ChangelogOptions) {
154154 await sendRelease ( config , markdown )
155155 }
156156 catch ( e : any ) {
157- console . error ( red ( String ( e ) ) )
157+ console . error ( vipColor . red ( String ( e ) ) )
158158 if ( e ?. stack )
159- console . error ( dim ( e . stack ?. split ( '\n' ) . slice ( 1 ) . join ( '\n' ) ) )
159+ console . error ( vipColor . dim ( e . stack ?. split ( '\n' ) . slice ( 1 ) . join ( '\n' ) ) )
160160
161161 // 手动执行,创建release
162162 if ( webUrl ) {
0 commit comments