t-comm
Version:
专业、稳定、纯粹的工具库
45 lines (44 loc) • 1.8 kB
TypeScript
import type { IAppInfo, PackageSizeInfo } from './types';
export declare function parseChangeLog({ changelogStr, targetVersion, }: {
changelogStr: string;
targetVersion: string;
}): string;
/**
* 生成版本信息,可以用来发送到群聊中
* @param {object} config 配置信息
* @param {string} config.readmeFilePath changelog文件地址
* @param {object} config.appInfo package.json信息
* @param {boolean} [config.showNpmLink] 是否显示 npm 链接(默认走 npmjs.com,被 npmLink 覆盖时优先用 npmLink)
* @param {string} [config.publisher] 发布者别名,传入后会在末尾 `@发布者`
* @param {string} [config.npmLink] 自定义 npm 详情页地址(如腾讯内部镜像),优先级高于 showNpmLink
* @param {string} [config.pipelineUrl] 流水线/构建地址,调用方自行解析(蓝盾 BK_CI_* env 等)
* @param {object} [config.packageSize] 包体积信息,存在时会渲染「📦 包体积」区块
* @returns {string} 版本信息
* @example
*
* const appInfo = require(`${rootPath}/package.json`);
* const readmeFilePath = `${rootPath}/CHANGELOG.md`;
*
* const content = genVersionTip({
* readmeFilePath,
* appInfo,
* npmLink: 'https://mirrors.tencent.com/...',
* pipelineUrl: 'https://devops.woa.com/...',
* packageSize: {
* oldSize: 1234567,
* newSize: 1230000,
* oldUnpacked: 4500000,
* newUnpacked: 4490000,
* fileCount: 256,
* },
* });
*/
export declare function genVersionTip({ readmeFilePath, appInfo, showNpmLink, publisher, npmLink, pipelineUrl, packageSize, }: {
showNpmLink?: boolean;
readmeFilePath: string;
appInfo: IAppInfo;
publisher?: string;
npmLink?: string;
pipelineUrl?: string;
packageSize?: PackageSizeInfo;
}): string;