1 Star 0 Fork 50

刘兴业/lunisolar

forked from 簡 Kan/lunisolar 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
changelog-config.js 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
簡 Kan 提交于 2023-02-06 13:08 . chore: 自定义changelog类型
module.exports = {
writerOpts: {
transform: (commit, context) => {
const issues = []
if (commit.type === 'feat') {
commit.type = '✨ Features'
} else if (commit.type === 'fix') {
commit.type = '🐛 Bug Fixes'
} else if (commit.type === 'perf') {
commit.type = '⚡ Performance Improvements'
} else if (commit.type === 'revert' || commit.revert) {
commit.type = '⏪ Reverts'
} else {
return
}
if (typeof commit.hash === 'string') {
commit.shortHash = commit.hash.substring(0, 7)
}
if (typeof commit.subject === 'string') {
let url = context.repository
? `${context.host}/${context.owner}/${context.repository}`
: context.repoUrl
if (url) {
url = `${url}/issues/`
// Issue URLs.
commit.subject = commit.subject.replace(/#([0-9]+)/g, (_, issue) => {
issues.push(issue)
return `[#${issue}](${url}${issue})`
})
}
if (context.host) {
// User URLs.
commit.subject = commit.subject.replace(
/\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g,
(_, username) => {
if (username.includes('/')) {
return `@${username}`
}
return `[@${username}](${context.host}/${username})`
}
)
}
}
// remove references that already appear in the subject
commit.references = commit.references.filter(reference => {
if (issues.indexOf(reference.issue) === -1) {
return true
}
return false
})
return commit
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liu-xingye/lunisolar.git
git@gitee.com:liu-xingye/lunisolar.git
liu-xingye
lunisolar
lunisolar
main

搜索帮助