-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathcommand.ts
More file actions
83 lines (79 loc) · 1.89 KB
/
command.ts
File metadata and controls
83 lines (79 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import type { PluginApi } from '@rnef/config';
import { signAndroid } from './signAndroid.js';
export type SignFlags = {
verbose?: boolean;
apk: string;
output?: string;
keystore?: string;
keystorePassword?: string;
keyAlias?: string;
keyPassword?: string;
buildJsbundle?: boolean;
jsbundle?: string;
noHermes?: boolean;
};
const ARGUMENTS = [
{
name: 'apk',
description: 'APK file path',
},
];
const OPTIONS = [
{
name: '--verbose',
description: '',
},
{
name: '--keystore <string>',
description: 'Path to keystore file',
},
{
name: '--keystore-password <string>',
description: 'Password for keystore file',
},
{
name: '--key-alias <string>',
description: 'Alias for key in keystore file',
},
{
name: '--key-password <string>',
description: 'Password for key in keystore file',
},
{
name: '--output <string>',
description: 'Path to the output APK file.',
},
{
name: '--build-jsbundle',
description: 'Build the JS bundle before signing.',
},
{
name: '--jsbundle <string>',
description: 'Path to the JS bundle to apply before signing.',
},
{
name: '--no-hermes',
description: 'Do not use Hermes to build the JS bundle.',
},
];
export const registerSignCommand = (api: PluginApi, commandName: string) => {
api.registerCommand({
name: commandName,
description: 'Sign the Android app with modified JS bundle.',
args: ARGUMENTS,
options: OPTIONS,
action: async (apkPath, flags: SignFlags) => {
await signAndroid({
apkPath,
keystorePath: flags.keystore,
keystorePassword: flags.keystorePassword,
keyAlias: flags.keyAlias,
keyPassword: flags.keyPassword,
outputPath: flags.output,
buildJsBundle: flags.buildJsbundle,
jsBundlePath: flags.jsbundle,
useHermes: !flags.noHermes,
});
},
});
};