@gmcb/cli 0.8.5 → 0.8.7

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/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.8.7](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.6...@gmcb/cli@0.8.7) (2026-07-15)
7
+
8
+ **Note:** Version bump only for package @gmcb/cli
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.8.6](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.5...@gmcb/cli@0.8.6) (2026-07-15)
15
+
16
+ **Note:** Version bump only for package @gmcb/cli
17
+
18
+
19
+
20
+
21
+
6
22
  ## [0.8.5](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.4...@gmcb/cli@0.8.5) (2026-07-15)
7
23
 
8
24
  **Note:** Version bump only for package @gmcb/cli
@@ -1,2 +1,3 @@
1
+ export declare function restoreRemoteResources(restore: boolean): Promise<void>;
1
2
  export declare function getCommands(...args: any[]): Promise<string[]>;
2
3
  export default function (...args: any[]): Promise<string[]>;
@@ -26,6 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.restoreRemoteResources = restoreRemoteResources;
29
30
  exports.getCommands = getCommands;
30
31
  exports.default = default_1;
31
32
  const fs_1 = require("fs");
@@ -44,6 +45,27 @@ const utils_1 = require("../utils");
44
45
  const config_1 = require("../utils/config");
45
46
  const apis_1 = require("../apis");
46
47
  let envPath = utils_1.BUILD_ENV_PATH;
48
+ // 主项目文件快照:value 为 null 表示写入前该文件不存在,还原时应删除
49
+ const remoteBackups = new Map();
50
+ async function restoreRemoteResources(restore) {
51
+ if (restore) {
52
+ for (const [p, data] of remoteBackups) {
53
+ try {
54
+ if (data === null) {
55
+ if ((0, fs_1.existsSync)(p))
56
+ (0, fs_1.unlinkSync)(p);
57
+ }
58
+ else {
59
+ (0, fs_1.writeFileSync)(p, data);
60
+ }
61
+ }
62
+ catch (err) {
63
+ utils_1.log.warning(`还原文件失败:${p},${JSON.stringify(err)}`);
64
+ }
65
+ }
66
+ }
67
+ remoteBackups.clear();
68
+ }
47
69
  async function getCommands(...args) {
48
70
  const opts = args[0];
49
71
  if (config_1.CONFIG_DATA.branch && config_1.CONFIG_DATA.branch !== 'false') {
@@ -60,8 +82,8 @@ async function getCommands(...args) {
60
82
  utils_1.log.error(`请将分支切换为“${opts.branch}”分支,并重新构建!`);
61
83
  }
62
84
  }
63
- catch (e) {
64
- utils_1.log.warning(e?.message);
85
+ catch (err) {
86
+ utils_1.log.warning(JSON.stringify(err));
65
87
  opts.branch = false;
66
88
  }
67
89
  }
@@ -269,6 +291,12 @@ function downloadFile(url, dest) {
269
291
  });
270
292
  }
271
293
  async function fetchRemoteResources(opts) {
294
+ remoteBackups.clear();
295
+ const backup = (p) => {
296
+ if (remoteBackups.has(p))
297
+ return;
298
+ remoteBackups.set(p, (0, fs_1.existsSync)(p) ? (0, fs_1.readFileSync)(p) : null);
299
+ };
272
300
  const spinner = (0, ora_1.default)(`正在拉取远程资源...`).start();
273
301
  // 查询版本数据,更新 package.json
274
302
  const appIdPkg = (0, fs_extra_1.readJsonSync)(utils_1.PACKAGE_PATH);
@@ -284,6 +312,7 @@ async function fetchRemoteResources(opts) {
284
312
  let pkgContent = (0, fs_1.readFileSync)(utils_1.PACKAGE_PATH, 'utf-8');
285
313
  pkgContent = pkgContent.replace(/"version"\s*:\s*"[^"]*"/, `"version": "${versionName}"`);
286
314
  pkgContent = pkgContent.replace(/"versionCode"\s*:\s*"?[^",]*"?/, `"versionCode": ${versionCode}`);
315
+ backup(utils_1.PACKAGE_PATH);
287
316
  (0, fs_1.writeFileSync)(utils_1.PACKAGE_PATH, pkgContent);
288
317
  }
289
318
  const pkg = (0, fs_extra_1.readJsonSync)(utils_1.PACKAGE_PATH);
@@ -305,20 +334,20 @@ async function fetchRemoteResources(opts) {
305
334
  // 4. 拉取代码到 COMMAND_PATH/.repo/{appId}
306
335
  const repoDir = (0, path_1.join)(utils_1.COMMAND_PATH, '.repo', appId);
307
336
  if ((0, fs_1.existsSync)((0, path_1.join)(repoDir, '.git'))) {
308
- // 已有目录:fetch 目标分支 + 校验远程分支 + 切换 + pull
309
- const repoGit = (0, simple_git_1.default)(repoDir);
310
- // 1. 拉取目标分支(显式指定,不受 --single-branch refspec 限制)
311
- // --prune 确保远程已删除的分支不会残留在本地引用中
312
- await repoGit.fetch('origin', branch, ['--prune']);
313
- // 2. 检查远程分支是否存在(远程已删除的分支经 prune 后不会出现在结果中)
314
- const remoteBranches = await repoGit.branch(['-r']);
315
- if (!remoteBranches.all.includes(`origin/${branch}`)) {
316
- utils_1.log.error(`远程分支 origin/${branch} 不存在,请检查仓库 ${repoUrl}`);
337
+ try {
338
+ // 已有目录:fetch 目标分支 + 校验远程分支 + 切换 + pull
339
+ const repoGit = (0, simple_git_1.default)(repoDir);
340
+ // 1. 拉取目标分支(显式指定,不受 --single-branch refspec 限制)
341
+ // --prune 确保远程已删除的分支不会残留在本地引用中
342
+ await repoGit.fetch('origin', `+refs/heads/${branch}:refs/remotes/origin/${branch}`, ['--prune']);
343
+ // 2. 切换分支:-B 强制创建/重置本地分支指向 origin/{branch}
344
+ await repoGit.checkout(['-B', branch, `origin/${branch}`, '-f']);
345
+ // 3. 拉取最新代码
346
+ await repoGit.pull('origin', branch);
347
+ }
348
+ catch (err) {
349
+ utils_1.log.error(JSON.stringify(err));
317
350
  }
318
- // 3. 切换分支(本地不存在时 git 自动从 origin/{branch} 创建)
319
- await repoGit.checkout(branch, ['-f']);
320
- // 4. 拉取最新代码
321
- await repoGit.pull('origin', branch);
322
351
  }
323
352
  else {
324
353
  // 新克隆:直接使用 branch 分支,失败则抛出异常
@@ -328,7 +357,7 @@ async function fetchRemoteResources(opts) {
328
357
  await cloneGit.clone(repoUrl, repoDir, ['--branch', branch, '--single-branch']);
329
358
  }
330
359
  catch (err) {
331
- utils_1.log.error(err.message);
360
+ utils_1.log.error(JSON.stringify(err));
332
361
  }
333
362
  }
334
363
  spinner.stop();
@@ -358,13 +387,17 @@ async function fetchRemoteResources(opts) {
358
387
  const pkgPath = (0, path_1.join)(utils_1.COMMAND_PATH, 'package.json');
359
388
  let pkgContent = (0, fs_1.readFileSync)(pkgPath, 'utf-8');
360
389
  pkgContent = pkgContent.replace(/"productName":\s*"[^"]*"/, `"productName": "${appName}"`);
390
+ backup(pkgPath);
361
391
  (0, fs_1.writeFileSync)(pkgPath, pkgContent);
362
392
  // 下载图标
363
393
  if (iconUrl) {
364
394
  (0, fs_extra_1.ensureDirSync)((0, path_1.join)(utils_1.COMMAND_PATH, 'res'));
365
395
  const iconPath = (0, path_1.join)(utils_1.COMMAND_PATH, 'res', 'icon.png');
396
+ const icoPath = (0, path_1.join)(utils_1.COMMAND_PATH, 'res', 'icon.ico');
397
+ backup(iconPath);
366
398
  await downloadFile(iconUrl, iconPath);
367
- await (0, utils_1.png2ico)(iconPath, (0, path_1.join)(utils_1.COMMAND_PATH, 'res', 'icon.ico'));
399
+ backup(icoPath);
400
+ await (0, utils_1.png2ico)(iconPath, icoPath);
368
401
  }
369
402
  }
370
403
  if (opts.compiler === 'gradlew') {
@@ -375,20 +408,25 @@ async function fetchRemoteResources(opts) {
375
408
  const stringsPath = (0, path_1.join)(utils_1.COMMAND_PATH, 'app', 'src', 'main', 'res', 'values', 'strings.xml');
376
409
  let stringsContent = (0, fs_1.readFileSync)(stringsPath, 'utf-8');
377
410
  stringsContent = stringsContent.replace(/<string name="app_name">[^<]*<\/string>/, `<string name="app_name">${appName}</string>`);
411
+ backup(stringsPath);
378
412
  (0, fs_1.writeFileSync)(stringsPath, stringsContent);
379
413
  // 修改主项目 build.gradle(versionName/versionCode 取 COMMAND_PATH/package.json 对应值)
380
414
  const gradlePath = (0, path_1.join)(utils_1.COMMAND_PATH, 'app', 'build.gradle');
381
415
  let gradleContent = (0, fs_1.readFileSync)(gradlePath, 'utf-8');
382
416
  gradleContent = gradleContent.replace(/versionName\s+"[^"]*"/, `versionName "${pkg.version}"`);
383
417
  gradleContent = gradleContent.replace(/versionCode\s+\d+/, `versionCode ${pkg.versionCode}`);
418
+ backup(gradlePath);
384
419
  (0, fs_1.writeFileSync)(gradlePath, gradleContent);
385
420
  // 下载图标
386
421
  if (iconUrl) {
387
422
  const drawableDir = (0, path_1.join)(utils_1.COMMAND_PATH, 'app', 'src', 'main', 'res', 'drawable-xxhdpi');
388
423
  (0, fs_extra_1.ensureDirSync)(drawableDir);
389
424
  const iconPath = (0, path_1.join)(drawableDir, 'icon.png');
425
+ const pushPath = (0, path_1.join)(drawableDir, 'push.png');
426
+ backup(iconPath);
390
427
  await downloadFile(iconUrl, iconPath);
391
- (0, fs_1.copyFileSync)(iconPath, (0, path_1.join)(drawableDir, 'push.png'));
428
+ backup(pushPath);
429
+ (0, fs_1.copyFileSync)(iconPath, pushPath);
392
430
  }
393
431
  }
394
432
  // 9. updateMode=2 时打包资源为 zip/wgt
@@ -415,32 +453,42 @@ async function fetchRemoteResources(opts) {
415
453
  }
416
454
  async function default_1(...args) {
417
455
  const opts = args[0];
456
+ const deferRestore = args[args.length - 1] === true;
418
457
  const commands = await getCommands(...args);
419
458
  const command = commands.join(' ');
459
+ let hasRemote = false;
420
460
  if (opts.remote && ['electron-vite', 'gradlew'].includes(opts.compiler)) {
421
461
  await fetchRemoteResources(opts);
462
+ hasRemote = true;
422
463
  }
423
- if (!opts.nobuild) {
424
- const time = Date.now();
425
- (0, utils_1.spawnSync)(command);
426
- if ((Date.now() - time) / 1000 <= 1) {
427
- if (command.includes(config_1.CONFIG_DATA.cli.hbuilderx)) {
428
- utils_1.log.error('检测到您的HbuilderX未启动或项目管理器中未发现构建项目,请检查后重试!');
464
+ try {
465
+ if (!opts.nobuild) {
466
+ const time = Date.now();
467
+ (0, utils_1.spawnSync)(command);
468
+ if ((Date.now() - time) / 1000 <= 1) {
469
+ if (command.includes(config_1.CONFIG_DATA.cli.hbuilderx)) {
470
+ utils_1.log.error('检测到您的HbuilderX未启动或项目管理器中未发现构建项目,请检查后重试!');
471
+ }
429
472
  }
430
473
  }
474
+ if ((0, fs_1.existsSync)(envPath)) {
475
+ (0, fs_1.unlinkSync)(envPath);
476
+ }
477
+ // H5 构建完成后立即生成 manifest.json
478
+ if (opts.compiler === 'uni' && opts.platform === 'h5') {
479
+ generateH5Manifest();
480
+ }
481
+ if ((opts.compiler === 'electron-vite' && (opts.zip || opts.win)) ||
482
+ (opts.compiler === 'uni' && opts.platform === 'h5' && opts.zip) ||
483
+ (opts.compiler === 'uni' && opts.platform?.startsWith('app') && opts.wgt && !opts.pack) ||
484
+ opts.compiler === 'gradlew' && opts.apk) {
485
+ await generatePackage(opts);
486
+ }
487
+ return commands;
431
488
  }
432
- if ((0, fs_1.existsSync)(envPath)) {
433
- (0, fs_1.unlinkSync)(envPath);
434
- }
435
- // H5 构建完成后立即生成 manifest.json
436
- if (opts.compiler === 'uni' && opts.platform === 'h5') {
437
- generateH5Manifest();
438
- }
439
- if ((opts.compiler === 'electron-vite' && (opts.zip || opts.win)) ||
440
- (opts.compiler === 'uni' && opts.platform === 'h5' && opts.zip) ||
441
- (opts.compiler === 'uni' && opts.platform?.startsWith('app') && opts.wgt && !opts.pack) ||
442
- opts.compiler === 'gradlew' && opts.apk) {
443
- await generatePackage(opts);
489
+ finally {
490
+ if (hasRemote && !deferRestore) {
491
+ await restoreRemoteResources(!!opts.restore);
492
+ }
444
493
  }
445
- return commands;
446
494
  }
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
@@ -6,7 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
29
  exports.default = default_1;
7
30
  const inquirer_1 = __importDefault(require("inquirer"));
8
31
  const utils_1 = require("../utils");
9
- const build_1 = __importDefault(require("./build"));
32
+ const build_1 = __importStar(require("./build"));
10
33
  const config_1 = require("../utils/config");
11
34
  async function default_1(...args) {
12
35
  const opts = args[0];
@@ -187,65 +210,70 @@ async function default_1(...args) {
187
210
  config_1.CONFIG_DATA.pub.status = pub.status;
188
211
  }
189
212
  }
190
- let cmds;
191
- if (opts.compiler === 'uni' && opts.wgt && opts.zip) {
192
- const originalPlatform = opts.platform;
193
- // 先构建 app(生成 wgt)
194
- opts.platform = 'app';
195
- cmds = await (0, build_1.default)(...args);
196
- // 再构建 h5(生成 zip)
197
- opts.platform = 'h5';
198
- await (0, build_1.default)(...args);
199
- // 恢复
200
- opts.platform = originalPlatform;
201
- }
202
- else {
203
- cmds = await (0, build_1.default)(...args);
204
- }
205
- // 从 cmds 提取 buildEnv
206
- const buildEnv = cmds[2]?.split('=')[1];
207
- if (!buildEnv || !['dev', 'sit', 'uat', 'pre', 'prod'].includes(buildEnv)) {
208
- utils_1.log.error('没有检测到需要发布的环境,无法完成上传,请切换到dev/sit/uat/pre/master分支再次执行脚本,或者您可以选择手动上传!');
209
- }
210
- const isHotUpdate = opts.remote && config_1.CONFIG_DATA.publish?.updateMode == 2;
211
- if (opts.compiler === 'electron-vite') {
212
- if (isHotUpdate) {
213
- await require('../scripts/zip-exe').default();
213
+ try {
214
+ let cmds;
215
+ if (opts.compiler === 'uni' && opts.wgt && opts.zip) {
216
+ const originalPlatform = opts.platform;
217
+ // 先构建 app(生成 wgt)
218
+ opts.platform = 'app';
219
+ cmds = await (0, build_1.default)(opts, true);
220
+ // 再构建 h5(生成 zip)
221
+ opts.platform = 'h5';
222
+ await (0, build_1.default)(opts, true);
223
+ // 恢复
224
+ opts.platform = originalPlatform;
214
225
  }
215
- else if (opts.zip) {
216
- await require('../scripts/asar-zip').default();
226
+ else {
227
+ cmds = await (0, build_1.default)(opts, true);
217
228
  }
218
- else if (opts.win) {
219
- await require('../scripts/h5-exe').default();
220
- }
221
- }
222
- else if (opts.compiler === 'gradlew') {
223
- if (isHotUpdate) {
224
- await require('../scripts/wgt-apk').default();
225
- }
226
- else if (opts.apk) {
227
- await require('../scripts/app-apk').default();
228
- }
229
- }
230
- else if (opts.compiler === 'uni') {
231
- if (opts.platform?.startsWith('mp')) {
232
- await require('../scripts/mp-weixin').default();
229
+ // 从 cmds 提取 buildEnv
230
+ const buildEnv = cmds[2]?.split('=')[1];
231
+ if (!buildEnv || !['dev', 'sit', 'uat', 'pre', 'prod'].includes(buildEnv)) {
232
+ utils_1.log.error('没有检测到需要发布的环境,无法完成上传,请切换到dev/sit/uat/pre/master分支再次执行脚本,或者您可以选择手动上传!');
233
233
  }
234
- else if (opts.platform === 'h5') {
235
- if (opts.wgt && opts.zip) {
236
- await require('../scripts/wgt-zip').default();
234
+ const isHotUpdate = opts.remote && config_1.CONFIG_DATA.publish?.updateMode == 2;
235
+ if (opts.compiler === 'electron-vite') {
236
+ if (isHotUpdate) {
237
+ await require('../scripts/zip-exe').default();
237
238
  }
238
239
  else if (opts.zip) {
239
- await require('../scripts/h5-zip').default();
240
+ await require('../scripts/asar-zip').default();
241
+ }
242
+ else if (opts.win) {
243
+ await require('../scripts/h5-exe').default();
240
244
  }
241
245
  }
242
- else if (opts.platform?.startsWith('app')) {
243
- if (opts.wgt && opts.zip) {
244
- await require('../scripts/wgt-zip').default();
246
+ else if (opts.compiler === 'gradlew') {
247
+ if (isHotUpdate) {
248
+ await require('../scripts/wgt-apk').default();
249
+ }
250
+ else if (opts.apk) {
251
+ await require('../scripts/app-apk').default();
252
+ }
253
+ }
254
+ else if (opts.compiler === 'uni') {
255
+ if (opts.platform?.startsWith('mp')) {
256
+ await require('../scripts/mp-weixin').default();
257
+ }
258
+ else if (opts.platform === 'h5') {
259
+ if (opts.wgt && opts.zip) {
260
+ await require('../scripts/wgt-zip').default();
261
+ }
262
+ else if (opts.zip) {
263
+ await require('../scripts/h5-zip').default();
264
+ }
245
265
  }
246
- else if (opts.wgt) {
247
- await require('../scripts/app-wgt').default();
266
+ else if (opts.platform?.startsWith('app')) {
267
+ if (opts.wgt && opts.zip) {
268
+ await require('../scripts/wgt-zip').default();
269
+ }
270
+ else if (opts.wgt) {
271
+ await require('../scripts/app-wgt').default();
272
+ }
248
273
  }
249
274
  }
250
275
  }
276
+ finally {
277
+ await (0, build_1.restoreRemoteResources)(!!opts.restore);
278
+ }
251
279
  }
package/lib/apis/index.js CHANGED
@@ -113,8 +113,7 @@ async function uploadVersion(params) {
113
113
  });
114
114
  }
115
115
  catch (err) {
116
- console.error(err);
117
- process.exit(1);
116
+ utils_1.log.error(JSON.stringify(err));
118
117
  }
119
118
  }
120
119
  /**
@@ -198,30 +197,34 @@ async function publishVersion(params) {
198
197
  });
199
198
  }
200
199
  catch (err) {
201
- console.error(err);
202
- process.exit(1);
200
+ utils_1.log.error(JSON.stringify(err));
203
201
  }
204
202
  }
205
203
  /**
206
204
  * 获取最新版本信息(自动登录)
207
205
  */
208
206
  async function fetchLatestVersion(params) {
209
- const { appId, platform } = params;
210
- await ensureLoggedIn();
211
- const { data: versionPage } = await getVersionPage({
212
- appId,
213
- publishType: 1,
214
- platform,
215
- pageNo: 1,
216
- pageSize: 1,
217
- });
218
- const versionList = (versionPage?.list || []).filter((item) => item.status < 2);
219
- const latestVersion = versionList[0];
220
- return {
221
- versionName: latestVersion?.versionName ?? '',
222
- versionCode: Number(latestVersion?.versionNum ?? 0),
223
- updateMode: latestVersion?.updateMode ?? 0,
224
- };
207
+ try {
208
+ const { appId, platform } = params;
209
+ await ensureLoggedIn();
210
+ const { data: versionPage } = await getVersionPage({
211
+ appId,
212
+ publishType: 1,
213
+ platform,
214
+ pageNo: 1,
215
+ pageSize: 1,
216
+ });
217
+ const versionList = (versionPage?.list || []).filter((item) => item.status < 2);
218
+ const latestVersion = versionList[0];
219
+ return {
220
+ versionName: latestVersion?.versionName ?? '',
221
+ versionCode: Number(latestVersion?.versionNum ?? 0),
222
+ updateMode: latestVersion?.updateMode ?? 0,
223
+ };
224
+ }
225
+ catch (err) {
226
+ utils_1.log.error(JSON.stringify(err));
227
+ }
225
228
  }
226
229
  /**
227
230
  * 获取应用信息(自动登录)
@@ -245,7 +248,6 @@ async function getAppInfo(appId) {
245
248
  };
246
249
  }
247
250
  catch (err) {
248
- console.error(err);
249
- process.exit(1);
251
+ utils_1.log.error(JSON.stringify(err));
250
252
  }
251
253
  }
package/lib/bin.js CHANGED
@@ -52,6 +52,7 @@ program
52
52
  .option(...commands_1.linux)
53
53
  .option(...commands_1.apk)
54
54
  .option(...commands_1.remote)
55
+ .option(...commands_1.restore)
55
56
  .option(...commands_1.nobuild)
56
57
  .action(build_1.default);
57
58
  program
@@ -82,6 +83,7 @@ program
82
83
  .option(...commands_1.apk)
83
84
  .option(...commands_1.skip)
84
85
  .option(...commands_1.remote)
86
+ .option(...commands_1.restore)
85
87
  .option(...commands_1.nobuild)
86
88
  .action(publish_1.default);
87
89
  program
@@ -24,6 +24,7 @@ export declare const res: readonly ["--res", "是否构建移动应用本地资
24
24
  export declare const apk: readonly ["--apk", "是否构建Android应用"];
25
25
  export declare const skip: readonly ["--skip", "跳过所有确认,自动发布"];
26
26
  export declare const remote: readonly ["--remote", "是否从远程拉取资源构建"];
27
+ export declare const restore: readonly ["--restore", "构建完成后是否还原远程写入的主项目文件"];
27
28
  export declare const nobuild: readonly ["--nobuild", "跳过构建步骤"];
28
29
  export declare const radius: readonly ["-r, --radius <number>", "圆角半径,默认16", "16"];
29
30
  export declare const ico: readonly ["--ico", "是否输出ICO文件"];
@@ -59,6 +60,7 @@ export interface Options {
59
60
  linux: boolean;
60
61
  apk?: boolean;
61
62
  remote?: boolean;
63
+ restore?: boolean;
62
64
  nobuild?: boolean;
63
65
  radius?: string;
64
66
  ico?: boolean;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.templateRepo = exports.skillRepo = exports.cosSecretkey = exports.cosSecretid = exports.alipayCli = exports.weixinCli = exports.hbuilderxCli = exports.ico = exports.radius = exports.nobuild = exports.remote = exports.skip = exports.apk = exports.res = exports.wgt = exports.pack = exports.custom = exports.zip = exports.linux = exports.mac = exports.win = exports.link = exports.path = exports.name = exports.clean = exports.ignore = exports.dest = exports.source = exports.branch = exports.env = exports.compiler = exports.project = exports.platform = exports.template = exports.version = void 0;
3
+ exports.templateRepo = exports.skillRepo = exports.cosSecretkey = exports.cosSecretid = exports.alipayCli = exports.weixinCli = exports.hbuilderxCli = exports.ico = exports.radius = exports.nobuild = exports.restore = exports.remote = exports.skip = exports.apk = exports.res = exports.wgt = exports.pack = exports.custom = exports.zip = exports.linux = exports.mac = exports.win = exports.link = exports.path = exports.name = exports.clean = exports.ignore = exports.dest = exports.source = exports.branch = exports.env = exports.compiler = exports.project = exports.platform = exports.template = exports.version = void 0;
4
4
  exports.version = ['-v, --version', '输出版本号'];
5
5
  exports.template = ['-t, --template <template-name>', '模版仓库名称'];
6
6
  exports.platform = ['-p, --platform <platform-name>', '编译平台,默认h5', 'h5'];
@@ -26,6 +26,7 @@ exports.res = ['--res', '是否构建移动应用本地资源'];
26
26
  exports.apk = ['--apk', '是否构建Android应用'];
27
27
  exports.skip = ['--skip', '跳过所有确认,自动发布'];
28
28
  exports.remote = ['--remote', '是否从远程拉取资源构建'];
29
+ exports.restore = ['--restore', '构建完成后是否还原远程写入的主项目文件'];
29
30
  exports.nobuild = ['--nobuild', '跳过构建步骤'];
30
31
  exports.radius = ['-r, --radius <number>', '圆角半径,默认16', '16'];
31
32
  exports.ico = ['--ico', '是否输出ICO文件'];
@@ -13,6 +13,7 @@ const apis_1 = require("../apis");
13
13
  const const_1 = require("../utils/const");
14
14
  const config_1 = require("../utils/config");
15
15
  const function_1 = require("../utils/function");
16
+ const utils_1 = require("../utils");
16
17
  const PUBLISH_APP_CFG = {
17
18
  wgt: config_1.CONFIG_DATA.app?.wgt,
18
19
  zip: config_1.CONFIG_DATA.h5?.zip,
@@ -103,8 +104,7 @@ async function publish(options) {
103
104
  spinner.succeed('新版本提交成功');
104
105
  }
105
106
  catch (err) {
106
- console.error(err);
107
107
  spinner.fail('提交失败');
108
- process.exit(1);
108
+ utils_1.log.error(JSON.stringify(err));
109
109
  }
110
110
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmcb/cli",
3
- "version": "0.8.5",
3
+ "version": "0.8.7",
4
4
  "description": "工茂草本前端命令行工具",
5
5
  "author": "yinjiazeng@163.com",
6
6
  "license": "MIT",
@@ -59,5 +59,5 @@
59
59
  "@types/rimraf": "^4.0.5",
60
60
  "@types/user-home": "^2.0.2"
61
61
  },
62
- "gitHead": "5fd97fa0ed7bf5f92d4e64e42ecd96ff0d54faca"
62
+ "gitHead": "aeb596902d44e2c67224cf96aa30fd6a91f92572"
63
63
  }