t-comm
Version:
专业、稳定、纯粹的工具库
58 lines (57 loc) • 1.72 kB
TypeScript
import type { IGetAuditorOptions, IGetAuditorResult } from './types';
/**
* 统一审核人获取方法,支持 rainbow / json / static 三种模式
*
* @example rainbow 模式 - 文件路径
* ```ts
* const { auditor, shouldAudit } = await getAuditor({
* type: 'rainbow',
* configSource: '/data/h5_publish_auditor.json',
* rainbowOptions: { projectName: 'pmd-mobile/match/gp', subProjectName: 'gp-hor', minimatch },
* });
* ```
*
* @example rainbow 模式 - 异步获取数据
* ```ts
* const { auditor, shouldAudit } = await getAuditor({
* type: 'rainbow',
* configSource: async () => fetchRainbowConfig(),
* rainbowOptions: { projectName: 'pmd-mobile/match/gp', subProjectName: 'gp-hor', minimatch },
* });
* ```
*
* @example json 模式(NPM/组件库发布)
* ```ts
* const { auditor, shouldAudit } = await getAuditor({
* type: 'json',
* configSource: '/data/library_publish_auditor.json',
* jsonOptions: { projectName: 'my-lib', key: 'patch' },
* });
* ```
*
* @example static 模式(灰度发布 / 回滚)
* ```ts
* const { auditor, shouldAudit } = await getAuditor({
* type: 'static',
* staticAuditorList: ['novlan1', 'lee'],
* });
* ```
*
* @example 跳过审核(如非生产环境)
* ```ts
* const { auditor, shouldAudit } = await getAuditor({
* type: 'static',
* skipAudit: !isProd,
* });
* ```
*/
export declare function getAuditor(options: IGetAuditorOptions): Promise<IGetAuditorResult>;
/**
* 转义审核描述中的反引号,防止在企微消息中出错
*
* @example
* ```ts
* escapeAuditDesc('修复`bug`') // => '修复\\`bug\\`'
* ```
*/
export declare function escapeAuditDesc(desc: string): string;