t-comm
Version:
专业、稳定、纯粹的工具库
51 lines (50 loc) • 1.73 kB
TypeScript
import type { CommitInfo, ProjectInfo, AnalyzeItem } from './type';
/**
* 统计代码库变更情况。分析多个项目的 Git 提交记录,生成统计数据并可选上传到 COS
* @param analyzeList - 要分析的项目列表
* @param saveDataDir - 保存统计数据的本地目录
* @param cosInfo - COS 上传配置信息(可选)
* @param cosInfo.secretId - 腾讯云 SecretId
* @param cosInfo.secretKey - 腾讯云 SecretKey
* @param cosInfo.bucket - COS 存储桶名称
* @param cosInfo.region - COS 区域
* @param cosInfo.dir - COS 目录路径
* @param analyzeBlackList - 需要排除的目录黑名单(可选)
* @returns {Promise<Array>} - 返回每个项目的统计结果数组
* @example
* ```ts
* libraryChangeStatistics({
* analyzeList: [
* { root: '/path/to/repo', project: 'my-project', git: 'https://...' }
* ],
* saveDataDir: '/tmp/stats',
* cosInfo: {
* secretId: 'xxx',
* secretKey: 'xxx',
* bucket: 'my-bucket',
* region: 'ap-guangzhou',
* dir: 'stats'
* },
* analyzeBlackList: ['node_modules', 'dist']
* }).then(result => {
* console.log('统计完成:', result);
* });
* ```
*/
export declare function libraryChangeStatistics({ analyzeList, saveDataDir, cosInfo, analyzeBlackList, }: {
analyzeList: Array<AnalyzeItem>;
saveDataDir: string;
cosInfo?: {
secretId: string;
secretKey: string;
bucket: string;
region: string;
dir: string;
};
analyzeBlackList?: string[];
}): Promise<{
data: Array<ProjectInfo>;
project: (typeof analyzeList)[number];
cdnLink: string;
}[]>;
export declare function filterCommit(commits?: Array<CommitInfo>): CommitInfo[];