/** * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途 */ import { CommandPromiseRes, EnvCustom, ConfigOptions, PkgMap, ConfigInfoResponse, ArgsResponse, ProjectConfig, Platform, ProgressType, BranchMap, ProjectType } from "types"; /** 兼容:item-1.0.0 / item-1.0.0-01 / item.build.ios-1.0.0-01 */ export declare const tagPattern: RegExp; export declare type ParsedCiTag = { type: string; version: string; /** tag 编号,无后缀时为 0 */ buildNo: number; raw: string; }; export declare function noop(): void; /** 将 tag 编号格式化为两位:1 → 01 */ export declare function formatTagBuildNo(buildNo: number): string; /** * 解析 CI tag:业务类型、版本号、构建编号 * - weapp-1.0.0 / weapp-1.0.0-01 * - weapp.build.ios_android-1.0.0-02 */ export declare function parseCiTagName(tagName: string): ParsedCiTag | null; /** 当前任务 tag:CI 由 GitLab 注入;同进程 prepare 后由 createTag 写入 process.env */ export declare function getCiCommitTag(): string; /** 读取 git ref(tag/HEAD/sha)对应的提交说明 */ export declare function getCommitMessageFromGitRef(ref: string): Promise; /** * 补齐构建用 message: * 1. 已有 --message / CI_COMMIT_MESSAGE * 2. 非 CI 或 message 为空时,从 tag 指向的 commit 读取 * 3. tag 不存在(如虚拟 tag)则回退 HEAD * 写回 process.env 与 getArgs 缓存,供后续上传描述使用 */ export declare function ensureCommitMessage(tagName?: string): Promise; export declare type CreateProgressOptions = { /** 自定义文案前缀,默认「项目[item]构建/上传」 */ label?: string; }; /** * * @description 进度描述信息 * @param type * @param item * @param options.label 自定义文案前缀 * @returns */ export declare function CreateProgress(type: ProgressType, item: string, options?: CreateProgressOptions): void; export declare const pkgMap: PkgMap; /** * * @description 命令触发器:执行系统指令 * @param commandStr 命令行字符串 * @returns */ export declare function commandTrigger(commandStr: string, isWatch: boolean, isDebug: boolean, item: string, env?: EnvCustom): Promise; export declare function readConfig(name?: string): ConfigOptions; /** * * @description 将逗号分隔参数规范为列表(保留原始大小写,如渠道名 TXYYB) */ export declare function toNameList(value?: string | string[] | boolean): string[]; /** * * @description 将命令行平台参数规范为 ios/android 列表 */ export declare function toPlatformList(value?: string | string[] | boolean, allow?: string[]): string[]; /** * * @description 从当前任务 tag 名获取类型、版本与构建编号(不读 git tag 列表) * 优先 process.env.CI_COMMIT_TAG(tag 流水线注入,或同进程 prepare 写入) * 兼容小程序 tag(item-1.0.0 / item-1.0.0-01)与多端 app tag(item.build.ios_android-1.0.0-01) */ export declare function getTypeAndVersionFromTagName(): { type?: undefined; version?: undefined; buildNo?: undefined; tagName?: undefined; } | { type: string; version: string; buildNo: number; tagName: string; }; /** * 是否运行在 CI 环境。 * 优先认通用 `CI`(GitLab / GitHub Actions / Travis / Circle 等均会注入), * 并兼容若干平台专有变量,避免仅靠 robot 默认值误判。 */ export declare function isCiEnvironment(): boolean; /** 是否显式传入 --robot(不含 robot 默认值) */ export declare function hasExplicitRobotArg(): boolean; /** * * @description 获取命令行参数 * @returns */ export declare function getArgs(branchMap?: BranchMap): ArgsResponse; /** * * @description 获取类似Taro的环境变量,包含aliapp,weapp * @param item * @returns */ export declare function getTARO_ENV(): Platform; /** * * @param item * @returns */ export declare function getProjectConfigPath(): string; /** * * @description 读取项目配置信息 * @param item * @returns */ export declare function readProjectConfig(): Promise; export declare const compileTypeMap: { [k: string]: ProjectType; }; /** * * @description 重新微信小程序模板ext文件 * @param item */ export declare function rewriteExt(item: string): Promise; /** * * @description 重写小程序配置文件 project.config.json */ export declare function rewriteProjectConfig(item: string): Promise; /** * * @description 获取taro-ci.config.info 并根据一定规则格式化 * @param item * @param options.ignoreTagVersion 创建 tag 时忽略已有 CI_COMMIT_TAG,仅用 message/配置版本作比较基准 */ export declare function getAndFormatConfigInfo(item: string, options?: { ignoreTagVersion?: boolean; }): ConfigInfoResponse; /** * * @description 格式化指令,首位为平台信息 * @param item * @returns */ export declare function formateCommand(item: string, defaultMode?: string): [Platform, string, string]; export declare function isObject(obj: any): boolean; export declare function isArray(arr: any): boolean; /** * @description 合并数据 * @param target * @param arg * @returns */ export declare function merge(target: any, ...arg: any[]): any; /** * * @description 处理路径 * @param p * @param suffix * @returns */ export declare function resolvePath(p: string, suffix: string): string; /** * * @description 安装指令 * @param name * @returns */ export declare function installCommand(name: any): Promise;