react-native-update-cli 2.10.2 → 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/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 -4
- package/lib/index.js +12 -80
- package/lib/package.js +44 -4
- package/lib/provider.js +4 -4
- package/lib/types.d.ts +0 -17
- package/lib/utils/app-info-parser/aab.js +45 -4
- 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.js +0 -2
- package/package.json +8 -10
- package/src/app.ts +40 -40
- package/src/bin.ts +86 -0
- package/src/bundle-runner.ts +70 -12
- package/src/exports.ts +1 -10
- package/src/index.ts +1 -94
- package/src/package.ts +1 -3
- package/src/provider.ts +6 -4
- package/src/types.ts +0 -22
- package/src/utils/app-info-parser/aab.ts +1 -1
- package/src/utils/index.ts +1 -12
- package/src/utils/plugin-config.ts +1 -1
- package/src/versions.ts +1 -3
- package/lib/module-manager.d.ts +0 -16
- package/lib/module-manager.js +0 -90
- package/lib/modules/app-module.d.ts +0 -2
- package/lib/modules/app-module.js +0 -15
- package/lib/modules/bundle-module.d.ts +0 -2
- package/lib/modules/bundle-module.js +0 -15
- 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 -15
- package/lib/modules/user-module.d.ts +0 -2
- package/lib/modules/user-module.js +0 -15
- package/lib/modules/version-module.d.ts +0 -2
- package/lib/modules/version-module.js +0 -15
- package/src/module-manager.ts +0 -105
- package/src/modules/app-module.ts +0 -7
- package/src/modules/bundle-module.ts +0 -7
- package/src/modules/index.ts +0 -19
- package/src/modules/package-module.ts +0 -7
- package/src/modules/user-module.ts +0 -7
- package/src/modules/version-module.ts +0 -7
package/lib/app.d.ts
CHANGED
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
package/lib/index.js
CHANGED
|
@@ -1,86 +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 _package = require("./package");
|
|
26
|
-
const _user = require("./user");
|
|
27
|
-
const _utils = require("./utils");
|
|
28
|
-
const _i18n = require("./utils/i18n");
|
|
29
|
-
const _versions = require("./versions");
|
|
30
|
-
const _modulemanager = require("./module-manager");
|
|
31
|
-
const _provider = require("./provider");
|
|
32
|
-
function printUsage(exitCode = 1) {
|
|
33
|
-
console.log('React Native Update CLI');
|
|
34
|
-
console.log('');
|
|
35
|
-
console.log('Commands:');
|
|
36
|
-
for (const name of Object.keys(commandHandlers)){
|
|
37
|
-
console.log(` ${name}`);
|
|
38
|
-
}
|
|
39
|
-
console.log('');
|
|
40
|
-
console.log('Special commands:');
|
|
41
|
-
console.log(' list: List all available commands');
|
|
42
|
-
console.log(' help: Show this help message');
|
|
43
|
-
console.log('');
|
|
44
|
-
console.log('Visit `https://github.com/reactnativecn/react-native-update` for document.');
|
|
45
|
-
process.exit(exitCode);
|
|
46
|
-
}
|
|
47
|
-
const commandHandlers = {
|
|
48
|
-
..._user.userCommands,
|
|
49
|
-
..._bundle.bundleCommands,
|
|
50
|
-
..._diff.diffCommands,
|
|
51
|
-
..._app.appCommands,
|
|
52
|
-
..._package.packageCommands,
|
|
53
|
-
..._versions.versionCommands,
|
|
54
|
-
..._install.installCommands,
|
|
55
|
-
help: printUsage
|
|
56
|
-
};
|
|
57
|
-
async function run() {
|
|
58
|
-
await (0, _utils.printVersionCommand)();
|
|
59
|
-
if (process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version') {
|
|
60
|
-
process.exit();
|
|
61
|
-
}
|
|
62
|
-
const argv = require('cli-arguments').parse(require('../cli.json'));
|
|
63
|
-
global.NO_INTERACTIVE = argv.options['no-interactive'];
|
|
64
|
-
global.USE_ACC_OSS = argv.options.acc;
|
|
65
|
-
try {
|
|
66
|
-
await (0, _api.loadSession)();
|
|
67
|
-
if (argv.command === 'help') {
|
|
68
|
-
printUsage(0);
|
|
69
|
-
} else if (argv.command === 'list') {
|
|
70
|
-
printUsage(0);
|
|
71
|
-
} else if (commandHandlers[argv.command]) {
|
|
72
|
-
const handler = commandHandlers[argv.command];
|
|
73
|
-
await handler(argv);
|
|
74
|
-
} else {
|
|
75
|
-
throw new Error(`Unknown command: ${argv.command}`);
|
|
76
|
-
}
|
|
77
|
-
} catch (err) {
|
|
78
|
-
if (err.status === 401) {
|
|
79
|
-
console.log((0, _i18n.t)('loginFirst'));
|
|
80
|
-
return;
|
|
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
|
+
});
|
|
81
15
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
16
|
+
});
|
|
17
|
+
return from;
|
|
85
18
|
}
|
|
86
|
-
run();
|
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,6 +38,47 @@ 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
|
}
|
|
@@ -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
|
},
|
package/lib/provider.js
CHANGED
|
@@ -163,8 +163,8 @@ class CLIProviderImpl {
|
|
|
163
163
|
async listApps(platform) {
|
|
164
164
|
return this.runMessageCommand(async ()=>{
|
|
165
165
|
const resolvedPlatform = await this.getPlatform(platform);
|
|
166
|
-
const {
|
|
167
|
-
await
|
|
166
|
+
const { getAppCommands } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./app")));
|
|
167
|
+
await getAppCommands().apps({
|
|
168
168
|
options: {
|
|
169
169
|
platform: resolvedPlatform
|
|
170
170
|
}
|
|
@@ -173,8 +173,8 @@ class CLIProviderImpl {
|
|
|
173
173
|
}
|
|
174
174
|
async createApp(name, platform) {
|
|
175
175
|
return this.runMessageCommand(async ()=>{
|
|
176
|
-
const {
|
|
177
|
-
await
|
|
176
|
+
const { getAppCommands } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./app")));
|
|
177
|
+
await getAppCommands().createApp({
|
|
178
178
|
options: {
|
|
179
179
|
name,
|
|
180
180
|
platform,
|
package/lib/types.d.ts
CHANGED
|
@@ -36,16 +36,6 @@ export interface CommandResult {
|
|
|
36
36
|
data?: unknown;
|
|
37
37
|
error?: string;
|
|
38
38
|
}
|
|
39
|
-
export interface CommandDefinition {
|
|
40
|
-
name: string;
|
|
41
|
-
description?: string;
|
|
42
|
-
handler: (context: CommandContext) => Promise<CommandResult>;
|
|
43
|
-
options?: Record<string, {
|
|
44
|
-
hasValue?: boolean;
|
|
45
|
-
default?: unknown;
|
|
46
|
-
description?: string;
|
|
47
|
-
}>;
|
|
48
|
-
}
|
|
49
39
|
export interface BundleOptions {
|
|
50
40
|
dev?: boolean;
|
|
51
41
|
platform?: Platform;
|
|
@@ -91,10 +81,3 @@ export interface CLIProvider {
|
|
|
91
81
|
getPlatform: (platform?: Platform) => Promise<Platform>;
|
|
92
82
|
loadSession: () => Promise<Session>;
|
|
93
83
|
}
|
|
94
|
-
export interface CLIModule {
|
|
95
|
-
name: string;
|
|
96
|
-
version: string;
|
|
97
|
-
commands?: CommandDefinition[];
|
|
98
|
-
init?: (provider: CLIProvider) => void;
|
|
99
|
-
cleanup?: () => void;
|
|
100
|
-
}
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "AabParser", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _child_process = require("child_process");
|
|
12
|
-
const _fsextra = /*#__PURE__*/
|
|
12
|
+
const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
|
|
13
13
|
const _os = /*#__PURE__*/ _interop_require_default(require("os"));
|
|
14
14
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
15
15
|
const _yauzl = require("yauzl");
|
|
@@ -23,6 +23,47 @@ function _interop_require_default(obj) {
|
|
|
23
23
|
default: obj
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
27
|
+
if (typeof WeakMap !== "function") return null;
|
|
28
|
+
var cacheBabelInterop = new WeakMap();
|
|
29
|
+
var cacheNodeInterop = new WeakMap();
|
|
30
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
31
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
32
|
+
})(nodeInterop);
|
|
33
|
+
}
|
|
34
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
35
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
36
|
+
return obj;
|
|
37
|
+
}
|
|
38
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
39
|
+
return {
|
|
40
|
+
default: obj
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
44
|
+
if (cache && cache.has(obj)) {
|
|
45
|
+
return cache.get(obj);
|
|
46
|
+
}
|
|
47
|
+
var newObj = {
|
|
48
|
+
__proto__: null
|
|
49
|
+
};
|
|
50
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
51
|
+
for(var key in obj){
|
|
52
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
53
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
54
|
+
if (desc && (desc.get || desc.set)) {
|
|
55
|
+
Object.defineProperty(newObj, key, desc);
|
|
56
|
+
} else {
|
|
57
|
+
newObj[key] = obj[key];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
newObj.default = obj;
|
|
62
|
+
if (cache) {
|
|
63
|
+
cache.set(obj, newObj);
|
|
64
|
+
}
|
|
65
|
+
return newObj;
|
|
66
|
+
}
|
|
26
67
|
class AabParser extends _zip.Zip {
|
|
27
68
|
async extractApk(outputPath, { includeAllSplits, splits }) {
|
|
28
69
|
const normalizedSplits = Array.isArray(splits) ? splits.map((item)=>item.trim()).filter(Boolean) : [];
|
|
@@ -130,7 +171,7 @@ class AabParser extends _zip.Zip {
|
|
|
130
171
|
reject(err || new Error((0, _i18n.t)('aabReadUniversalApkFailed')));
|
|
131
172
|
return;
|
|
132
173
|
}
|
|
133
|
-
const writeStream = _fsextra.
|
|
174
|
+
const writeStream = _fsextra.createWriteStream(outputPath);
|
|
134
175
|
readStream.pipe(writeStream);
|
|
135
176
|
writeStream.on('close', ()=>{
|
|
136
177
|
zipfile.close();
|
|
@@ -150,8 +191,8 @@ class AabParser extends _zip.Zip {
|
|
|
150
191
|
});
|
|
151
192
|
} finally{
|
|
152
193
|
// Cleanup
|
|
153
|
-
if (await _fsextra.
|
|
154
|
-
await _fsextra.
|
|
194
|
+
if (await _fsextra.pathExists(tempApksPath)) {
|
|
195
|
+
await _fsextra.remove(tempApksPath);
|
|
155
196
|
}
|
|
156
197
|
}
|
|
157
198
|
}
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -17,6 +17,5 @@ export declare function getAabInfo(fn: string): Promise<{
|
|
|
17
17
|
versionName: string;
|
|
18
18
|
buildTime: number;
|
|
19
19
|
}>;
|
|
20
|
-
export declare function saveToLocal(_originPath: string, _destName: string): void;
|
|
21
20
|
export declare function printVersionCommand(): Promise<void>;
|
|
22
21
|
export { checkPlugins };
|