react-native-update-cli 2.24.2 → 2.26.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.
Files changed (98) hide show
  1. package/README.md +12 -5
  2. package/README.zh-CN.md +12 -5
  3. package/cli.json +7 -1
  4. package/lib/api.d.ts +2 -0
  5. package/lib/api.js +63 -18
  6. package/lib/app.js +25 -3
  7. package/lib/bin.js +39 -45
  8. package/lib/bundle-runner.d.ts +45 -1
  9. package/lib/bundle-runner.js +303 -34
  10. package/lib/bundle.d.ts +1 -1
  11. package/lib/bundle.js +23 -7
  12. package/lib/commands.d.ts +6 -0
  13. package/lib/commands.js +65 -0
  14. package/lib/locales/en.d.ts +7 -14
  15. package/lib/locales/en.js +10 -17
  16. package/lib/locales/zh.d.ts +7 -13
  17. package/lib/locales/zh.js +10 -16
  18. package/lib/package.js +4 -0
  19. package/lib/provider.d.ts +1 -1
  20. package/lib/provider.js +3 -1
  21. package/lib/symbolicate.js +7 -2
  22. package/lib/types.d.ts +1 -0
  23. package/lib/user.js +6 -0
  24. package/lib/utils/add-gitignore.js +7 -1
  25. package/lib/utils/dep-versions.d.ts +7 -0
  26. package/lib/utils/dep-versions.js +78 -26
  27. package/lib/utils/git.js +9 -6
  28. package/lib/utils/hbcTransform.d.ts +15 -0
  29. package/lib/utils/hbcTransform.js +22 -0
  30. package/lib/utils/hermes-base.d.ts +61 -6
  31. package/lib/utils/hermes-base.js +328 -46
  32. package/lib/utils/hermes-literals.d.ts +51 -0
  33. package/lib/utils/hermes-literals.js +210 -0
  34. package/lib/utils/i18n.d.ts +5 -0
  35. package/lib/utils/i18n.js +14 -1
  36. package/lib/utils/index.d.ts +2 -1
  37. package/lib/utils/index.js +9 -4
  38. package/lib/utils/latest-version/index.js +8 -0
  39. package/lib/utils/runtime.d.ts +21 -0
  40. package/lib/utils/runtime.js +138 -5
  41. package/lib/utils/zip-range.js +3 -2
  42. package/lib/versions.js +14 -4
  43. package/package.json +6 -3
  44. package/lib/index.d.ts +0 -1
  45. package/lib/index.js +0 -17
  46. package/src/api.ts +0 -470
  47. package/src/app.ts +0 -241
  48. package/src/auto-update.ts +0 -647
  49. package/src/bin-cresc.ts +0 -8
  50. package/src/bin.ts +0 -115
  51. package/src/bundle-pack.ts +0 -61
  52. package/src/bundle-runner.ts +0 -1430
  53. package/src/bundle.ts +0 -371
  54. package/src/cache.ts +0 -20
  55. package/src/diff.ts +0 -1010
  56. package/src/exports.ts +0 -17
  57. package/src/index.ts +0 -1
  58. package/src/install.ts +0 -50
  59. package/src/locales/en.ts +0 -257
  60. package/src/locales/zh.ts +0 -234
  61. package/src/native-package.ts +0 -338
  62. package/src/package.ts +0 -482
  63. package/src/provider.ts +0 -294
  64. package/src/symbolicate.ts +0 -164
  65. package/src/types.ts +0 -150
  66. package/src/user.ts +0 -39
  67. package/src/utils/add-gitignore.ts +0 -35
  68. package/src/utils/app-info-parser/aab.ts +0 -241
  69. package/src/utils/app-info-parser/apk.ts +0 -92
  70. package/src/utils/app-info-parser/app.ts +0 -7
  71. package/src/utils/app-info-parser/index.ts +0 -54
  72. package/src/utils/app-info-parser/ipa.ts +0 -109
  73. package/src/utils/app-info-parser/resource-finder.ts +0 -508
  74. package/src/utils/app-info-parser/utils.ts +0 -161
  75. package/src/utils/app-info-parser/xml-parser/binary.ts +0 -693
  76. package/src/utils/app-info-parser/xml-parser/manifest.ts +0 -228
  77. package/src/utils/app-info-parser/zip.ts +0 -108
  78. package/src/utils/check-lockfile.ts +0 -93
  79. package/src/utils/check-plugin.ts +0 -38
  80. package/src/utils/command-result.ts +0 -24
  81. package/src/utils/constants.ts +0 -25
  82. package/src/utils/dep-versions.ts +0 -83
  83. package/src/utils/git.ts +0 -71
  84. package/src/utils/hbcTransform.ts +0 -649
  85. package/src/utils/hermes-base.ts +0 -1137
  86. package/src/utils/http-helper.ts +0 -152
  87. package/src/utils/i18n.ts +0 -39
  88. package/src/utils/index.ts +0 -698
  89. package/src/utils/latest-version/index.ts +0 -573
  90. package/src/utils/options.ts +0 -78
  91. package/src/utils/plugin-config.ts +0 -32
  92. package/src/utils/runtime.ts +0 -187
  93. package/src/utils/slim-sourcemap.ts +0 -105
  94. package/src/utils/zip-entries.ts +0 -209
  95. package/src/utils/zip-options.ts +0 -178
  96. package/src/utils/zip-range.ts +0 -727
  97. package/src/utils/zip-raw-writer.ts +0 -247
  98. package/src/versions.ts +0 -892
package/src/bin.ts DELETED
@@ -1,115 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { loadSession } from './api';
4
- import { getAppCommands } from './app';
5
- import { bundleCommands } from './bundle';
6
- import { cacheCommands } from './cache';
7
- import { diffCommands } from './diff';
8
- import { installCommands } from './install';
9
- import { packageCommands } from './package';
10
- import { symbolicateCommands } from './symbolicate';
11
- import { userCommands } from './user';
12
- import { printVersionCommand } from './utils';
13
- import { t } from './utils/i18n';
14
- import { versionCommands } from './versions';
15
-
16
- type CliCommandHandler = (argv: any) => Promise<unknown> | unknown;
17
-
18
- interface CliArgv {
19
- command: string;
20
- args: string[];
21
- options: Record<string, any>;
22
- }
23
-
24
- function isTruthyEnv(value: string | undefined): boolean {
25
- return value === '1' || value?.toLowerCase() === 'true';
26
- }
27
-
28
- function printUsage(exitCode = 1) {
29
- console.log('React Native Update CLI');
30
- console.log('');
31
- console.log('Commands:');
32
- for (const name of Object.keys(commandHandlers)) {
33
- console.log(` ${name}`);
34
- }
35
-
36
- console.log('');
37
- console.log('Special commands:');
38
- console.log(' list: List all available commands');
39
- console.log(' help: Show this help message');
40
-
41
- console.log('');
42
- console.log(
43
- 'Visit `https://github.com/reactnativecn/react-native-update` for document.',
44
- );
45
- process.exit(exitCode);
46
- }
47
-
48
- const commandHandlers: Record<string, CliCommandHandler> = {
49
- ...userCommands,
50
- ...bundleCommands,
51
- ...cacheCommands,
52
- ...diffCommands,
53
- ...getAppCommands(),
54
- ...packageCommands,
55
- ...versionCommands,
56
- ...symbolicateCommands,
57
- ...installCommands,
58
- help: printUsage,
59
- };
60
-
61
- async function run() {
62
- const versionOnly =
63
- process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version';
64
- // The registry check for newer versions runs alongside the command (from a
65
- // 1-day cache when possible) and only ever delays `-v`/`version` itself; its
66
- // hint is printed once the command is done, or at exit for commands that
67
- // exit on their own.
68
- const versionCheck = await printVersionCommand({ wait: versionOnly });
69
- if (versionOnly) {
70
- versionCheck.startAutoUpdate();
71
- process.exit();
72
- }
73
- process.on('exit', (code) => {
74
- if (code === 0) {
75
- versionCheck.printHints();
76
- versionCheck.startAutoUpdate();
77
- }
78
- });
79
-
80
- const argv: CliArgv = require('cli-arguments').parse(require('../cli.json'));
81
- global.NO_INTERACTIVE =
82
- Boolean(argv.options['no-interactive']) ||
83
- isTruthyEnv(process.env.NO_INTERACTIVE);
84
- global.USE_ACC_OSS =
85
- Boolean(argv.options.acc) || isTruthyEnv(process.env.USE_ACC_OSS);
86
-
87
- try {
88
- await loadSession();
89
-
90
- if (argv.command === 'help') {
91
- printUsage(0);
92
- } else if (argv.command === 'list') {
93
- printUsage(0);
94
- } else if (commandHandlers[argv.command]) {
95
- const handler = commandHandlers[argv.command];
96
- await handler(argv);
97
- // a check still in flight (cold cache) gets a short grace period; the
98
- // registry request itself is unref'd, so exiting never waits on it
99
- await versionCheck.settle(500);
100
- versionCheck.printHints();
101
- versionCheck.startAutoUpdate();
102
- } else {
103
- throw new Error(t('unknownCommand', { command: argv.command }));
104
- }
105
- } catch (err: any) {
106
- if (err.status === 401) {
107
- console.log(t('loginFirst'));
108
- process.exit(1);
109
- }
110
- console.error(err.stack);
111
- process.exit(1);
112
- }
113
- }
114
-
115
- run();
@@ -1,61 +0,0 @@
1
- import * as fs from 'fs-extra';
2
- import path from 'path';
3
- import { ZipFile as YazlZipFile } from 'yazl';
4
- import { t } from './utils/i18n';
5
- import { zipOptionsForPayloadFile } from './utils/zip-options';
6
-
7
- const ignorePackingExtensions = ['DS_Store', 'txt.map'];
8
-
9
- export async function packBundle(
10
- dir: string,
11
- output: string,
12
- bundleName?: string,
13
- ): Promise<void> {
14
- const ignorePackingFileNames = [
15
- 'index.bundlejs.map',
16
- 'bundle.harmony.js.map',
17
- ];
18
- if (bundleName) {
19
- ignorePackingFileNames.push(`${bundleName}.map`);
20
- }
21
- console.log(t('packing'));
22
- fs.ensureDirSync(path.dirname(output));
23
- await new Promise<void>((resolve, reject) => {
24
- const zipfile = new YazlZipFile();
25
-
26
- function addDirectory(root: string, rel: string) {
27
- if (rel) {
28
- zipfile.addEmptyDirectory(rel);
29
- }
30
- const children = fs.readdirSync(root);
31
- for (const name of children) {
32
- if (
33
- ignorePackingFileNames.includes(name) ||
34
- ignorePackingExtensions.some((ext) => name.endsWith(`.${ext}`))
35
- ) {
36
- continue;
37
- }
38
- const fullPath = path.join(root, name);
39
- const stat = fs.statSync(fullPath);
40
- if (stat.isFile()) {
41
- zipfile.addFile(
42
- fullPath,
43
- rel + name,
44
- zipOptionsForPayloadFile(fullPath, rel + name),
45
- );
46
- } else if (stat.isDirectory()) {
47
- addDirectory(fullPath, `${rel}${name}/`);
48
- }
49
- }
50
- }
51
-
52
- addDirectory(dir, '');
53
-
54
- zipfile.outputStream.on('error', (err: unknown) => reject(err));
55
- zipfile.outputStream.pipe(fs.createWriteStream(output)).on('close', () => {
56
- resolve();
57
- });
58
- zipfile.end();
59
- });
60
- console.log(t('fileGenerated', { file: output }));
61
- }