react-native-update-cli 2.23.0 → 2.24.0

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.
@@ -19,8 +19,11 @@ declare const _default: {
19
19
  appKeyMismatchIpa: string;
20
20
  appName: string;
21
21
  appNameQuestion: string;
22
+ appPlatformMismatch: string;
22
23
  appNotSelected: string;
23
24
  appUploadSuccess: string;
25
+ autoUpdatePermission: string;
26
+ autoUpdateSuccess: string;
24
27
  apkUploadSuccess: string;
25
28
  boundTo: string;
26
29
  buildTimeNotFound: string;
package/lib/locales/en.js CHANGED
@@ -13,16 +13,19 @@ exports.default = {
13
13
  aabParseManifestError: 'Parse AndroidManifest.xml error: {{error}}',
14
14
  aabParseResourcesError: 'Parser resources.arsc error: {{error}}',
15
15
  appId: 'App ID',
16
- appIdMismatchApk: 'App ID mismatch! Current APK: {{appIdInPkg}}, current update.json: {{appId}}',
17
- appIdMismatchApp: 'App ID mismatch! Current APP: {{appIdInPkg}}, current update.json: {{appId}}',
18
- appIdMismatchIpa: 'App ID mismatch! Current IPA: {{appIdInPkg}}, current update.json: {{appId}}',
19
- appKeyMismatchApk: 'App Key mismatch! Current APK: {{appKeyInPkg}}, current update.json: {{appKey}}',
20
- appKeyMismatchApp: 'App Key mismatch! Current APP: {{appKeyInPkg}}, current update.json: {{appKey}}',
21
- appKeyMismatchIpa: 'App Key mismatch! Current IPA: {{appKeyInPkg}}, current update.json: {{appKey}}',
16
+ appIdMismatchApk: 'App ID mismatch! Current APK: {{appIdInPkg}}, current {{- source}}: {{appId}}',
17
+ appIdMismatchApp: 'App ID mismatch! Current APP: {{appIdInPkg}}, current {{- source}}: {{appId}}',
18
+ appIdMismatchIpa: 'App ID mismatch! Current IPA: {{appIdInPkg}}, current {{- source}}: {{appId}}',
19
+ appKeyMismatchApk: 'App Key mismatch! Current APK: {{appKeyInPkg}}, current {{- source}}: {{appKey}}',
20
+ appKeyMismatchApp: 'App Key mismatch! Current APP: {{appKeyInPkg}}, current {{- source}}: {{appKey}}',
21
+ appKeyMismatchIpa: 'App Key mismatch! Current IPA: {{appKeyInPkg}}, current {{- source}}: {{appKey}}',
22
22
  appName: 'App Name',
23
23
  appNameQuestion: 'App Name:',
24
+ appPlatformMismatch: 'App {{appId}} is a {{appPlatform}} app, but this command targets {{platform}}',
24
25
  appNotSelected: 'App not selected. run `cresc selectApp --platform {{platform}}` first!',
25
26
  appUploadSuccess: 'Successfully uploaded APP native package (id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
27
+ autoUpdatePermission: 'CLI auto-update was skipped because the global package directory is not writable. Fix the package-manager prefix permissions, then run: {{- command}}',
28
+ autoUpdateSuccess: 'CLI was automatically updated in the background: {{from}} -> {{to}}',
26
29
  apkUploadSuccess: 'Successfully uploaded APK native package (id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
27
30
  boundTo: ', bound to: {{name}} ({{id}})',
28
31
  buildTimeNotFound: 'Cannot get the build timestamp of this package. Please update `react-native-update` to the latest version and re-package and upload.',
@@ -42,7 +45,7 @@ exports.default = {
42
45
  errorInHarmonyApp: 'Error in getEntryFromHarmonyApp: {{error}}',
43
46
  expiredStatus: '(Expired)',
44
47
  failedToParseIcon: '[Warning] failed to parse icon: {{error}}',
45
- failedToParseUpdateJson: 'Failed to parse file `update.json`. Try to remove it manually.',
48
+ failedToParseUpdateJson: 'Failed to parse file `{{- configPath}}`. Try to remove it manually.',
46
49
  fileGenerated: '{{- file}} generated.',
47
50
  fileSizeExceeded: 'This file size is {{fileSize}} , exceeding the current quota {{maxSize}} . You may consider upgrading to a higher plan to increase this quota. Details can be found at: {{- pricingPageUrl}}',
48
51
  forceHermes: 'Forcing Hermes enabled for this build',
@@ -19,8 +19,11 @@ declare const _default: {
19
19
  appKeyMismatchIpa: string;
20
20
  appName: string;
21
21
  appNameQuestion: string;
22
+ appPlatformMismatch: string;
22
23
  appNotSelected: string;
23
24
  appUploadSuccess: string;
25
+ autoUpdatePermission: string;
26
+ autoUpdateSuccess: string;
24
27
  apkUploadSuccess: string;
25
28
  boundTo: string;
26
29
  buildTimeNotFound: string;
package/lib/locales/zh.js CHANGED
@@ -13,16 +13,19 @@ exports.default = {
13
13
  aabParseManifestError: '解析 AndroidManifest.xml 出错:{{error}}',
14
14
  aabParseResourcesError: '解析 resources.arsc 出错:{{error}}',
15
15
  appId: '应用 id',
16
- appIdMismatchApk: 'appId不匹配!当前apk: {{appIdInPkg}}, 当前update.json: {{appId}}',
17
- appIdMismatchApp: 'appId不匹配!当前app: {{appIdInPkg}}, 当前update.json: {{appId}}',
18
- appIdMismatchIpa: 'appId不匹配!当前ipa: {{appIdInPkg}}, 当前update.json: {{appId}}',
19
- appKeyMismatchApk: 'appKey不匹配!当前apk: {{appKeyInPkg}}, 当前update.json: {{appKey}}',
20
- appKeyMismatchApp: 'appKey不匹配!当前app: {{appKeyInPkg}}, 当前update.json: {{appKey}}',
21
- appKeyMismatchIpa: 'appKey不匹配!当前ipa: {{appKeyInPkg}}, 当前update.json: {{appKey}}',
16
+ appIdMismatchApk: 'appId不匹配!当前apk: {{appIdInPkg}}, 当前{{- source}}: {{appId}}',
17
+ appIdMismatchApp: 'appId不匹配!当前app: {{appIdInPkg}}, 当前{{- source}}: {{appId}}',
18
+ appIdMismatchIpa: 'appId不匹配!当前ipa: {{appIdInPkg}}, 当前{{- source}}: {{appId}}',
19
+ appKeyMismatchApk: 'appKey不匹配!当前apk: {{appKeyInPkg}}, 当前{{- source}}: {{appKey}}',
20
+ appKeyMismatchApp: 'appKey不匹配!当前app: {{appKeyInPkg}}, 当前{{- source}}: {{appKey}}',
21
+ appKeyMismatchIpa: 'appKey不匹配!当前ipa: {{appKeyInPkg}}, 当前{{- source}}: {{appKey}}',
22
22
  appName: '应用名称',
23
23
  appNameQuestion: '应用名称:',
24
+ appPlatformMismatch: '应用 {{appId}} 是 {{appPlatform}} 平台的应用,但当前命令的平台是 {{platform}}',
24
25
  appNotSelected: '尚未选择应用。请先运行 `pushy selectApp --platform {{platform}}` 来选择应用',
25
26
  appUploadSuccess: '已成功上传app原生包(id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
27
+ autoUpdatePermission: 'CLI 自动更新已跳过:全局包目录不可写。请修复包管理器的全局目录权限后运行:{{- command}}',
28
+ autoUpdateSuccess: 'CLI 已在后台自动更新:{{from}} -> {{to}}',
26
29
  apkUploadSuccess: '已成功上传apk原生包(id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
27
30
  boundTo: ', 已绑定:{{name}} ({{id}})',
28
31
  buildTimeNotFound: '无法获取此包的编译时间戳。请更新 `react-native-update` 到最新版本后重新打包上传。',
@@ -42,7 +45,7 @@ exports.default = {
42
45
  errorInHarmonyApp: '获取 Harmony 应用入口时出错:{{error}}',
43
46
  expiredStatus: '(已过期)',
44
47
  failedToParseIcon: '[警告] 解析图标失败:{{error}}',
45
- failedToParseUpdateJson: '无法解析文件 `update.json`。请手动删除它。',
48
+ failedToParseUpdateJson: '无法解析文件 `{{- configPath}}`。请手动删除它。',
46
49
  fileGenerated: '已生成 {{- file}}',
47
50
  fileSizeExceeded: '此文件大小 {{fileSize}} , 超出当前额度 {{maxSize}} 。您可以考虑升级付费业务以提升此额度。详情请访问: {{- pricingPageUrl}}',
48
51
  forceHermes: '强制启用 Hermes 编译',
package/lib/package.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { Package, Platform } from './types';
2
2
  type PackageCommandOptions = Record<string, unknown> & {
3
3
  appId?: string;
4
4
  appKey?: string;
5
+ config?: string;
5
6
  platform?: Platform;
6
7
  version?: string;
7
8
  packageId?: string;
package/lib/package.js CHANGED
@@ -47,6 +47,7 @@ const api_1 = require("./api");
47
47
  const app_1 = require("./app");
48
48
  const native_package_1 = require("./native-package");
49
49
  const utils_1 = require("./utils");
50
+ const constants_1 = require("./utils/constants");
50
51
  const dep_versions_1 = require("./utils/dep-versions");
51
52
  const git_1 = require("./utils/git");
52
53
  const hermes_base_1 = require("./utils/hermes-base");
@@ -108,11 +109,13 @@ async function uploadNativePackage(filePath, options, config) {
108
109
  }
109
110
  : await (0, app_1.getSelectedApp)(config.platform, options.config);
110
111
  const { appId, appKey } = selectedApp;
112
+ // where the expected app came from, for the mismatch messages
113
+ const source = options.appId ? '--appId' : options.config || constants_1.updateJson;
111
114
  if (appIdInPkg && String(appIdInPkg) !== appId) {
112
- throw new Error((0, i18n_1.t)(config.appIdMismatchKey, { appIdInPkg, appId }));
115
+ throw new Error((0, i18n_1.t)(config.appIdMismatchKey, { appIdInPkg, appId, source }));
113
116
  }
114
117
  if (appKeyInPkg && appKey && appKeyInPkg !== appKey) {
115
- throw new Error((0, i18n_1.t)(config.appKeyMismatchKey, { appKeyInPkg, appKey }));
118
+ throw new Error((0, i18n_1.t)(config.appKeyMismatchKey, { appKeyInPkg, appKey, source }));
116
119
  }
117
120
  const customVersion = typeof options.version === 'string' && options.version
118
121
  ? options.version
@@ -313,21 +316,12 @@ exports.packageCommands = {
313
316
  console.log((0, i18n_1.t)('apkExtracted', { output }));
314
317
  },
315
318
  packages: async ({ options, }) => {
316
- let appId = options.appId;
317
- if (!appId) {
318
- const platform = await (0, app_1.getPlatform)(options.platform);
319
- appId = (await (0, app_1.getSelectedApp)(platform, options.config)).appId;
320
- }
321
- await listPackage(String(appId));
319
+ await listPackage(await (0, app_1.resolveAppId)(options));
322
320
  },
323
321
  deletePackage: async ({ options }) => {
324
- let { appId } = options;
322
+ const appId = await (0, app_1.resolveAppId)(options);
325
323
  let packageIds = (0, options_1.getStringListOption)(options, 'packageIds') ??
326
324
  (0, options_1.getStringListOption)(options, 'packageId');
327
- if (!appId) {
328
- const platform = await (0, app_1.getPlatform)(options.platform);
329
- appId = (await (0, app_1.getSelectedApp)(platform, options.config)).appId;
330
- }
331
325
  if (!packageIds) {
332
326
  const packageVersions = (0, options_1.getStringListOption)(options, 'packageVersion');
333
327
  if (!packageVersions) {
package/lib/provider.d.ts CHANGED
@@ -10,7 +10,7 @@ export declare class CLIProviderImpl implements CLIProvider {
10
10
  publish(options: PublishOptions): Promise<CommandResult>;
11
11
  symbolicate(options: SymbolicateOptions): Promise<CommandResult>;
12
12
  upload(options: UploadOptions): Promise<CommandResult>;
13
- getSelectedApp(platform?: Platform): Promise<{
13
+ getSelectedApp(platform?: Platform, config?: string): Promise<{
14
14
  appId: string;
15
15
  platform: Platform;
16
16
  }>;
package/lib/provider.js CHANGED
@@ -93,6 +93,8 @@ class CLIProviderImpl {
93
93
  verifyHermesBase: options.verifyHermesBase ?? true,
94
94
  sentryRelease: options.sentryRelease,
95
95
  sentryDist: options.sentryDist,
96
+ appId: options.appId,
97
+ config: options.config,
96
98
  });
97
99
  const { bundleCommands } = await Promise.resolve().then(() => __importStar(require('./bundle')));
98
100
  await bundleCommands.bundle(context);
@@ -164,9 +166,9 @@ class CLIProviderImpl {
164
166
  await uploadHandler(context);
165
167
  }, 'Unknown error during upload', 'File uploaded successfully');
166
168
  }
167
- async getSelectedApp(platform) {
169
+ async getSelectedApp(platform, config) {
168
170
  const resolvedPlatform = await this.getPlatform(platform);
169
- return (0, app_1.getSelectedApp)(resolvedPlatform);
171
+ return (0, app_1.getSelectedApp)(resolvedPlatform, config);
170
172
  }
171
173
  async listApps(platform) {
172
174
  return this.runDataCommand(async () => {
package/lib/types.d.ts CHANGED
@@ -57,6 +57,10 @@ export interface BundleOptions {
57
57
  resetCache?: boolean;
58
58
  sentryRelease?: string;
59
59
  sentryDist?: string;
60
+ /** publish to this app instead of the one selected in the config file */
61
+ appId?: string;
62
+ /** selected-app config file (default: update.json) */
63
+ config?: string;
60
64
  }
61
65
  export interface PublishOptions {
62
66
  filePath?: string;
@@ -113,7 +117,7 @@ export interface CLIProvider {
113
117
  upload: (options: UploadOptions) => Promise<CommandResult>;
114
118
  createApp: (name: string, platform: Platform) => Promise<CommandResult>;
115
119
  listApps: (platform?: Platform) => Promise<CommandResult>;
116
- getSelectedApp: (platform?: Platform) => Promise<{
120
+ getSelectedApp: (platform?: Platform, config?: string) => Promise<{
117
121
  appId: string;
118
122
  platform: Platform;
119
123
  }>;
@@ -3,7 +3,7 @@ export declare const IS_CRESC: boolean;
3
3
  export declare const ppkBundleFileNames: string[];
4
4
  export declare const isPPKBundleFileName: (fileName: string) => boolean;
5
5
  export declare const credentialFile: string;
6
- export declare const updateJson: string;
6
+ export declare const updateJson = "update.json";
7
7
  export declare const tempDir: string;
8
8
  export declare const pricingPageUrl: string;
9
9
  export declare const defaultEndpoints: string[];
@@ -14,7 +14,9 @@ exports.ppkBundleFileNames = ['index.bundlejs', 'bundle.harmony.js'];
14
14
  const isPPKBundleFileName = (fileName) => exports.ppkBundleFileNames.includes(fileName);
15
15
  exports.isPPKBundleFileName = isPPKBundleFileName;
16
16
  exports.credentialFile = exports.IS_CRESC ? '.cresc.token' : '.update';
17
- exports.updateJson = exports.IS_CRESC ? 'cresc.config.json' : 'update.json';
17
+ // Both brands select apps in update.json: the cresc docs and the client SDK
18
+ // (`import _updateConfig from './update.json'`) read that name too.
19
+ exports.updateJson = 'update.json';
18
20
  exports.tempDir = exports.IS_CRESC ? '.cresc.temp' : '.pushy';
19
21
  exports.pricingPageUrl = exports.IS_CRESC
20
22
  ? 'https://cresc.dev/pricing'
@@ -37,6 +37,8 @@ export interface VersionCheck {
37
37
  done: Promise<void>;
38
38
  /** wait for the check, but never longer than `graceMs` */
39
39
  settle: (graceMs: number) => Promise<void>;
40
+ /** launch a detached self-update after the foreground command is done */
41
+ startAutoUpdate: () => void;
40
42
  /**
41
43
  * Print the "newer version available" hints if the check has completed by
42
44
  * now; a no-op while it is still pending, when nothing is newer, and after
@@ -460,6 +460,24 @@ async function printVersionCommand({ wait = true, } = {}) {
460
460
  }
461
461
  const [latestCliVersion, latestRnuVersion] = latest ?? [];
462
462
  console.log(`react-native-update-cli: ${package_json_1.default.version}${latestTag(latestCliVersion)}`);
463
+ try {
464
+ const { consumeAutoUpdateNotice } = require('../auto-update');
465
+ const notice = consumeAutoUpdateNotice(package_json_1.default.version);
466
+ if (notice?.kind === 'updated') {
467
+ console.log((0, i18n_1.t)('autoUpdateSuccess', {
468
+ from: notice.currentVersion,
469
+ to: notice.targetVersion,
470
+ }));
471
+ }
472
+ else if (notice?.kind === 'permission') {
473
+ console.warn((0, i18n_1.t)('autoUpdatePermission', {
474
+ command: notice.command,
475
+ }));
476
+ }
477
+ }
478
+ catch {
479
+ // A corrupt/unwritable updater cache cannot affect normal commands.
480
+ }
463
481
  if (rnuVersion) {
464
482
  console.log(`react-native-update: ${rnuVersion}${latestTag(latestRnuVersion)}`);
465
483
  if (constants_1.IS_CRESC) {
@@ -506,5 +524,19 @@ async function printVersionCommand({ wait = true, } = {}) {
506
524
  });
507
525
  return Promise.race([check, grace]).then(() => clearTimeout(timer));
508
526
  };
509
- return { done: check, settle, printHints };
527
+ let autoUpdateStarted = false;
528
+ const startAutoUpdate = () => {
529
+ if (autoUpdateStarted || !isNewer(latest?.[0], package_json_1.default.version)) {
530
+ return;
531
+ }
532
+ autoUpdateStarted = true;
533
+ try {
534
+ const { launchAutoUpdate } = require('../auto-update');
535
+ launchAutoUpdate(package_json_1.default.version, latest?.[0]);
536
+ }
537
+ catch {
538
+ // Self-update is strictly opportunistic and never affects the command.
539
+ }
540
+ };
541
+ return { done: check, settle, startAutoUpdate, printHints };
510
542
  }
package/lib/versions.js CHANGED
@@ -367,10 +367,7 @@ exports.versionCommands = {
367
367
  throw new Error((0, i18n_1.t)('publishUsage'));
368
368
  }
369
369
  const platform = await (0, app_1.getPlatform)(options.platform);
370
- let appId = options.appId;
371
- if (!appId) {
372
- appId = (await (0, app_1.getSelectedApp)(platform, options.config)).appId;
373
- }
370
+ const appId = await (0, app_1.resolveAppId)({ ...options, platform });
374
371
  const nonInteractive = (0, options_1.getBooleanOption)(options, 'no-interactive', false) || (0, utils_1.isNonInteractive)();
375
372
  // The source map is archived with the version so `pushy symbolicate` can
376
373
  // map crashes back to source. An explicit path that does not exist is a
@@ -444,6 +441,7 @@ exports.versionCommands = {
444
441
  options: {
445
442
  versionId: id,
446
443
  platform,
444
+ appId,
447
445
  packageId,
448
446
  packageVersion,
449
447
  packageVersionRange,
@@ -463,6 +461,7 @@ exports.versionCommands = {
463
461
  options: {
464
462
  versionId: id,
465
463
  platform,
464
+ appId,
466
465
  versionDeps: depVersions,
467
466
  warnDepsChanges: true,
468
467
  },
@@ -472,31 +471,19 @@ exports.versionCommands = {
472
471
  return versionName;
473
472
  },
474
473
  versions: async ({ options }) => {
475
- let appId = options.appId;
476
- if (!appId) {
477
- const platform = await (0, app_1.getPlatform)(options.platform);
478
- appId = (await (0, app_1.getSelectedApp)(platform, options.config)).appId;
479
- }
474
+ const appId = await (0, app_1.resolveAppId)(options);
480
475
  const interactive = !((0, options_1.getBooleanOption)(options, 'no-interactive', false) || (0, utils_1.isNonInteractive)());
481
- await listVersions(String(appId), interactive);
476
+ await listVersions(appId, interactive);
482
477
  },
483
478
  update: async ({ options }) => {
484
479
  const nonInteractive = (0, options_1.getBooleanOption)(options, 'no-interactive', false) || (0, utils_1.isNonInteractive)();
485
- let appId = options.appId;
486
- let platform = options.platform;
487
- if (!appId) {
488
- platform = await (0, app_1.getPlatform)(platform);
489
- appId = (await (0, app_1.getSelectedApp)(platform, options.config)).appId;
490
- }
491
- else if (platform) {
492
- platform = await (0, app_1.getPlatform)(platform);
493
- }
480
+ const appId = await (0, app_1.resolveAppId)(options);
494
481
  let versionId = options.versionId;
495
482
  if (!versionId) {
496
483
  if (nonInteractive) {
497
484
  throw new Error((0, i18n_1.t)('versionIdRequired'));
498
485
  }
499
- versionId = String((await chooseVersion(String(appId))).id);
486
+ versionId = String((await chooseVersion(appId)).id);
500
487
  }
501
488
  if (versionId === 'null') {
502
489
  versionId = null;
@@ -513,7 +500,7 @@ exports.versionCommands = {
513
500
  throw new Error((0, i18n_1.t)('rolloutRangeError'));
514
501
  }
515
502
  }
516
- const allPkgs = await (0, api_1.getAllPackages)(String(appId));
503
+ const allPkgs = await (0, api_1.getAllPackages)(appId);
517
504
  if (!allPkgs) {
518
505
  throw new Error((0, i18n_1.t)('noPackagesFound', { appId }));
519
506
  }
@@ -572,7 +559,7 @@ exports.versionCommands = {
572
559
  throw new Error((0, i18n_1.t)('packageIdRequired'));
573
560
  }
574
561
  // the package list was already fetched above: no second round trip
575
- pkgId = String((await (0, package_1.choosePackage)(String(appId), allPkgs)).id);
562
+ pkgId = String((await (0, package_1.choosePackage)(appId, allPkgs)).id);
576
563
  }
577
564
  if (!pkgId) {
578
565
  throw new Error((0, i18n_1.t)('packageIdRequired'));
@@ -587,14 +574,14 @@ exports.versionCommands = {
587
574
  }
588
575
  if (options.warnDepsChanges && versionId) {
589
576
  await printDepsChangesForPublish({
590
- appId: String(appId),
577
+ appId,
591
578
  versionId: String(versionId),
592
579
  pkgs: pkgsToBind,
593
580
  providedVersionDeps: options.versionDeps,
594
581
  });
595
582
  }
596
583
  await (0, exports.bindVersionToPackages)({
597
- appId: String(appId),
584
+ appId,
598
585
  // keep null as-is: `--versionId null` means unbinding the version
599
586
  versionId: versionId ?? null,
600
587
  pkgs: pkgsToBind,
@@ -604,21 +591,13 @@ exports.versionCommands = {
604
591
  },
605
592
  updateVersionInfo: async ({ options, }) => {
606
593
  const nonInteractive = (0, options_1.getBooleanOption)(options, 'no-interactive', false) || (0, utils_1.isNonInteractive)();
607
- let appId = options.appId;
608
- let platform = options.platform;
609
- if (!appId) {
610
- platform = await (0, app_1.getPlatform)(platform);
611
- appId = (await (0, app_1.getSelectedApp)(platform, options.config)).appId;
612
- }
613
- else if (platform) {
614
- await (0, app_1.getPlatform)(platform);
615
- }
594
+ const appId = await (0, app_1.resolveAppId)(options);
616
595
  let versionId = options.versionId;
617
596
  if (!versionId) {
618
597
  if (nonInteractive) {
619
598
  throw new Error((0, i18n_1.t)('versionIdRequired'));
620
599
  }
621
- versionId = String((await chooseVersion(String(appId))).id);
600
+ versionId = String((await chooseVersion(appId)).id);
622
601
  }
623
602
  const updateParams = {};
624
603
  if (options.name)
@@ -627,16 +606,12 @@ exports.versionCommands = {
627
606
  updateParams.description = options.description;
628
607
  if (options.metaInfo)
629
608
  updateParams.metaInfo = options.metaInfo;
630
- await (0, api_1.put)(`/app/${String(appId)}/version/${versionId}`, updateParams);
609
+ await (0, api_1.put)(`/app/${appId}/version/${versionId}`, updateParams);
631
610
  console.log((0, i18n_1.t)('operationSuccess'));
632
611
  },
633
612
  deleteVersion: async ({ options }) => {
634
613
  const nonInteractive = (0, options_1.getBooleanOption)(options, 'no-interactive', false) || (0, utils_1.isNonInteractive)();
635
- let appId = options.appId;
636
- if (!appId) {
637
- const platform = await (0, app_1.getPlatform)(options.platform);
638
- appId = (await (0, app_1.getSelectedApp)(platform, options.config)).appId;
639
- }
614
+ const appId = await (0, app_1.resolveAppId)(options);
640
615
  const parsedVersionIds = (0, options_1.getStringListOption)(options, 'versionIds') ??
641
616
  (0, options_1.getStringListOption)(options, 'versionId');
642
617
  let versionIds = parsedVersionIds;
@@ -644,16 +619,16 @@ exports.versionCommands = {
644
619
  if (nonInteractive) {
645
620
  throw new Error((0, i18n_1.t)('versionIdRequired'));
646
621
  }
647
- versionIds = [String((await chooseVersion(String(appId))).id)];
622
+ versionIds = [String((await chooseVersion(appId)).id)];
648
623
  }
649
624
  try {
650
625
  if (versionIds.length === 1) {
651
626
  const [versionId] = versionIds;
652
- await (0, api_1.doDelete)(`/app/${String(appId)}/version/${versionId}`);
627
+ await (0, api_1.doDelete)(`/app/${appId}/version/${versionId}`);
653
628
  console.log((0, i18n_1.t)('deleteVersionSuccess', { versionId }));
654
629
  }
655
630
  else {
656
- await (0, api_1.doDelete)(`/app/${String(appId)}/version`, {
631
+ await (0, api_1.doDelete)(`/app/${appId}/version`, {
657
632
  versionIds: toNumericIds(versionIds),
658
633
  });
659
634
  console.log((0, i18n_1.t)('deleteVersionsSuccess', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update-cli",
3
- "version": "2.23.0",
3
+ "version": "2.24.0",
4
4
  "description": "command line tool for react-native-update (remote updates for react native)",
5
5
  "main": "lib/exports.js",
6
6
  "types": "lib/exports.d.ts",