import type { IUploadResult, OptionsType } from './types'; declare class MpCI { ciLib: any; options: OptionsType; projectCI: any; savePreviewPath: any; appId: string; appName: string; type: string; root: string; ignores: Array; pkgFile: string; env: string; robotNumber: number; webhookUrl?: string; chatId?: string; buildSetting: any; projectPath: string; privateKeyPath: string; cosInfo: any; commitInfo: any; buildDesc: string; buildTime?: string; version: string; previewResult: IUploadResult; errorLink?: string; pagePath?: string; searchQuery?: string; tryTimesMap: { UPLOAD: number; PREVIEW: number; }; /** * 小程序自动化构建工具 * @param {object} options 选项 * * @example * * const { MpCI, fetchRainbowConfig } = require('t-comm'); * * const env = "${env}" * const branch = "${branch}" * * const root = "${WORKSPACE}"; * * async function getCIConfig() { * let res = {}; * const str = await fetchRainbowConfig('mp_ci', { * appId: '', * envName: 'x', * groupName: 'x', * }); * try { * res = JSON.parse(str); * } catch (err) {} * return res; * } * * function getRobot(config = {}) { * return config?.robotMap?.[branch]?.[env] || 1; * } * * async function main() { * const config = await getCIConfig(); * console.log('config: \n', config, typeof config); * const { * appName, * appId, * webhookUrl, * chatId, * cosInfo, * } = config; * * const ci = new MpCI({ * appName, * appId, * root, * env, * robotNumber: getRobot(config), * * webhookUrl, * chatId, * * cosInfo, * }); * * await ci.upload(); * await ci.preview(); * await ci.sendRobotMsg(); * } * * main(); */ constructor(options: OptionsType); validateOptions(): void; initBaseInfo(): void; init(): void; getBuildTime(): void; /** * 上传 */ upload(): Promise; tryUpload(): Promise; preview(): Promise; /** * 预览 */ tryPreview(): Promise; /** * 上传预览图片到COS */ uploadPreviewImg(previewResult: IUploadResult): Promise; getCosKey(): string; getCOSFilePath(): string; /** * 发送机器人消息 */ sendRobotMsg(hasImg?: boolean): Promise; uploadAndPreview(): Promise; uploadFiles(files: Array<{ key: string; path: string; }>): Promise; } export { MpCI };