Skip to content
Permalink
Browse files

chore: add changelog

  • Loading branch information
simonwong committed Dec 26, 2019
1 parent a5370cb commit 1f31ab05ad81e5f726a4b3ee7b73a0c6bf3e8566
Showing with 1,295 additions and 20 deletions.
  1. +23 −0 gulpfile.ts
  2. +1 −0 package.json
  3. +1,271 −20 yarn.lock
@@ -8,6 +8,7 @@ import {
ExtractorConfig,
ExtractorResult,
} from '@microsoft/api-extractor'
import conventionalChangelog from 'conventional-changelog'
import rollupConfig from './rollup.config'

interface TaskFunc {
@@ -103,3 +104,25 @@ const complete: TaskFunc = (cb) => {
// 3. api-extractor 生成统一的声明文件, 删除多余的声明文件
// 4. 完成
export const build = series(clearLibFile, buildByRollup, apiExtractorGenerate, complete)

// 自定义生成 changelog
export const changelog: TaskFunc = async (cb) => {
const changelogPath: string = path.join(paths.root, 'CHANGELOG.md')
// 对命令 conventional-changelog -p angular -i CHANGELOG.md -w -r 0
const changelogPipe = await conventionalChangelog({
preset: 'angular',
releaseCount: 0,
})
changelogPipe.setEncoding('utf8')

const resultArray = ['# 工具库更新日志\n\n']
changelogPipe.on('data', (chunk) => {
// 原来的 commits 路径是进入提交列表
chunk = chunk.replace(/\/commits\//g, '/commit/')
resultArray.push(chunk)
})
changelogPipe.on('end', async () => {
await fse.createWriteStream(changelogPath).write(resultArray.join(''))
cb()
})
}
@@ -31,6 +31,7 @@
"@typescript-eslint/eslint-plugin": "^2.13.0",
"@typescript-eslint/parser": "^2.13.0",
"chalk": "^3.0.0",
"conventional-changelog-cli": "^2.0.31",
"eslint": "^6.8.0",
"eslint-plugin-jest": "^23.1.1",
"fs-extra": "^8.1.0",

0 comments on commit 1f31ab0

Please sign in to comment.
You can’t perform that action at this time.