react-native-update-cli 2.24.2 → 2.25.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.
- package/README.md +11 -4
- package/README.zh-CN.md +11 -4
- package/cli.json +7 -1
- package/lib/api.d.ts +2 -0
- package/lib/api.js +63 -18
- package/lib/app.js +25 -3
- package/lib/bin.js +39 -45
- package/lib/bundle-runner.d.ts +27 -0
- package/lib/bundle-runner.js +240 -21
- package/lib/bundle.d.ts +1 -1
- package/lib/bundle.js +19 -6
- package/lib/commands.d.ts +6 -0
- package/lib/commands.js +65 -0
- package/lib/locales/en.d.ts +5 -14
- package/lib/locales/en.js +5 -14
- package/lib/locales/zh.d.ts +5 -13
- package/lib/locales/zh.js +5 -13
- package/lib/package.js +4 -0
- package/lib/provider.d.ts +1 -1
- package/lib/provider.js +3 -1
- package/lib/symbolicate.js +7 -2
- package/lib/types.d.ts +1 -0
- package/lib/user.js +6 -0
- package/lib/utils/add-gitignore.js +7 -1
- package/lib/utils/dep-versions.d.ts +7 -0
- package/lib/utils/dep-versions.js +78 -26
- package/lib/utils/git.js +9 -6
- package/lib/utils/hermes-base.js +2 -1
- package/lib/utils/i18n.d.ts +5 -0
- package/lib/utils/i18n.js +14 -1
- package/lib/utils/index.d.ts +2 -1
- package/lib/utils/index.js +9 -4
- package/lib/utils/latest-version/index.js +8 -0
- package/lib/utils/runtime.d.ts +21 -0
- package/lib/utils/runtime.js +138 -5
- package/lib/utils/zip-range.js +3 -2
- package/lib/versions.js +7 -4
- package/package.json +4 -2
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -17
- package/src/api.ts +0 -470
- package/src/app.ts +0 -241
- package/src/auto-update.ts +0 -647
- package/src/bin-cresc.ts +0 -8
- package/src/bin.ts +0 -115
- package/src/bundle-pack.ts +0 -61
- package/src/bundle-runner.ts +0 -1430
- package/src/bundle.ts +0 -371
- package/src/cache.ts +0 -20
- package/src/diff.ts +0 -1010
- package/src/exports.ts +0 -17
- package/src/index.ts +0 -1
- package/src/install.ts +0 -50
- package/src/locales/en.ts +0 -257
- package/src/locales/zh.ts +0 -234
- package/src/native-package.ts +0 -338
- package/src/package.ts +0 -482
- package/src/provider.ts +0 -294
- package/src/symbolicate.ts +0 -164
- package/src/types.ts +0 -150
- package/src/user.ts +0 -39
- package/src/utils/add-gitignore.ts +0 -35
- package/src/utils/app-info-parser/aab.ts +0 -241
- package/src/utils/app-info-parser/apk.ts +0 -92
- package/src/utils/app-info-parser/app.ts +0 -7
- package/src/utils/app-info-parser/index.ts +0 -54
- package/src/utils/app-info-parser/ipa.ts +0 -109
- package/src/utils/app-info-parser/resource-finder.ts +0 -508
- package/src/utils/app-info-parser/utils.ts +0 -161
- package/src/utils/app-info-parser/xml-parser/binary.ts +0 -693
- package/src/utils/app-info-parser/xml-parser/manifest.ts +0 -228
- package/src/utils/app-info-parser/zip.ts +0 -108
- package/src/utils/check-lockfile.ts +0 -93
- package/src/utils/check-plugin.ts +0 -38
- package/src/utils/command-result.ts +0 -24
- package/src/utils/constants.ts +0 -25
- package/src/utils/dep-versions.ts +0 -83
- package/src/utils/git.ts +0 -71
- package/src/utils/hbcTransform.ts +0 -649
- package/src/utils/hermes-base.ts +0 -1137
- package/src/utils/http-helper.ts +0 -152
- package/src/utils/i18n.ts +0 -39
- package/src/utils/index.ts +0 -698
- package/src/utils/latest-version/index.ts +0 -573
- package/src/utils/options.ts +0 -78
- package/src/utils/plugin-config.ts +0 -32
- package/src/utils/runtime.ts +0 -187
- package/src/utils/slim-sourcemap.ts +0 -105
- package/src/utils/zip-entries.ts +0 -209
- package/src/utils/zip-options.ts +0 -178
- package/src/utils/zip-range.ts +0 -727
- package/src/utils/zip-raw-writer.ts +0 -247
- 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();
|
package/src/bundle-pack.ts
DELETED
|
@@ -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
|
-
}
|