react-native-update-cli 2.10.0 → 2.10.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.
Files changed (65) hide show
  1. package/README.md +47 -497
  2. package/README.zh-CN.md +52 -500
  3. package/cli.json +2 -16
  4. package/lib/api.js +1 -1
  5. package/lib/app.d.ts +7 -6
  6. package/lib/app.js +23 -22
  7. package/lib/exports.d.ts +1 -1
  8. package/lib/index.d.ts +2 -3
  9. package/lib/index.js +14 -62
  10. package/lib/locales/en.d.ts +1 -0
  11. package/lib/locales/en.js +1 -0
  12. package/lib/locales/zh.d.ts +1 -0
  13. package/lib/locales/zh.js +1 -0
  14. package/lib/module-manager.d.ts +1 -5
  15. package/lib/module-manager.js +2 -30
  16. package/lib/modules/app-module.js +1 -249
  17. package/lib/modules/bundle-module.js +1 -173
  18. package/lib/modules/package-module.js +1 -2
  19. package/lib/modules/user-module.js +1 -399
  20. package/lib/modules/version-module.js +1 -2
  21. package/lib/package.d.ts +1 -2
  22. package/lib/package.js +6 -6
  23. package/lib/provider.d.ts +1 -4
  24. package/lib/provider.js +2 -21
  25. package/lib/types.d.ts +0 -20
  26. package/lib/user.d.ts +1 -1
  27. package/lib/user.js +1 -1
  28. package/lib/utils/app-info-parser/aab.js +1 -1
  29. package/lib/utils/app-info-parser/resource-finder.js +5 -5
  30. package/lib/utils/app-info-parser/utils.js +3 -2
  31. package/lib/utils/check-lockfile.js +1 -1
  32. package/lib/utils/dep-versions.js +2 -2
  33. package/lib/utils/http-helper.js +2 -2
  34. package/lib/utils/index.d.ts +1 -1
  35. package/lib/utils/index.js +1 -1
  36. package/lib/versions.d.ts +1 -0
  37. package/lib/versions.js +19 -14
  38. package/package.json +1 -1
  39. package/src/api.ts +1 -1
  40. package/src/app.ts +39 -40
  41. package/src/exports.ts +0 -2
  42. package/src/index.ts +16 -81
  43. package/src/locales/en.ts +1 -0
  44. package/src/locales/zh.ts +1 -0
  45. package/src/module-manager.ts +1 -41
  46. package/src/modules/app-module.ts +1 -271
  47. package/src/modules/bundle-module.ts +1 -206
  48. package/src/modules/package-module.ts +0 -3
  49. package/src/modules/user-module.ts +1 -459
  50. package/src/modules/version-module.ts +0 -1
  51. package/src/package.ts +5 -7
  52. package/src/provider.ts +4 -25
  53. package/src/types.ts +0 -32
  54. package/src/user.ts +1 -1
  55. package/src/utils/app-info-parser/aab.ts +1 -1
  56. package/src/utils/app-info-parser/resource-finder.ts +5 -5
  57. package/src/utils/app-info-parser/utils.ts +2 -2
  58. package/src/utils/check-lockfile.ts +1 -1
  59. package/src/utils/dep-versions.ts +2 -2
  60. package/src/utils/http-helper.ts +2 -2
  61. package/src/utils/index.ts +1 -1
  62. package/src/versions.ts +24 -14
  63. package/lib/workflow-runner.d.ts +0 -2
  64. package/lib/workflow-runner.js +0 -25
  65. package/src/workflow-runner.ts +0 -24
@@ -71,7 +71,7 @@ const mapInfoResource = (
71
71
  * @param info // json info parsed from .apk file
72
72
  */
73
73
  const findApkIconPath = (info: any) => {
74
- if (!info.application.icon || !info.application.icon.splice) {
74
+ if (!info.application.icon?.splice) {
75
75
  return '';
76
76
  }
77
77
  const rulesMap: Record<string, number> = {
@@ -142,7 +142,7 @@ const getBase64FromBuffer = (buffer: Buffer | string) => {
142
142
  */
143
143
  const decodeNullUnicode = (value: string | RegExp) => {
144
144
  if (typeof value === 'string') {
145
- // biome-ignore lint/suspicious/noControlCharactersInRegex: <explanation>
145
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: strips null unicode padding from decoded strings
146
146
  return value.replace(/\u0000/g, '');
147
147
  }
148
148
  return value;
@@ -17,7 +17,7 @@ function hasWorkspaces(dir: string): boolean {
17
17
  try {
18
18
  const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
19
19
  return !!pkg.workspaces;
20
- } catch (e) {
20
+ } catch (_e) {
21
21
  // Ignore parsing errors
22
22
  }
23
23
  }
@@ -1,7 +1,7 @@
1
1
  let currentPackage = null;
2
2
  try {
3
3
  currentPackage = require(`${process.cwd()}/package.json`);
4
- } catch (e) {
4
+ } catch (_e) {
5
5
  // console.warn('No package.json file were found');
6
6
  }
7
7
 
@@ -23,7 +23,7 @@ if (currentPackage) {
23
23
  });
24
24
  const version = require(packageJsonPath).version;
25
25
  _depVersions[dep] = version;
26
- } catch (e) {}
26
+ } catch (_e) {}
27
27
  }
28
28
  }
29
29
 
@@ -28,7 +28,7 @@ export const ping = async (url: string) => {
28
28
  fetch(url, {
29
29
  method: 'HEAD',
30
30
  })
31
- .then(({ status, statusText }) => {
31
+ .then(({ status }) => {
32
32
  pingFinished = true;
33
33
  if (status === 200) {
34
34
  // console.log('ping success', url);
@@ -37,7 +37,7 @@ export const ping = async (url: string) => {
37
37
  // console.log('ping failed', url, status, statusText);
38
38
  throw new Error('ping failed');
39
39
  })
40
- .catch((e) => {
40
+ .catch((_e) => {
41
41
  pingFinished = true;
42
42
  // console.log('ping error', url, e);
43
43
  throw new Error('ping error');
@@ -403,7 +403,7 @@ async function resolveResource(
403
403
 
404
404
  const localDir = path.resolve(os.homedir(), tempDir);
405
405
  fs.ensureDirSync(localDir);
406
- export function saveToLocal(originPath: string, destName: string) {
406
+ export function saveToLocal(_originPath: string, _destName: string) {
407
407
  // TODO
408
408
  // const destPath = path.join(localDir, destName);
409
409
  // fs.ensureDirSync(path.dirname(destPath));
package/src/versions.ts CHANGED
@@ -25,6 +25,7 @@ interface VersionCommandOptions {
25
25
  rollout?: string;
26
26
  dryRun?: boolean;
27
27
  versionDeps?: Record<string, string>;
28
+ warnDepsChanges?: boolean;
28
29
  }
29
30
 
30
31
  type Deps = Record<string, string>;
@@ -193,6 +194,7 @@ function printDepsChangesForPackage({
193
194
  ]);
194
195
 
195
196
  console.log('');
197
+ console.log(chalk.bgYellow.black.bold(` ${t('depsChangeWarningTitle')} `));
196
198
  console.log(
197
199
  chalk.yellow(
198
200
  t('depsChangeTargetPackage', {
@@ -243,7 +245,7 @@ async function printDepsChangesForPublish({
243
245
  pkgs: Package[];
244
246
  providedVersionDeps?: Deps;
245
247
  }) {
246
- if (!versionId || pkgs.length === 0) {
248
+ if (!versionId || pkgs.length !== 1) {
247
249
  return;
248
250
  }
249
251
 
@@ -279,7 +281,7 @@ async function printDepsChangesForPublish({
279
281
  }
280
282
 
281
283
  async function showVersion(appId: string, offset: number) {
282
- const { data, count } = await get(`/app/${appId}/version/list`);
284
+ const { data } = await get(`/app/${appId}/version/list`);
283
285
  console.log(t('offset', { offset }));
284
286
  for (const version of data) {
285
287
  const pkgCount = version.packages?.length || 0;
@@ -401,17 +403,17 @@ export const bindVersionToPackages = async ({
401
403
  };
402
404
 
403
405
  export const versionCommands = {
404
- publish: async function ({
406
+ publish: async ({
405
407
  args,
406
408
  options,
407
409
  }: {
408
410
  args: string[];
409
411
  options: VersionCommandOptions;
410
- }) {
412
+ }) => {
411
413
  const fn = args[0];
412
414
  const { name, description, metaInfo } = options;
413
415
 
414
- if (!fn || !fn.endsWith('.ppk')) {
416
+ if (!fn?.endsWith('.ppk')) {
415
417
  throw new Error(t('publishUsage'));
416
418
  }
417
419
 
@@ -452,7 +454,7 @@ export const versionCommands = {
452
454
  minPackageVersion ||
453
455
  maxPackageVersion
454
456
  ) {
455
- await this.update({
457
+ await versionCommands.update({
456
458
  options: {
457
459
  versionId: id,
458
460
  platform,
@@ -464,13 +466,19 @@ export const versionCommands = {
464
466
  rollout,
465
467
  dryRun,
466
468
  versionDeps: depVersions,
469
+ warnDepsChanges: true,
467
470
  },
468
471
  });
469
472
  } else {
470
473
  const q = await question(t('updateNativePackageQuestion'));
471
474
  if (q.toLowerCase() === 'y') {
472
- await this.update({
473
- options: { versionId: id, platform, versionDeps: depVersions },
475
+ await versionCommands.update({
476
+ options: {
477
+ versionId: id,
478
+ platform,
479
+ versionDeps: depVersions,
480
+ warnDepsChanges: true,
481
+ },
474
482
  });
475
483
  }
476
484
  }
@@ -570,12 +578,14 @@ export const versionCommands = {
570
578
  }
571
579
  }
572
580
 
573
- await printDepsChangesForPublish({
574
- appId: String(appId),
575
- versionId: String(versionId),
576
- pkgs: pkgsToBind,
577
- providedVersionDeps: options.versionDeps,
578
- });
581
+ if (options.warnDepsChanges) {
582
+ await printDepsChangesForPublish({
583
+ appId: String(appId),
584
+ versionId: String(versionId),
585
+ pkgs: pkgsToBind,
586
+ providedVersionDeps: options.versionDeps,
587
+ });
588
+ }
579
589
 
580
590
  await bindVersionToPackages({
581
591
  appId: String(appId),
@@ -1,2 +0,0 @@
1
- import type { CommandContext, CustomWorkflow } from './types';
2
- export declare function runWorkflow(workflowName: string, workflow: CustomWorkflow, context: CommandContext): Promise<unknown>;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "runWorkflow", {
6
- enumerable: true,
7
- get: function() {
8
- return runWorkflow;
9
- }
10
- });
11
- async function runWorkflow(workflowName, workflow, context) {
12
- if (workflow.validate && !workflow.validate(context)) {
13
- throw new Error(`Workflow '${workflowName}' validation failed`);
14
- }
15
- let previousResult;
16
- for (const step of workflow.steps){
17
- if (step.condition && !step.condition(context)) {
18
- console.log(`Skipping step '${step.name}' due to condition`);
19
- continue;
20
- }
21
- console.log(`Executing step '${step.name}'`);
22
- previousResult = await step.execute(context, previousResult);
23
- }
24
- return previousResult;
25
- }
@@ -1,24 +0,0 @@
1
- import type { CommandContext, CustomWorkflow } from './types';
2
-
3
- export async function runWorkflow(
4
- workflowName: string,
5
- workflow: CustomWorkflow,
6
- context: CommandContext,
7
- ): Promise<unknown> {
8
- if (workflow.validate && !workflow.validate(context)) {
9
- throw new Error(`Workflow '${workflowName}' validation failed`);
10
- }
11
-
12
- let previousResult: unknown;
13
- for (const step of workflow.steps) {
14
- if (step.condition && !step.condition(context)) {
15
- console.log(`Skipping step '${step.name}' due to condition`);
16
- continue;
17
- }
18
-
19
- console.log(`Executing step '${step.name}'`);
20
- previousResult = await step.execute(context, previousResult);
21
- }
22
-
23
- return previousResult;
24
- }