@@ -49,7 +49,9 @@ function formatLine(commit: Commit, options: ResolvedChangelogOptions) {
4949 return [ description , refs ] . filter ( i => i ?. trim ( ) ) . join ( ' ' )
5050}
5151
52- // 标题
52+ /**
53+ * 格式化标题
54+ */
5355function formatTitle ( name : string , options : ResolvedChangelogOptions ) {
5456 // 加表情包
5557 if ( ! options . emoji )
@@ -58,6 +60,9 @@ function formatTitle(name: string, options: ResolvedChangelogOptions) {
5860 return `### ${ name . trim ( ) } `
5961}
6062
63+ /**
64+ * 格式化Section
65+ */
6166function formatSection ( commits : Commit [ ] , sectionName : string , options : ResolvedChangelogOptions ) {
6267 if ( ! commits . length )
6368 return [ ]
@@ -106,10 +111,12 @@ function formatSection(commits: Commit[], sectionName: string, options: Resolved
106111 . map ( commit => `${ padding } - ${ prefix } ${ formatLine ( commit , options ) } ` ) )
107112 } )
108113 }
109-
110114 return lines
111115}
112116
117+ /**
118+ * 生成Markdown文档
119+ */
113120export async function generateMarkdown ( commits : Commit [ ] , options : ResolvedChangelogOptions ) {
114121 const lines : string [ ] = [ ]
115122
@@ -154,7 +161,6 @@ export async function generateMarkdown(commits: Commit[], options: ResolvedChang
154161/**
155162 * 年月日格式化当前时间
156163 * - 格式: 2024-08-09
157- * @param date
158164 */
159165function formatDateToYMD ( date : Date = new Date ( ) ) : string {
160166 const year = date . getFullYear ( )
@@ -166,9 +172,6 @@ function formatDateToYMD(date: Date = new Date()): string {
166172
167173/**
168174 * 更新changelog
169- * @param outputPath
170- * @param markdown
171- * @param releaseVersionName
172175 */
173176export async function updateChangelog ( outputPath : string , markdown : string , releaseVersionName : string ) {
174177 let changelogMD : string
0 commit comments