@huoye/app-ship 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -10,15 +10,62 @@ interface UploadConfig {
10
10
  build?: {
11
11
  /** Android 构建配置 */
12
12
  android?: {
13
- /** 构建产物类型:apk 或 appbundle */
13
+ /**
14
+ * 构建类型: apk 或 appbundle (aab)
15
+ * @default 'apk'
16
+ */
14
17
  type?: 'apk' | 'appbundle';
15
- /** 构建风味(Flavor) */
18
+ /**
19
+ * 是否按 CPU 架构分开打包 (--split-per-abi)
20
+ * 将生成多个 APK (如 arm64 和 arm32),自动适配多包上传
21
+ */
22
+ splitPerAbi?: boolean;
23
+ /**
24
+ * 是否开启 Dart 代码混淆 (--obfuscate)
25
+ */
26
+ obfuscate?: boolean;
27
+ /**
28
+ * 调试符号导出路径,开启混淆时必须配合使用
29
+ * @default 'build/debug-info'
30
+ */
31
+ splitDebugInfo?: string;
32
+ /**
33
+ * Dart 编译期环境变量注入 (-d)
34
+ */
35
+ dartDefines?: Record<string, string>;
36
+ /**
37
+ * 专家模式附加参数扩展(自动拼接到命令末尾)
38
+ */
39
+ extraArgs?: string[];
40
+ /**
41
+ * 完全自定义构建命令,配置此项后以上所有构建参数均失效
42
+ * 仅供具有极特殊构建场景的专家用户使用
43
+ */
44
+ customCommand?: string;
45
+ /** Product Flavor (--flavor) */
16
46
  flavor?: string;
17
- /** 构建目标 */
47
+ /** Target platform/lib (--target) */
18
48
  target?: string;
19
- /** 构建名称 */
49
+ /**
50
+ * 注入系统环境变量 (process.env)
51
+ */
52
+ envs?: Record<string, string>;
53
+ /**
54
+ * 构建前执行脚本
55
+ */
56
+ preBuild?: string;
57
+ /**
58
+ * 构建后执行脚本
59
+ */
60
+ postBuild?: string;
61
+ /**
62
+ * 是否在构建前执行 flutter clean
63
+ * @default false
64
+ */
65
+ clean?: boolean;
66
+ /** 版本名称 (覆盖 pubspec.yaml) */
20
67
  buildName?: string;
21
- /** 构建号 */
68
+ /** 构建号 (覆盖 pubspec.yaml) */
22
69
  buildNumber?: string;
23
70
  };
24
71
  /** iOS 构建配置 */
@@ -31,6 +78,77 @@ interface UploadConfig {
31
78
  teamId?: string;
32
79
  /** 构建配置:Debug 或 Release */
33
80
  configuration?: string;
81
+ /** 是否使用 exportOptions.plist (默认自动生成命令) */
82
+ useExportOptions?: boolean;
83
+ /** 自定义导出配置文件路径 */
84
+ exportOptionsPlist?: string;
85
+ /**
86
+ * 是否开启 Dart 代码混淆 (--obfuscate)
87
+ */
88
+ obfuscate?: boolean;
89
+ /**
90
+ * 调试符号导出路径,开启混淆时必须配合使用
91
+ * @default 'build/debug-info'
92
+ */
93
+ splitDebugInfo?: string;
94
+ /**
95
+ * Dart 编译期环境变量注入 (-d)
96
+ */
97
+ dartDefines?: Record<string, string>;
98
+ /**
99
+ * 专家模式附加参数扩展(自动拼接到命令末尾)
100
+ */
101
+ extraArgs?: string[];
102
+ /**
103
+ * 完全自定义构建命令,配置此项后以上所有构建参数均失效
104
+ */
105
+ customCommand?: string;
106
+ /** Target platform/lib (--target) */
107
+ target?: string;
108
+ /**
109
+ * 注入系统环境变量 (process.env)
110
+ */
111
+ envs?: Record<string, string>;
112
+ /**
113
+ * 构建前执行脚本
114
+ */
115
+ preBuild?: string;
116
+ /**
117
+ * 构建后执行脚本
118
+ */
119
+ postBuild?: string;
120
+ /**
121
+ * 是否在构建前执行 flutter clean
122
+ * @default false
123
+ */
124
+ clean?: boolean;
125
+ /** 版本名称 (覆盖 pubspec.yaml) */
126
+ buildName?: string;
127
+ /** 构建号 (覆盖 pubspec.yaml) */
128
+ buildNumber?: string;
129
+ };
130
+ /** HarmonyOS 构建配置 */
131
+ harmony?: {
132
+ /** 构建类型: hap (调试/安装) 或 app (发布/应用) */
133
+ type?: 'hap' | 'app';
134
+ /** Dart 编译期环境变量注入 (-d) */
135
+ dartDefines?: Record<string, string>;
136
+ /** 注入系统环境变量 (process.env) */
137
+ envs?: Record<string, string>;
138
+ /** 构建前执行脚本 */
139
+ preBuild?: string;
140
+ /** 构建后执行脚本 */
141
+ postBuild?: string;
142
+ /** 是否在构建前执行 flutter clean */
143
+ clean?: boolean;
144
+ /** 附加参数 */
145
+ extraArgs?: string[];
146
+ /** 完全自定义构建命令 */
147
+ customCommand?: string;
148
+ /** 版本名称 */
149
+ buildName?: string;
150
+ /** 构建号 */
151
+ buildNumber?: string;
34
152
  };
35
153
  };
36
154
  /** 所有上传操作的重试配置 */
@@ -309,8 +427,10 @@ interface AppMetadata {
309
427
  changelog: string;
310
428
  /** 本次要上传到的平台列表 */
311
429
  platform?: string[];
312
- /** 构建产物路径(apk/ipa) */
313
- artifactPath?: string;
430
+ /** 构建产物路径(apk/ipa,支持 Record<ABI, Path> 形式以适配多架构) */
431
+ artifactPath?: string | Record<string, string>;
432
+ /** 按平台保留的产物集合,供上传调度层选择单包或多架构组合 */
433
+ platformArtifacts?: Record<string, string | Record<string, string>>;
314
434
  /** 全局工具链设置 */
315
435
  globalSettings?: {
316
436
  /** Android SDK 路径 */
@@ -375,12 +495,16 @@ interface IUploader {
375
495
  interface BuildResult {
376
496
  /** 是否成功 */
377
497
  success: boolean;
378
- /** 构建产物路径 */
379
- artifactPath: string;
498
+ /**
499
+ * 产物路径
500
+ * - 单包时返回路径字符串
501
+ * - 多架构分包时返回字典映射,如 { 'arm64-v8a': 'path/to/apk64', 'armeabi-v7a': 'path/to/apk32' }
502
+ */
503
+ artifactPath: string | Record<string, string>;
380
504
  /** 构建耗时(毫秒) */
381
505
  buildTime: number;
382
- /** 平台:android | ios */
383
- platform: 'android' | 'ios';
506
+ /** 平台:android | ios | harmony */
507
+ platform: 'android' | 'ios' | 'harmony';
384
508
  }
385
509
 
386
510
  declare class EnvValidator {
@@ -580,9 +704,6 @@ declare class XiaomiUploader implements IUploader {
580
704
  categoryName: string;
581
705
  }[] | null>;
582
706
  upload(filePath: string, config: any, metadata: AppMetadata): Promise<UploadResult>;
583
- /**
584
- * 执行实际的上传操作
585
- */
586
707
  private performUpload;
587
708
  /**
588
709
  * 解析公钥: 优先使用内容字段, 其次从文件路径读取
@@ -983,45 +1104,18 @@ declare class OppoUploader implements IUploader {
983
1104
  *
984
1105
  * 基于 vivo 开放平台「应用分发 API」实现 (协议与腾讯开放平台 Open-QQ 规范一致)
985
1106
  * 文档: https://dev.vivo.com.cn/documentCenter/doc/326
986
- *
987
- * 上传流程:
988
- * 1. 使用 access_key + access_secret 生成签名
989
- * 2. 获取上传地址 (分段上传或直传)
990
- * 3. 上传 APK 文件
991
- * 4. 提交版本更新信息
992
- *
993
- * 签名方式: HMAC-SHA256(params_sorted, access_secret) → 16进制字符串
994
1107
  */
995
1108
  declare class VivoUploader implements IUploader {
996
1109
  name: string;
997
1110
  /** vivo 开放 API 基础地址 */
998
1111
  private static readonly API_BASE;
999
- /**
1000
- * vivo API 签名生成
1001
- * 规则: 所有参数按 ASCII 码排序后拼接为 key=val&... 字符串,
1002
- * 以 accessSecret 为密钥进行 HMAC-SHA256 加密,结果转为小写 16 进制字符串
1003
- */
1004
1112
  private generateSign;
1005
1113
  validateConfig(config: any): boolean;
1006
1114
  canHandle(filePath: string): boolean;
1007
1115
  upload(filePath: string, config: any, metadata: AppMetadata): Promise<UploadResult>;
1008
- /**
1009
- * 计算文件 MD5
1010
- */
1011
1116
  private calculateFileMD5;
1012
- /**
1013
- * 上传 APK 文件并获取流水号
1014
- * 将公共参数与业务参数放入一个 multipart 请求中直接上传至 API_BASE
1015
- */
1016
1117
  private uploadApk;
1017
- /**
1018
- * 提交版本更新信息
1019
- */
1020
1118
  private submitVersion;
1021
- /**
1022
- * 格式化错误信息
1023
- */
1024
- private formatError;
1025
1119
  }
1026
1120
 
1027
1121
  /**
@@ -1187,6 +1281,12 @@ declare class UploadManager {
1187
1281
  * 上传到单个平台
1188
1282
  */
1189
1283
  private uploadToPlatform;
1284
+ private shouldGroupArtifacts;
1285
+ private resolveArtifactSelection;
1286
+ private buildArtifactMapFromFiles;
1287
+ private inferArtifactKey;
1288
+ private getRepresentativeFilePath;
1289
+ private validateArtifactSelection;
1190
1290
  /**
1191
1291
  * 聚合上传结果
1192
1292
  */
package/dist/index.d.ts CHANGED
@@ -10,15 +10,62 @@ interface UploadConfig {
10
10
  build?: {
11
11
  /** Android 构建配置 */
12
12
  android?: {
13
- /** 构建产物类型:apk 或 appbundle */
13
+ /**
14
+ * 构建类型: apk 或 appbundle (aab)
15
+ * @default 'apk'
16
+ */
14
17
  type?: 'apk' | 'appbundle';
15
- /** 构建风味(Flavor) */
18
+ /**
19
+ * 是否按 CPU 架构分开打包 (--split-per-abi)
20
+ * 将生成多个 APK (如 arm64 和 arm32),自动适配多包上传
21
+ */
22
+ splitPerAbi?: boolean;
23
+ /**
24
+ * 是否开启 Dart 代码混淆 (--obfuscate)
25
+ */
26
+ obfuscate?: boolean;
27
+ /**
28
+ * 调试符号导出路径,开启混淆时必须配合使用
29
+ * @default 'build/debug-info'
30
+ */
31
+ splitDebugInfo?: string;
32
+ /**
33
+ * Dart 编译期环境变量注入 (-d)
34
+ */
35
+ dartDefines?: Record<string, string>;
36
+ /**
37
+ * 专家模式附加参数扩展(自动拼接到命令末尾)
38
+ */
39
+ extraArgs?: string[];
40
+ /**
41
+ * 完全自定义构建命令,配置此项后以上所有构建参数均失效
42
+ * 仅供具有极特殊构建场景的专家用户使用
43
+ */
44
+ customCommand?: string;
45
+ /** Product Flavor (--flavor) */
16
46
  flavor?: string;
17
- /** 构建目标 */
47
+ /** Target platform/lib (--target) */
18
48
  target?: string;
19
- /** 构建名称 */
49
+ /**
50
+ * 注入系统环境变量 (process.env)
51
+ */
52
+ envs?: Record<string, string>;
53
+ /**
54
+ * 构建前执行脚本
55
+ */
56
+ preBuild?: string;
57
+ /**
58
+ * 构建后执行脚本
59
+ */
60
+ postBuild?: string;
61
+ /**
62
+ * 是否在构建前执行 flutter clean
63
+ * @default false
64
+ */
65
+ clean?: boolean;
66
+ /** 版本名称 (覆盖 pubspec.yaml) */
20
67
  buildName?: string;
21
- /** 构建号 */
68
+ /** 构建号 (覆盖 pubspec.yaml) */
22
69
  buildNumber?: string;
23
70
  };
24
71
  /** iOS 构建配置 */
@@ -31,6 +78,77 @@ interface UploadConfig {
31
78
  teamId?: string;
32
79
  /** 构建配置:Debug 或 Release */
33
80
  configuration?: string;
81
+ /** 是否使用 exportOptions.plist (默认自动生成命令) */
82
+ useExportOptions?: boolean;
83
+ /** 自定义导出配置文件路径 */
84
+ exportOptionsPlist?: string;
85
+ /**
86
+ * 是否开启 Dart 代码混淆 (--obfuscate)
87
+ */
88
+ obfuscate?: boolean;
89
+ /**
90
+ * 调试符号导出路径,开启混淆时必须配合使用
91
+ * @default 'build/debug-info'
92
+ */
93
+ splitDebugInfo?: string;
94
+ /**
95
+ * Dart 编译期环境变量注入 (-d)
96
+ */
97
+ dartDefines?: Record<string, string>;
98
+ /**
99
+ * 专家模式附加参数扩展(自动拼接到命令末尾)
100
+ */
101
+ extraArgs?: string[];
102
+ /**
103
+ * 完全自定义构建命令,配置此项后以上所有构建参数均失效
104
+ */
105
+ customCommand?: string;
106
+ /** Target platform/lib (--target) */
107
+ target?: string;
108
+ /**
109
+ * 注入系统环境变量 (process.env)
110
+ */
111
+ envs?: Record<string, string>;
112
+ /**
113
+ * 构建前执行脚本
114
+ */
115
+ preBuild?: string;
116
+ /**
117
+ * 构建后执行脚本
118
+ */
119
+ postBuild?: string;
120
+ /**
121
+ * 是否在构建前执行 flutter clean
122
+ * @default false
123
+ */
124
+ clean?: boolean;
125
+ /** 版本名称 (覆盖 pubspec.yaml) */
126
+ buildName?: string;
127
+ /** 构建号 (覆盖 pubspec.yaml) */
128
+ buildNumber?: string;
129
+ };
130
+ /** HarmonyOS 构建配置 */
131
+ harmony?: {
132
+ /** 构建类型: hap (调试/安装) 或 app (发布/应用) */
133
+ type?: 'hap' | 'app';
134
+ /** Dart 编译期环境变量注入 (-d) */
135
+ dartDefines?: Record<string, string>;
136
+ /** 注入系统环境变量 (process.env) */
137
+ envs?: Record<string, string>;
138
+ /** 构建前执行脚本 */
139
+ preBuild?: string;
140
+ /** 构建后执行脚本 */
141
+ postBuild?: string;
142
+ /** 是否在构建前执行 flutter clean */
143
+ clean?: boolean;
144
+ /** 附加参数 */
145
+ extraArgs?: string[];
146
+ /** 完全自定义构建命令 */
147
+ customCommand?: string;
148
+ /** 版本名称 */
149
+ buildName?: string;
150
+ /** 构建号 */
151
+ buildNumber?: string;
34
152
  };
35
153
  };
36
154
  /** 所有上传操作的重试配置 */
@@ -309,8 +427,10 @@ interface AppMetadata {
309
427
  changelog: string;
310
428
  /** 本次要上传到的平台列表 */
311
429
  platform?: string[];
312
- /** 构建产物路径(apk/ipa) */
313
- artifactPath?: string;
430
+ /** 构建产物路径(apk/ipa,支持 Record<ABI, Path> 形式以适配多架构) */
431
+ artifactPath?: string | Record<string, string>;
432
+ /** 按平台保留的产物集合,供上传调度层选择单包或多架构组合 */
433
+ platformArtifacts?: Record<string, string | Record<string, string>>;
314
434
  /** 全局工具链设置 */
315
435
  globalSettings?: {
316
436
  /** Android SDK 路径 */
@@ -375,12 +495,16 @@ interface IUploader {
375
495
  interface BuildResult {
376
496
  /** 是否成功 */
377
497
  success: boolean;
378
- /** 构建产物路径 */
379
- artifactPath: string;
498
+ /**
499
+ * 产物路径
500
+ * - 单包时返回路径字符串
501
+ * - 多架构分包时返回字典映射,如 { 'arm64-v8a': 'path/to/apk64', 'armeabi-v7a': 'path/to/apk32' }
502
+ */
503
+ artifactPath: string | Record<string, string>;
380
504
  /** 构建耗时(毫秒) */
381
505
  buildTime: number;
382
- /** 平台:android | ios */
383
- platform: 'android' | 'ios';
506
+ /** 平台:android | ios | harmony */
507
+ platform: 'android' | 'ios' | 'harmony';
384
508
  }
385
509
 
386
510
  declare class EnvValidator {
@@ -580,9 +704,6 @@ declare class XiaomiUploader implements IUploader {
580
704
  categoryName: string;
581
705
  }[] | null>;
582
706
  upload(filePath: string, config: any, metadata: AppMetadata): Promise<UploadResult>;
583
- /**
584
- * 执行实际的上传操作
585
- */
586
707
  private performUpload;
587
708
  /**
588
709
  * 解析公钥: 优先使用内容字段, 其次从文件路径读取
@@ -983,45 +1104,18 @@ declare class OppoUploader implements IUploader {
983
1104
  *
984
1105
  * 基于 vivo 开放平台「应用分发 API」实现 (协议与腾讯开放平台 Open-QQ 规范一致)
985
1106
  * 文档: https://dev.vivo.com.cn/documentCenter/doc/326
986
- *
987
- * 上传流程:
988
- * 1. 使用 access_key + access_secret 生成签名
989
- * 2. 获取上传地址 (分段上传或直传)
990
- * 3. 上传 APK 文件
991
- * 4. 提交版本更新信息
992
- *
993
- * 签名方式: HMAC-SHA256(params_sorted, access_secret) → 16进制字符串
994
1107
  */
995
1108
  declare class VivoUploader implements IUploader {
996
1109
  name: string;
997
1110
  /** vivo 开放 API 基础地址 */
998
1111
  private static readonly API_BASE;
999
- /**
1000
- * vivo API 签名生成
1001
- * 规则: 所有参数按 ASCII 码排序后拼接为 key=val&... 字符串,
1002
- * 以 accessSecret 为密钥进行 HMAC-SHA256 加密,结果转为小写 16 进制字符串
1003
- */
1004
1112
  private generateSign;
1005
1113
  validateConfig(config: any): boolean;
1006
1114
  canHandle(filePath: string): boolean;
1007
1115
  upload(filePath: string, config: any, metadata: AppMetadata): Promise<UploadResult>;
1008
- /**
1009
- * 计算文件 MD5
1010
- */
1011
1116
  private calculateFileMD5;
1012
- /**
1013
- * 上传 APK 文件并获取流水号
1014
- * 将公共参数与业务参数放入一个 multipart 请求中直接上传至 API_BASE
1015
- */
1016
1117
  private uploadApk;
1017
- /**
1018
- * 提交版本更新信息
1019
- */
1020
1118
  private submitVersion;
1021
- /**
1022
- * 格式化错误信息
1023
- */
1024
- private formatError;
1025
1119
  }
1026
1120
 
1027
1121
  /**
@@ -1187,6 +1281,12 @@ declare class UploadManager {
1187
1281
  * 上传到单个平台
1188
1282
  */
1189
1283
  private uploadToPlatform;
1284
+ private shouldGroupArtifacts;
1285
+ private resolveArtifactSelection;
1286
+ private buildArtifactMapFromFiles;
1287
+ private inferArtifactKey;
1288
+ private getRepresentativeFilePath;
1289
+ private validateArtifactSelection;
1190
1290
  /**
1191
1291
  * 聚合上传结果
1192
1292
  */