Skip to content

引入

ts
import {
  genVersionAndSendChangeLog,
  genVersionTip,
  genVersion
} from 't-comm';

// 不支持 tree-shaking 的项目
import {
  genVersionAndSendChangeLog,
  genVersionTip,
  genVersion
} from 't-comm/lib/version-tip/index';

// 只支持 ESM 的项目
import {
  genVersionAndSendChangeLog,
  genVersionTip,
  genVersion
} from 't-comm/es/version-tip/index';

genVersionAndSendChangeLog(options)

描述

运行standard-version,并且发送changelog到机器人

参数

参数名类型描述
optionsobject

配置

config.appInfoobject

package.json信息

config.rootstring

项目根路径

config.changeLogFilePathstring

changelog文件地址

config.webhookUrlstring

机器人hook地址

config.chatIdstring

会话id

genVersionTip(config)

描述

生成版本信息,可以用来发送到群聊中

参数

参数名类型描述
configobject

配置信息

config.readmeFilePathstring

changelog文件地址

config.appInfoobject

package.json信息

返回: string

版本信息

示例

typescript
const appInfo = require(`${rootPath}/package.json`);
const readmeFilePath = `${rootPath}/CHANGELOG.md`;

const content = genVersionTip({
  readmeFilePath,
  appInfo,
});

genVersion(config)

描述

自动生成version,核心是利用 standard-version 命令

参数

参数名类型描述
configobject

配置信息

config.rootstring

项目根路径

返回: boolean

是否执行了 standard-version

示例

typescript
genVersion({
  root: process.cwd()
})