2.0.0 • Published 2 years ago
@licq/git v2.0.0
@licq/git
封装一些操作 git 信息的方法
安装
npm i --save-dev @licq/git
API
getGitUserInfo
获取当前仓库的Git用户信息
Returns: Object
Since: v1.0.0
Example
const git = require('@licq/git')
const res = git.getGitUserInfo()
//==> eg: { userName: 'ostwindli', userEmail: 'ostwindli@tencent.com' }
getGitChangelog
根据git项目,生成对应的changelog的markdown内容
Returns: String
Since: v2.0.0
Param | Type | Description |
---|---|---|
Params | Object | 参数 |
Params.gitProjectPath | String | git项目路径 必填 eg:"/Users/xxx/asenal" |
Params.gitCommitRepo | String | git项目仓库提交路径 必填 eg: "https://github.com/ostwindli/asenal/commit" |
Params.titleArray | Array | undefined | 生成的changlog头信息 可选 eg:'# 更新日志', '更新内容简介xxx' |
Params.markdownFile | String | undefined | 生成的markdown文件路径 可选 eg:"/Users/xxx/asenal/CHANGELOG.md" |
Example
const git = require('@licq/git')
const res = git.getGitChangelog({
gitProjectPath: __dirname,
gitCommitRepo: 'https://github.com/ostwindli/asenal/commit',
titleArray: ['# 更新日志', '\n这是一个测试changelog'],
markdownFile: '/Users/xxx/asenal/CHANGELOG.md'
})x
//==> eg: https://mpqq.gtimg.cn/ost/asenal/changelog_demo.png