react-native-update-cli 2.10.1 → 2.11.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 +47 -497
- package/README.zh-CN.md +52 -500
- package/cli.json +2 -16
- package/lib/api.js +1 -1
- package/lib/app.d.ts +1 -1
- package/lib/app.js +42 -45
- package/lib/bin.d.ts +2 -0
- package/lib/bin.js +70 -0
- package/lib/bundle-runner.d.ts +1 -0
- package/lib/bundle-runner.js +46 -10
- package/lib/exports.d.ts +2 -9
- package/lib/exports.js +0 -31
- package/lib/index.d.ts +1 -5
- package/lib/index.js +12 -128
- package/lib/locales/en.d.ts +1 -0
- package/lib/locales/en.js +1 -0
- package/lib/locales/zh.d.ts +1 -0
- package/lib/locales/zh.js +1 -0
- package/lib/package.d.ts +1 -2
- package/lib/package.js +50 -10
- package/lib/provider.d.ts +1 -4
- package/lib/provider.js +6 -25
- package/lib/types.d.ts +0 -37
- package/lib/user.d.ts +1 -1
- package/lib/user.js +1 -1
- package/lib/utils/app-info-parser/aab.js +46 -5
- package/lib/utils/app-info-parser/resource-finder.js +5 -5
- package/lib/utils/app-info-parser/utils.js +3 -2
- package/lib/utils/check-lockfile.js +1 -1
- package/lib/utils/dep-versions.js +2 -2
- package/lib/utils/http-helper.js +2 -2
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +0 -13
- package/lib/utils/plugin-config.js +42 -6
- package/lib/versions.d.ts +1 -0
- package/lib/versions.js +19 -16
- package/package.json +8 -10
- package/src/api.ts +1 -1
- package/src/app.ts +40 -40
- package/src/bin.ts +86 -0
- package/src/bundle-runner.ts +70 -12
- package/src/exports.ts +1 -12
- package/src/index.ts +1 -159
- package/src/locales/en.ts +1 -0
- package/src/locales/zh.ts +1 -0
- package/src/package.ts +6 -10
- package/src/provider.ts +10 -29
- package/src/types.ts +0 -54
- package/src/user.ts +1 -1
- package/src/utils/app-info-parser/aab.ts +2 -2
- package/src/utils/app-info-parser/resource-finder.ts +5 -5
- package/src/utils/app-info-parser/utils.ts +2 -2
- package/src/utils/check-lockfile.ts +1 -1
- package/src/utils/dep-versions.ts +2 -2
- package/src/utils/http-helper.ts +2 -2
- package/src/utils/index.ts +1 -12
- package/src/utils/plugin-config.ts +1 -1
- package/src/versions.ts +25 -17
- package/lib/module-manager.d.ts +0 -20
- package/lib/module-manager.js +0 -118
- package/lib/modules/app-module.d.ts +0 -2
- package/lib/modules/app-module.js +0 -263
- package/lib/modules/bundle-module.d.ts +0 -2
- package/lib/modules/bundle-module.js +0 -187
- package/lib/modules/index.d.ts +0 -6
- package/lib/modules/index.js +0 -42
- package/lib/modules/package-module.d.ts +0 -2
- package/lib/modules/package-module.js +0 -16
- package/lib/modules/user-module.d.ts +0 -2
- package/lib/modules/user-module.js +0 -413
- package/lib/modules/version-module.d.ts +0 -2
- package/lib/modules/version-module.js +0 -16
- package/lib/workflow-runner.d.ts +0 -2
- package/lib/workflow-runner.js +0 -25
- package/src/module-manager.ts +0 -145
- package/src/modules/app-module.ts +0 -277
- package/src/modules/bundle-module.ts +0 -212
- package/src/modules/index.ts +0 -19
- package/src/modules/package-module.ts +0 -10
- package/src/modules/user-module.ts +0 -465
- package/src/modules/version-module.ts +0 -8
- package/src/workflow-runner.ts +0 -24
package/lib/app.js
CHANGED
|
@@ -9,15 +9,15 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
get appCommands () {
|
|
13
|
-
return appCommands;
|
|
14
|
-
},
|
|
15
12
|
get assertPlatform () {
|
|
16
13
|
return assertPlatform;
|
|
17
14
|
},
|
|
18
15
|
get chooseApp () {
|
|
19
16
|
return chooseApp;
|
|
20
17
|
},
|
|
18
|
+
get getAppCommands () {
|
|
19
|
+
return getAppCommands;
|
|
20
|
+
},
|
|
21
21
|
get getPlatform () {
|
|
22
22
|
return getPlatform;
|
|
23
23
|
},
|
|
@@ -38,16 +38,11 @@ function _interop_require_default(obj) {
|
|
|
38
38
|
default: obj
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
const validPlatforms = [
|
|
42
|
-
'ios',
|
|
43
|
-
'android',
|
|
44
|
-
'harmony'
|
|
45
|
-
];
|
|
46
41
|
async function getPlatform(platform) {
|
|
47
42
|
return assertPlatform(platform || await (0, _utils.question)((0, _i18n.t)('platformQuestion')));
|
|
48
43
|
}
|
|
49
44
|
function assertPlatform(platform) {
|
|
50
|
-
if (
|
|
45
|
+
if (platform !== 'ios' && platform !== 'android' && platform !== 'harmony') {
|
|
51
46
|
throw new Error((0, _i18n.t)('unsupportedPlatform', {
|
|
52
47
|
platform
|
|
53
48
|
}));
|
|
@@ -138,40 +133,42 @@ async function selectApp({ args, options }) {
|
|
|
138
133
|
};
|
|
139
134
|
await _fs.default.promises.writeFile('update.json', JSON.stringify(updateInfo, null, 4), 'utf8');
|
|
140
135
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
136
|
+
function getAppCommands() {
|
|
137
|
+
return {
|
|
138
|
+
createApp: async ({ options })=>{
|
|
139
|
+
const name = options.name || await (0, _utils.question)((0, _i18n.t)('appNameQuestion'));
|
|
140
|
+
const { downloadUrl } = options;
|
|
141
|
+
const platform = await getPlatform(options.platform);
|
|
142
|
+
const { id } = await (0, _api.post)('/app/create', {
|
|
143
|
+
name,
|
|
144
|
+
platform,
|
|
145
|
+
downloadUrl
|
|
146
|
+
});
|
|
147
|
+
console.log((0, _i18n.t)('createAppSuccess', {
|
|
148
|
+
id
|
|
149
|
+
}));
|
|
150
|
+
await selectApp({
|
|
151
|
+
args: [
|
|
152
|
+
String(id)
|
|
153
|
+
],
|
|
154
|
+
options: {
|
|
155
|
+
platform
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
},
|
|
159
|
+
deleteApp: async ({ args, options })=>{
|
|
160
|
+
const { platform } = options;
|
|
161
|
+
const id = args[0] || (await chooseApp(platform)).id;
|
|
162
|
+
if (!id) {
|
|
163
|
+
console.log((0, _i18n.t)('cancelled'));
|
|
160
164
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
},
|
|
172
|
-
apps: async ({ options })=>{
|
|
173
|
-
const { platform = '' } = options;
|
|
174
|
-
await listApp(platform);
|
|
175
|
-
},
|
|
176
|
-
selectApp
|
|
177
|
-
};
|
|
165
|
+
await (0, _api.doDelete)(`/app/${id}`);
|
|
166
|
+
console.log((0, _i18n.t)('operationSuccess'));
|
|
167
|
+
},
|
|
168
|
+
apps: async ({ options })=>{
|
|
169
|
+
const { platform = '' } = options;
|
|
170
|
+
await listApp(platform);
|
|
171
|
+
},
|
|
172
|
+
selectApp
|
|
173
|
+
};
|
|
174
|
+
}
|
package/lib/bin.d.ts
ADDED
package/lib/bin.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
const _api = require("./api");
|
|
7
|
+
const _app = require("./app");
|
|
8
|
+
const _bundle = require("./bundle");
|
|
9
|
+
const _diff = require("./diff");
|
|
10
|
+
const _install = require("./install");
|
|
11
|
+
const _package = require("./package");
|
|
12
|
+
const _user = require("./user");
|
|
13
|
+
const _utils = require("./utils");
|
|
14
|
+
const _i18n = require("./utils/i18n");
|
|
15
|
+
const _versions = require("./versions");
|
|
16
|
+
function printUsage(exitCode = 1) {
|
|
17
|
+
console.log('React Native Update CLI');
|
|
18
|
+
console.log('');
|
|
19
|
+
console.log('Commands:');
|
|
20
|
+
for (const name of Object.keys(commandHandlers)){
|
|
21
|
+
console.log(` ${name}`);
|
|
22
|
+
}
|
|
23
|
+
console.log('');
|
|
24
|
+
console.log('Special commands:');
|
|
25
|
+
console.log(' list: List all available commands');
|
|
26
|
+
console.log(' help: Show this help message');
|
|
27
|
+
console.log('');
|
|
28
|
+
console.log('Visit `https://github.com/reactnativecn/react-native-update` for document.');
|
|
29
|
+
process.exit(exitCode);
|
|
30
|
+
}
|
|
31
|
+
const commandHandlers = {
|
|
32
|
+
..._user.userCommands,
|
|
33
|
+
..._bundle.bundleCommands,
|
|
34
|
+
..._diff.diffCommands,
|
|
35
|
+
...(0, _app.getAppCommands)(),
|
|
36
|
+
..._package.packageCommands,
|
|
37
|
+
..._versions.versionCommands,
|
|
38
|
+
..._install.installCommands,
|
|
39
|
+
help: printUsage
|
|
40
|
+
};
|
|
41
|
+
async function run() {
|
|
42
|
+
await (0, _utils.printVersionCommand)();
|
|
43
|
+
if (process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version') {
|
|
44
|
+
process.exit();
|
|
45
|
+
}
|
|
46
|
+
const argv = require('cli-arguments').parse(require('../cli.json'));
|
|
47
|
+
global.NO_INTERACTIVE = argv.options['no-interactive'];
|
|
48
|
+
global.USE_ACC_OSS = argv.options.acc;
|
|
49
|
+
try {
|
|
50
|
+
await (0, _api.loadSession)();
|
|
51
|
+
if (argv.command === 'help') {
|
|
52
|
+
printUsage(0);
|
|
53
|
+
} else if (argv.command === 'list') {
|
|
54
|
+
printUsage(0);
|
|
55
|
+
} else if (commandHandlers[argv.command]) {
|
|
56
|
+
const handler = commandHandlers[argv.command];
|
|
57
|
+
await handler(argv);
|
|
58
|
+
} else {
|
|
59
|
+
throw new Error(`Unknown command: ${argv.command}`);
|
|
60
|
+
}
|
|
61
|
+
} catch (err) {
|
|
62
|
+
if (err.status === 401) {
|
|
63
|
+
console.log((0, _i18n.t)('loginFirst'));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
console.error(err.stack);
|
|
67
|
+
process.exit(-1);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
run();
|
package/lib/bundle-runner.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ type ResolvedExpoCli = {
|
|
|
22
22
|
export declare function hasProjectDependency(dependencyName: string, projectRoot?: string): boolean;
|
|
23
23
|
export declare function resolveExpoCli(projectRoot?: string): ResolvedExpoCli;
|
|
24
24
|
export declare function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputFolder, platform, sourcemapOutput, config, forceHermes, cli, isSentry, }: RunBundleCommandOptions): Promise<void>;
|
|
25
|
+
export declare function resolveHermesCommand(projectRoot?: string): string;
|
|
25
26
|
export declare function copyDebugidForSentry(bundleName: string, outputFolder: string, sourcemapOutput: string): Promise<void>;
|
|
26
27
|
export declare function uploadSourcemapForSentry(bundleName: string, outputFolder: string, sourcemapOutput: string, version: string): Promise<void>;
|
|
27
28
|
export {};
|
package/lib/bundle-runner.js
CHANGED
|
@@ -18,6 +18,9 @@ _export(exports, {
|
|
|
18
18
|
get resolveExpoCli () {
|
|
19
19
|
return resolveExpoCli;
|
|
20
20
|
},
|
|
21
|
+
get resolveHermesCommand () {
|
|
22
|
+
return resolveHermesCommand;
|
|
23
|
+
},
|
|
21
24
|
get runReactNativeBundleCommand () {
|
|
22
25
|
return runReactNativeBundleCommand;
|
|
23
26
|
},
|
|
@@ -301,6 +304,48 @@ function getHermesOSBin() {
|
|
|
301
304
|
if (_os.default.platform() === 'darwin') return 'osx-bin';
|
|
302
305
|
if (_os.default.platform() === 'linux') return 'linux64-bin';
|
|
303
306
|
}
|
|
307
|
+
function getHermesExecutableName() {
|
|
308
|
+
return _os.default.platform() === 'win32' ? 'hermesc.exe' : 'hermesc';
|
|
309
|
+
}
|
|
310
|
+
function dirnameOfPackage(packageJsonPath, projectRoot = process.cwd()) {
|
|
311
|
+
return _path.default.dirname(require.resolve(packageJsonPath, {
|
|
312
|
+
paths: [
|
|
313
|
+
projectRoot
|
|
314
|
+
]
|
|
315
|
+
}));
|
|
316
|
+
}
|
|
317
|
+
function resolveHermesCommand(projectRoot = process.cwd()) {
|
|
318
|
+
const osBin = getHermesOSBin();
|
|
319
|
+
if (!osBin) {
|
|
320
|
+
throw new Error(`Unsupported platform for Hermes: ${_os.default.platform()}`);
|
|
321
|
+
}
|
|
322
|
+
const executableName = getHermesExecutableName();
|
|
323
|
+
const candidates = [];
|
|
324
|
+
try {
|
|
325
|
+
const rnDir = dirnameOfPackage('react-native/package.json', projectRoot);
|
|
326
|
+
candidates.push(_path.default.join(rnDir, 'sdks', 'hermesc', osBin, executableName));
|
|
327
|
+
} catch (unused) {
|
|
328
|
+
// react-native is required for normal RN projects; keep looking so the
|
|
329
|
+
// final error can include all candidates we were able to infer.
|
|
330
|
+
}
|
|
331
|
+
try {
|
|
332
|
+
const hermesCompilerDir = dirnameOfPackage('hermes-compiler/package.json', projectRoot);
|
|
333
|
+
candidates.push(_path.default.join(hermesCompilerDir, 'hermesc', osBin, executableName));
|
|
334
|
+
} catch (unused) {
|
|
335
|
+
// RN 0.85+ uses hermes-compiler, older projects may still use other paths.
|
|
336
|
+
}
|
|
337
|
+
try {
|
|
338
|
+
const hermesEngineDir = dirnameOfPackage('hermes-engine/package.json', projectRoot);
|
|
339
|
+
candidates.push(_path.default.join(hermesEngineDir, osBin, executableName), _path.default.join(hermesEngineDir, 'hermesc', osBin, executableName));
|
|
340
|
+
} catch (unused) {
|
|
341
|
+
// RN 0.70-era projects commonly used hermes-engine; optional for newer RN.
|
|
342
|
+
}
|
|
343
|
+
const hermesCommand = candidates.find((candidate)=>_fsextra.existsSync(candidate));
|
|
344
|
+
if (hermesCommand) {
|
|
345
|
+
return hermesCommand;
|
|
346
|
+
}
|
|
347
|
+
throw new Error(`Cannot find hermesc. Tried:\n${candidates.map((candidate)=>`- ${candidate}`).join('\n')}`);
|
|
348
|
+
}
|
|
304
349
|
async function checkGradleConfig() {
|
|
305
350
|
let enableHermes = false;
|
|
306
351
|
let crunchPngs;
|
|
@@ -326,16 +371,7 @@ async function checkGradleConfig() {
|
|
|
326
371
|
}
|
|
327
372
|
async function compileHermesByteCode(bundleName, outputFolder, sourcemapOutput, shouldCleanSourcemap) {
|
|
328
373
|
console.log((0, _i18n.t)('hermesEnabledCompiling'));
|
|
329
|
-
const
|
|
330
|
-
paths: [
|
|
331
|
-
process.cwd()
|
|
332
|
-
]
|
|
333
|
-
}));
|
|
334
|
-
let hermesPath = _path.default.join(rnDir, `/sdks/hermesc/${getHermesOSBin()}`);
|
|
335
|
-
if (!_fsextra.existsSync(hermesPath)) {
|
|
336
|
-
hermesPath = `node_modules/hermes-engine/${getHermesOSBin()}`;
|
|
337
|
-
}
|
|
338
|
-
const hermesCommand = `${hermesPath}/hermesc`;
|
|
374
|
+
const hermesCommand = resolveHermesCommand();
|
|
339
375
|
const args = [
|
|
340
376
|
'-emit-binary',
|
|
341
377
|
'-out',
|
package/lib/exports.d.ts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
export { getSession, loadSession } from './api';
|
|
2
2
|
export { getPlatform, getSelectedApp } from './app';
|
|
3
3
|
export { diffCommands } from './diff';
|
|
4
|
-
export { moduleManager } from './module-manager';
|
|
5
|
-
export { builtinModules } from './modules';
|
|
6
|
-
export { appModule } from './modules/app-module';
|
|
7
|
-
export { bundleModule } from './modules/bundle-module';
|
|
8
|
-
export { packageModule } from './modules/package-module';
|
|
9
|
-
export { userModule } from './modules/user-module';
|
|
10
|
-
export { versionModule } from './modules/version-module';
|
|
11
4
|
export { CLIProviderImpl } from './provider';
|
|
12
|
-
export type { BundleOptions,
|
|
13
|
-
export { question
|
|
5
|
+
export type { BundleOptions, CLIProvider, CommandContext, CommandResult, Package, Platform, PublishOptions, Session, UploadOptions, Version, } from './types';
|
|
6
|
+
export { question } from './utils';
|
package/lib/exports.js
CHANGED
|
@@ -12,15 +12,6 @@ _export(exports, {
|
|
|
12
12
|
get CLIProviderImpl () {
|
|
13
13
|
return _provider.CLIProviderImpl;
|
|
14
14
|
},
|
|
15
|
-
get appModule () {
|
|
16
|
-
return _appmodule.appModule;
|
|
17
|
-
},
|
|
18
|
-
get builtinModules () {
|
|
19
|
-
return _modules.builtinModules;
|
|
20
|
-
},
|
|
21
|
-
get bundleModule () {
|
|
22
|
-
return _bundlemodule.bundleModule;
|
|
23
|
-
},
|
|
24
15
|
get diffCommands () {
|
|
25
16
|
return _diff.diffCommands;
|
|
26
17
|
},
|
|
@@ -36,34 +27,12 @@ _export(exports, {
|
|
|
36
27
|
get loadSession () {
|
|
37
28
|
return _api.loadSession;
|
|
38
29
|
},
|
|
39
|
-
get moduleManager () {
|
|
40
|
-
return _modulemanager.moduleManager;
|
|
41
|
-
},
|
|
42
|
-
get packageModule () {
|
|
43
|
-
return _packagemodule.packageModule;
|
|
44
|
-
},
|
|
45
30
|
get question () {
|
|
46
31
|
return _utils.question;
|
|
47
|
-
},
|
|
48
|
-
get saveToLocal () {
|
|
49
|
-
return _utils.saveToLocal;
|
|
50
|
-
},
|
|
51
|
-
get userModule () {
|
|
52
|
-
return _usermodule.userModule;
|
|
53
|
-
},
|
|
54
|
-
get versionModule () {
|
|
55
|
-
return _versionmodule.versionModule;
|
|
56
32
|
}
|
|
57
33
|
});
|
|
58
34
|
const _api = require("./api");
|
|
59
35
|
const _app = require("./app");
|
|
60
36
|
const _diff = require("./diff");
|
|
61
|
-
const _modulemanager = require("./module-manager");
|
|
62
|
-
const _modules = require("./modules");
|
|
63
|
-
const _appmodule = require("./modules/app-module");
|
|
64
|
-
const _bundlemodule = require("./modules/bundle-module");
|
|
65
|
-
const _packagemodule = require("./modules/package-module");
|
|
66
|
-
const _usermodule = require("./modules/user-module");
|
|
67
|
-
const _versionmodule = require("./modules/version-module");
|
|
68
37
|
const _provider = require("./provider");
|
|
69
38
|
const _utils = require("./utils");
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { moduleManager } from './module-manager';
|
|
3
|
-
export { CLIProviderImpl } from './provider';
|
|
4
|
-
export type { CLIModule, CLIProvider, CommandDefinition, CustomWorkflow, WorkflowStep, } from './types';
|
|
5
|
-
export { moduleManager };
|
|
1
|
+
export * from './exports';
|
package/lib/index.js
CHANGED
|
@@ -1,134 +1,18 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
"use strict";
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
3
|
value: true
|
|
5
4
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
get moduleManager () {
|
|
17
|
-
return _modulemanager.moduleManager;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
const _api = require("./api");
|
|
21
|
-
const _app = require("./app");
|
|
22
|
-
const _bundle = require("./bundle");
|
|
23
|
-
const _diff = require("./diff");
|
|
24
|
-
const _install = require("./install");
|
|
25
|
-
const _modulemanager = require("./module-manager");
|
|
26
|
-
const _modules = require("./modules");
|
|
27
|
-
const _package = require("./package");
|
|
28
|
-
const _user = require("./user");
|
|
29
|
-
const _utils = require("./utils");
|
|
30
|
-
const _i18n = require("./utils/i18n");
|
|
31
|
-
const _versions = require("./versions");
|
|
32
|
-
const _provider = require("./provider");
|
|
33
|
-
function registerBuiltinModules() {
|
|
34
|
-
for (const module of _modules.builtinModules){
|
|
35
|
-
try {
|
|
36
|
-
_modulemanager.moduleManager.registerModule(module);
|
|
37
|
-
} catch (error) {
|
|
38
|
-
console.error(`Failed to register module ${module.name}:`, error);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function printUsage() {
|
|
43
|
-
console.log('React Native Update CLI');
|
|
44
|
-
console.log('');
|
|
45
|
-
console.log('Traditional commands:');
|
|
46
|
-
for (const name of Object.keys(legacyCommands)){
|
|
47
|
-
console.log(` ${name}: Legacy command`);
|
|
48
|
-
}
|
|
49
|
-
console.log('');
|
|
50
|
-
console.log('Modular commands:');
|
|
51
|
-
const commands = _modulemanager.moduleManager.listCommands();
|
|
52
|
-
for (const command of commands){
|
|
53
|
-
console.log(` ${command.name}: ${command.description || 'No description'}`);
|
|
54
|
-
}
|
|
55
|
-
console.log('');
|
|
56
|
-
console.log('Available workflows:');
|
|
57
|
-
const workflows = _modulemanager.moduleManager.listWorkflows();
|
|
58
|
-
for (const workflow of workflows){
|
|
59
|
-
console.log(` ${workflow.name}: ${workflow.description || 'No description'}`);
|
|
60
|
-
}
|
|
61
|
-
console.log('');
|
|
62
|
-
console.log('Special commands:');
|
|
63
|
-
console.log(' list: List all available commands and workflows');
|
|
64
|
-
console.log(' workflow <name>: Execute a specific workflow');
|
|
65
|
-
console.log(' help: Show this help message');
|
|
66
|
-
console.log('');
|
|
67
|
-
console.log('Visit `https://github.com/reactnativecn/react-native-update` for document.');
|
|
68
|
-
process.exit(1);
|
|
69
|
-
}
|
|
70
|
-
const legacyCommands = {
|
|
71
|
-
..._user.userCommands,
|
|
72
|
-
..._bundle.bundleCommands,
|
|
73
|
-
..._diff.diffCommands,
|
|
74
|
-
..._app.appCommands,
|
|
75
|
-
..._package.packageCommands,
|
|
76
|
-
..._versions.versionCommands,
|
|
77
|
-
..._install.installCommands,
|
|
78
|
-
help: printUsage
|
|
79
|
-
};
|
|
80
|
-
async function run() {
|
|
81
|
-
await (0, _utils.printVersionCommand)();
|
|
82
|
-
if (process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version') {
|
|
83
|
-
process.exit();
|
|
84
|
-
}
|
|
85
|
-
// Register builtin modules for modular functionality
|
|
86
|
-
registerBuiltinModules();
|
|
87
|
-
const argv = require('cli-arguments').parse(require('../cli.json'));
|
|
88
|
-
global.NO_INTERACTIVE = argv.options['no-interactive'];
|
|
89
|
-
global.USE_ACC_OSS = argv.options.acc;
|
|
90
|
-
const context = {
|
|
91
|
-
args: argv.args || [],
|
|
92
|
-
options: argv.options || {}
|
|
93
|
-
};
|
|
94
|
-
try {
|
|
95
|
-
await (0, _api.loadSession)();
|
|
96
|
-
context.session = require('./api').getSession();
|
|
97
|
-
// Handle special modular commands first
|
|
98
|
-
if (argv.command === 'help') {
|
|
99
|
-
printUsage();
|
|
100
|
-
} else if (argv.command === 'list') {
|
|
101
|
-
_modulemanager.moduleManager.listAll();
|
|
102
|
-
} else if (argv.command === 'workflow') {
|
|
103
|
-
const workflowName = argv.args[0];
|
|
104
|
-
if (!workflowName) {
|
|
105
|
-
console.error('Workflow name is required');
|
|
106
|
-
process.exit(1);
|
|
107
|
-
}
|
|
108
|
-
const result = await _modulemanager.moduleManager.executeWorkflow(workflowName, context);
|
|
109
|
-
if (!result.success) {
|
|
110
|
-
console.error('Workflow execution failed:', result.error);
|
|
111
|
-
process.exit(1);
|
|
112
|
-
}
|
|
113
|
-
console.log('Workflow completed successfully:', result.data);
|
|
114
|
-
} else if (legacyCommands[argv.command]) {
|
|
115
|
-
const legacyHandler = legacyCommands[argv.command];
|
|
116
|
-
await legacyHandler(argv);
|
|
117
|
-
} else {
|
|
118
|
-
const result = await _modulemanager.moduleManager.executeCommand(argv.command, context);
|
|
119
|
-
if (!result.success) {
|
|
120
|
-
console.error('Command execution failed:', result.error);
|
|
121
|
-
process.exit(1);
|
|
122
|
-
}
|
|
123
|
-
console.log('Command completed successfully:', result.data);
|
|
5
|
+
_export_star(require("./exports"), exports);
|
|
6
|
+
function _export_star(from, to) {
|
|
7
|
+
Object.keys(from).forEach(function(k) {
|
|
8
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
+
Object.defineProperty(to, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return from[k];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
124
15
|
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
console.log((0, _i18n.t)('loginFirst'));
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
console.error(err.stack);
|
|
131
|
-
process.exit(-1);
|
|
132
|
-
}
|
|
16
|
+
});
|
|
17
|
+
return from;
|
|
133
18
|
}
|
|
134
|
-
run();
|
package/lib/locales/en.d.ts
CHANGED
package/lib/locales/en.js
CHANGED
|
@@ -82,6 +82,7 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
82
82
|
operationSuccess: 'Operation successful',
|
|
83
83
|
packageIdRequired: 'Please provide packageId or packageVersion parameter',
|
|
84
84
|
packageUploadSuccess: 'Successfully uploaded new hot update package (id: {{id}})',
|
|
85
|
+
depsChangeWarningTitle: 'Dependency changes detected',
|
|
85
86
|
depsChangeSummary: 'Dependency changes: added {{added}}, removed {{removed}}, changed {{changed}}.',
|
|
86
87
|
depsChangeTargetPackage: 'Target native package: {{packageName}} (id: {{packageId}})',
|
|
87
88
|
depsChangeDependencyHeader: 'Dependency',
|
package/lib/locales/zh.d.ts
CHANGED
package/lib/locales/zh.js
CHANGED
|
@@ -82,6 +82,7 @@ const _default = {
|
|
|
82
82
|
operationSuccess: '操作成功',
|
|
83
83
|
packageIdRequired: '请提供 packageId 或 packageVersion 参数',
|
|
84
84
|
packageUploadSuccess: '已成功上传新热更包(id: {{id}})',
|
|
85
|
+
depsChangeWarningTitle: '检测到依赖变化',
|
|
85
86
|
depsChangeSummary: '依赖变化:新增 {{added}} 项,移除 {{removed}} 项,版本变更 {{changed}} 项。',
|
|
86
87
|
depsChangeTargetPackage: '目标原生包:{{packageName}} (id: {{packageId}})',
|
|
87
88
|
depsChangeDependencyHeader: '依赖',
|
package/lib/package.d.ts
CHANGED
package/lib/package.js
CHANGED
|
@@ -22,7 +22,7 @@ _export(exports, {
|
|
|
22
22
|
return packageCommands;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
const _fsextra = /*#__PURE__*/
|
|
25
|
+
const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
|
|
26
26
|
const _os = /*#__PURE__*/ _interop_require_default(require("os"));
|
|
27
27
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
28
28
|
const _ttytable = /*#__PURE__*/ _interop_require_default(require("tty-table"));
|
|
@@ -38,11 +38,52 @@ function _interop_require_default(obj) {
|
|
|
38
38
|
default: obj
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
42
|
+
if (typeof WeakMap !== "function") return null;
|
|
43
|
+
var cacheBabelInterop = new WeakMap();
|
|
44
|
+
var cacheNodeInterop = new WeakMap();
|
|
45
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
46
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
47
|
+
})(nodeInterop);
|
|
48
|
+
}
|
|
49
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
50
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
51
|
+
return obj;
|
|
52
|
+
}
|
|
53
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
54
|
+
return {
|
|
55
|
+
default: obj
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
59
|
+
if (cache && cache.has(obj)) {
|
|
60
|
+
return cache.get(obj);
|
|
61
|
+
}
|
|
62
|
+
var newObj = {
|
|
63
|
+
__proto__: null
|
|
64
|
+
};
|
|
65
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
66
|
+
for(var key in obj){
|
|
67
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
68
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
69
|
+
if (desc && (desc.get || desc.set)) {
|
|
70
|
+
Object.defineProperty(newObj, key, desc);
|
|
71
|
+
} else {
|
|
72
|
+
newObj[key] = obj[key];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
newObj.default = obj;
|
|
77
|
+
if (cache) {
|
|
78
|
+
cache.set(obj, newObj);
|
|
79
|
+
}
|
|
80
|
+
return newObj;
|
|
81
|
+
}
|
|
41
82
|
function normalizeUploadBuildTime(value) {
|
|
42
83
|
return String(value);
|
|
43
84
|
}
|
|
44
85
|
function ensureFileByExt(filePath, extension, usageKey) {
|
|
45
|
-
if (!filePath
|
|
86
|
+
if (!(filePath == null ? void 0 : filePath.endsWith(extension))) {
|
|
46
87
|
throw new Error((0, _i18n.t)(usageKey));
|
|
47
88
|
}
|
|
48
89
|
return filePath;
|
|
@@ -101,7 +142,6 @@ async function uploadNativePackage(filePath, options, config) {
|
|
|
101
142
|
deps: _depversions.depVersions,
|
|
102
143
|
commit: await (0, _git.getCommitInfo)()
|
|
103
144
|
});
|
|
104
|
-
(0, _utils.saveToLocal)(filePath, `${appId}/package/${id}${config.extension}`);
|
|
105
145
|
console.log((0, _i18n.t)(config.successKey, {
|
|
106
146
|
id,
|
|
107
147
|
version: versionName,
|
|
@@ -204,8 +244,8 @@ const packageCommands = {
|
|
|
204
244
|
options
|
|
205
245
|
});
|
|
206
246
|
} finally{
|
|
207
|
-
if (await _fsextra.
|
|
208
|
-
await _fsextra.
|
|
247
|
+
if (await _fsextra.pathExists(output)) {
|
|
248
|
+
await _fsextra.remove(output);
|
|
209
249
|
}
|
|
210
250
|
}
|
|
211
251
|
},
|
|
@@ -223,28 +263,28 @@ const packageCommands = {
|
|
|
223
263
|
},
|
|
224
264
|
parseApp: async ({ args })=>{
|
|
225
265
|
const fn = args[0];
|
|
226
|
-
if (!fn
|
|
266
|
+
if (!(fn == null ? void 0 : fn.endsWith('.app'))) {
|
|
227
267
|
throw new Error((0, _i18n.t)('usageParseApp'));
|
|
228
268
|
}
|
|
229
269
|
console.log(await (0, _utils.getAppInfo)(fn));
|
|
230
270
|
},
|
|
231
271
|
parseIpa: async ({ args })=>{
|
|
232
272
|
const fn = args[0];
|
|
233
|
-
if (!fn
|
|
273
|
+
if (!(fn == null ? void 0 : fn.endsWith('.ipa'))) {
|
|
234
274
|
throw new Error((0, _i18n.t)('usageParseIpa'));
|
|
235
275
|
}
|
|
236
276
|
console.log(await (0, _utils.getIpaInfo)(fn));
|
|
237
277
|
},
|
|
238
278
|
parseApk: async ({ args })=>{
|
|
239
279
|
const fn = args[0];
|
|
240
|
-
if (!fn
|
|
280
|
+
if (!(fn == null ? void 0 : fn.endsWith('.apk'))) {
|
|
241
281
|
throw new Error((0, _i18n.t)('usageParseApk'));
|
|
242
282
|
}
|
|
243
283
|
console.log(await (0, _utils.getApkInfo)(fn));
|
|
244
284
|
},
|
|
245
285
|
parseAab: async ({ args })=>{
|
|
246
286
|
const fn = args[0];
|
|
247
|
-
if (!fn
|
|
287
|
+
if (!(fn == null ? void 0 : fn.endsWith('.aab'))) {
|
|
248
288
|
throw new Error((0, _i18n.t)('usageParseAab'));
|
|
249
289
|
}
|
|
250
290
|
console.log(await (0, _utils.getAabInfo)(fn));
|
|
@@ -268,7 +308,7 @@ const packageCommands = {
|
|
|
268
308
|
const { appId } = await (0, _app.getSelectedApp)(platform);
|
|
269
309
|
await listPackage(String(appId));
|
|
270
310
|
},
|
|
271
|
-
deletePackage: async ({
|
|
311
|
+
deletePackage: async ({ options })=>{
|
|
272
312
|
let { appId, packageId, packageVersion } = options;
|
|
273
313
|
if (!appId) {
|
|
274
314
|
const platform = await (0, _app.getPlatform)(options.platform);
|