diff --git a/CHANGELOG.md b/CHANGELOG.md index 067a1c8..ceb0748 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [1.4.0](https://github.com/analyticsjs/git-commit-analytics/compare/v1.3.1...v1.4.0) (2022-07-13) + + +### Features + +* filter duplicate messages when generate report ([206f3db](https://github.com/analyticsjs/git-commit-analytics/commit/206f3dbc00739d0d4adfaa6c99b2047fa479ab1a)) + ## [1.3.1](https://github.com/analyticsjs/git-commit-analytics/compare/v1.3.0...v1.3.1) (2022-07-11) diff --git a/Git_Commit_Analytics_mac.zip b/Git_Commit_Analytics_mac.zip index 42361f4..af625d4 100644 Binary files a/Git_Commit_Analytics_mac.zip and b/Git_Commit_Analytics_mac.zip differ diff --git a/Git_Commit_Analytics_win.zip b/Git_Commit_Analytics_win.zip index 0f5cfcc..50fdf5a 100644 Binary files a/Git_Commit_Analytics_win.zip and b/Git_Commit_Analytics_win.zip differ diff --git a/README.md b/README.md index 396c8bb..837f080 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ key|type|description :-:|:-:|:-- lang|string|Set program default language, support `en` (English) and `zh` (Simplified Chinese).
设置软件的默认语言,支持 `en` (英语)和 `zh` (简体中文)。 authors|string[]|Filter the author name of commits, support multiple author names, for you may have different names in different repos.
筛选 commit 的作者名称,支持多个作者名称,用于你在不同的仓库可能有不同的名字。 -dateRange|[string, string]|Fill in [start date, end date], support the legal time format, and count from the start date `00:00:00` to the end date `23:59:59`.
填写 [开始日期, 结束日期] , 支持合法的时间格式,会从开始日期的 `00:00:00` 统计到截止日期的 `23:59:59` 。 +dateRange|[string, string]|Fill in [start date, end date], support the legal time format, and count from the start date `00:00:00` to the end date `23:59:59`(If not configured, the default day to run the program).
填写 [开始日期, 结束日期] , 支持合法的时间格式,会从开始日期的 `00:00:00` 统计到截止日期的 `23:59:59` (如果不配置则默认运行程序的当天)。 repos|string[]|The Git repo folder on your computer, need to be switched to the branch you want to count.
你电脑里的 Git 仓库文件夹,需要提前切换到你要统计的分支。 format|{ [key: string]: string }|Format your folder name as the project name.
格式化你的文件夹名称为项目名。 includes|string[]|The commit message prefix to be included in the statistics.
要纳入统计的 commit message 前缀。 diff --git a/src/index.js b/src/index.js index 48aee73..5207427 100644 --- a/src/index.js +++ b/src/index.js @@ -79,7 +79,7 @@ function start() { logs.forEach((log) => allLogs.push(`${repoName}|||${log}`)) }) - // Deduplicate + // Deduplicate Logs const uniqueLogs = [...new Set(allLogs)] // Get target data @@ -95,7 +95,13 @@ function start() { // Classify targetList.forEach((item) => { - const { repo, type } = item + const { repo, type, msg } = item + + // Filter duplicate messages + const msgs = result[repo][type].map((i) => i.msg) + if (msgs.includes(msg)) return + + // Add log record result[repo][type].push(item) }) diff --git a/src/libs/saveReport.js b/src/libs/saveReport.js index 1d44c01..77e0f8d 100644 --- a/src/libs/saveReport.js +++ b/src/libs/saveReport.js @@ -40,19 +40,19 @@ module.exports = function ({ result, isEN }) { list.forEach((item, index) => { const { repo, category, msg } = item - // Repo name as h2 + // Repo name as `

` if (!titles.includes(repo)) { appendFileSync(reportFile, `## ${repo}\n\n`) titles.push(repo) } - // Category as h3 + // Category as `

` if (!categories.includes(category)) { appendFileSync(reportFile, `### ${category}\n`) categories.push(category) } - // Commit message as list item + // Commit message as `
  • ` appendFileSync(reportFile, `${index + 1}. ${msg}\n`) if (index === list.length - 1) {