react-native-update-cli 1.46.2 → 2.0.1
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 +603 -1
- package/README.zh-CN.md +601 -0
- package/cli.json +39 -3
- package/lib/api.js +5 -5
- package/lib/app.js +1 -1
- package/lib/bundle.js +30 -28
- package/lib/exports.js +65 -0
- package/lib/index.js +100 -9
- package/lib/locales/en.js +2 -1
- package/lib/locales/zh.js +2 -1
- package/lib/module-manager.js +125 -0
- package/lib/modules/app-module.js +223 -0
- package/lib/modules/bundle-module.js +188 -0
- package/lib/modules/index.js +42 -0
- package/lib/modules/package-module.js +16 -0
- package/lib/modules/user-module.js +402 -0
- package/lib/modules/version-module.js +16 -0
- package/lib/package.js +40 -9
- package/lib/provider.js +341 -0
- package/lib/user.js +3 -3
- package/lib/utils/app-info-parser/apk.js +1 -1
- package/lib/utils/app-info-parser/ipa.js +2 -2
- package/lib/utils/app-info-parser/resource-finder.js +35 -35
- package/lib/utils/app-info-parser/xml-parser/manifest.js +2 -2
- package/lib/utils/app-info-parser/zip.js +3 -6
- package/lib/utils/check-plugin.js +1 -1
- package/lib/utils/git.js +1 -1
- package/lib/utils/i18n.js +3 -1
- package/lib/utils/index.js +4 -4
- package/lib/utils/latest-version/cli.js +3 -3
- package/lib/utils/latest-version/index.js +4 -4
- package/lib/versions.js +2 -2
- package/package.json +4 -4
- package/src/api.ts +7 -7
- package/src/app.ts +2 -2
- package/src/bundle.ts +44 -32
- package/src/exports.ts +30 -0
- package/src/index.ts +118 -16
- package/src/locales/en.ts +1 -0
- package/src/locales/zh.ts +1 -0
- package/src/module-manager.ts +149 -0
- package/src/modules/app-module.ts +205 -0
- package/src/modules/bundle-module.ts +202 -0
- package/src/modules/index.ts +19 -0
- package/src/modules/package-module.ts +11 -0
- package/src/modules/user-module.ts +406 -0
- package/src/modules/version-module.ts +8 -0
- package/src/package.ts +59 -25
- package/src/provider.ts +341 -0
- package/src/types.ts +126 -0
- package/src/user.ts +4 -3
- package/src/utils/app-info-parser/apk.js +62 -52
- package/src/utils/app-info-parser/app.js +5 -5
- package/src/utils/app-info-parser/ipa.js +69 -57
- package/src/utils/app-info-parser/resource-finder.js +50 -54
- package/src/utils/app-info-parser/utils.js +59 -54
- package/src/utils/app-info-parser/xml-parser/binary.js +366 -354
- package/src/utils/app-info-parser/xml-parser/manifest.js +145 -137
- package/src/utils/app-info-parser/zip.js +1 -1
- package/src/utils/check-plugin.ts +4 -2
- package/src/utils/dep-versions.ts +13 -6
- package/src/utils/git.ts +1 -1
- package/src/utils/i18n.ts +3 -1
- package/src/utils/index.ts +8 -10
- package/src/utils/latest-version/cli.ts +4 -4
- package/src/utils/latest-version/index.ts +17 -17
- package/src/utils/plugin-config.ts +3 -3
- package/src/versions.ts +3 -3
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import { getSession, loadSession } from '../api';
|
|
2
|
+
import type { CLIModule, CommandContext } from '../types';
|
|
3
|
+
import { userCommands } from '../user';
|
|
4
|
+
|
|
5
|
+
export const userModule: CLIModule = {
|
|
6
|
+
name: 'user',
|
|
7
|
+
version: '1.0.0',
|
|
8
|
+
|
|
9
|
+
commands: [],
|
|
10
|
+
|
|
11
|
+
workflows: [
|
|
12
|
+
{
|
|
13
|
+
name: 'auth-check',
|
|
14
|
+
description: 'Check authentication status and user information',
|
|
15
|
+
options: {
|
|
16
|
+
autoLogin: {
|
|
17
|
+
default: false,
|
|
18
|
+
description: 'Automatically login if not authenticated',
|
|
19
|
+
},
|
|
20
|
+
showDetails: {
|
|
21
|
+
default: true,
|
|
22
|
+
description: 'Show detailed user information',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
steps: [
|
|
26
|
+
{
|
|
27
|
+
name: 'load-session',
|
|
28
|
+
description: 'Load existing session from local storage',
|
|
29
|
+
execute: async (context: CommandContext) => {
|
|
30
|
+
console.log('Loading session from local storage...');
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
await loadSession();
|
|
34
|
+
const session = getSession();
|
|
35
|
+
|
|
36
|
+
if (session && session.token) {
|
|
37
|
+
console.log('✓ Session found in local storage');
|
|
38
|
+
return {
|
|
39
|
+
sessionLoaded: true,
|
|
40
|
+
hasToken: true,
|
|
41
|
+
session,
|
|
42
|
+
};
|
|
43
|
+
} else {
|
|
44
|
+
console.log('✗ No valid session found in local storage');
|
|
45
|
+
return {
|
|
46
|
+
sessionLoaded: true,
|
|
47
|
+
hasToken: false,
|
|
48
|
+
session: null,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.log(
|
|
53
|
+
'✗ Failed to load session:',
|
|
54
|
+
error instanceof Error ? error.message : 'Unknown error',
|
|
55
|
+
);
|
|
56
|
+
return {
|
|
57
|
+
sessionLoaded: false,
|
|
58
|
+
hasToken: false,
|
|
59
|
+
session: null,
|
|
60
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'validate-session',
|
|
67
|
+
description: 'Validate session by calling API',
|
|
68
|
+
execute: async (context: CommandContext, previousResult: any) => {
|
|
69
|
+
if (!previousResult.hasToken) {
|
|
70
|
+
console.log('No token available, skipping validation');
|
|
71
|
+
return {
|
|
72
|
+
...previousResult,
|
|
73
|
+
validated: false,
|
|
74
|
+
reason: 'No token available',
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
console.log('Validating session with server...');
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
await userCommands.me();
|
|
82
|
+
console.log('✓ Session is valid');
|
|
83
|
+
return {
|
|
84
|
+
...previousResult,
|
|
85
|
+
validated: true,
|
|
86
|
+
reason: 'Session validated successfully',
|
|
87
|
+
};
|
|
88
|
+
} catch (error) {
|
|
89
|
+
console.log(
|
|
90
|
+
'✗ Session validation failed:',
|
|
91
|
+
error instanceof Error ? error.message : 'Unknown error',
|
|
92
|
+
);
|
|
93
|
+
return {
|
|
94
|
+
...previousResult,
|
|
95
|
+
validated: false,
|
|
96
|
+
reason:
|
|
97
|
+
error instanceof Error ? error.message : 'Unknown error',
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'get-user-info',
|
|
104
|
+
description: 'Get current user information',
|
|
105
|
+
execute: async (context: CommandContext, previousResult: any) => {
|
|
106
|
+
if (!previousResult.validated) {
|
|
107
|
+
console.log('Session not valid, cannot get user info');
|
|
108
|
+
return {
|
|
109
|
+
...previousResult,
|
|
110
|
+
userInfo: null,
|
|
111
|
+
reason: 'Session not valid',
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
console.log('Getting user information...');
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
const { get } = await import('../api');
|
|
119
|
+
const userInfo = await get('/user/me');
|
|
120
|
+
|
|
121
|
+
console.log('✓ User information retrieved successfully');
|
|
122
|
+
|
|
123
|
+
if (context.options.showDetails !== false) {
|
|
124
|
+
console.log('\n=== User Information ===');
|
|
125
|
+
for (const [key, value] of Object.entries(userInfo)) {
|
|
126
|
+
if (key !== 'ok') {
|
|
127
|
+
console.log(`${key}: ${value}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
console.log('========================\n');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return {
|
|
134
|
+
...previousResult,
|
|
135
|
+
userInfo,
|
|
136
|
+
reason: 'User info retrieved successfully',
|
|
137
|
+
};
|
|
138
|
+
} catch (error) {
|
|
139
|
+
console.log(
|
|
140
|
+
'✗ Failed to get user info:',
|
|
141
|
+
error instanceof Error ? error.message : 'Unknown error',
|
|
142
|
+
);
|
|
143
|
+
return {
|
|
144
|
+
...previousResult,
|
|
145
|
+
userInfo: null,
|
|
146
|
+
reason:
|
|
147
|
+
error instanceof Error ? error.message : 'Unknown error',
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: 'handle-auth-failure',
|
|
154
|
+
description: 'Handle authentication failure',
|
|
155
|
+
execute: async (context: CommandContext, previousResult: any) => {
|
|
156
|
+
if (previousResult.validated) {
|
|
157
|
+
console.log('✓ Authentication check completed successfully');
|
|
158
|
+
return {
|
|
159
|
+
...previousResult,
|
|
160
|
+
authCheckComplete: true,
|
|
161
|
+
status: 'authenticated',
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
console.log('✗ Authentication check failed');
|
|
166
|
+
|
|
167
|
+
if (context.options.autoLogin) {
|
|
168
|
+
console.log('Attempting automatic login...');
|
|
169
|
+
try {
|
|
170
|
+
await userCommands.login({ args: [] });
|
|
171
|
+
console.log('✓ Automatic login successful');
|
|
172
|
+
return {
|
|
173
|
+
...previousResult,
|
|
174
|
+
authCheckComplete: true,
|
|
175
|
+
status: 'auto-logged-in',
|
|
176
|
+
autoLoginSuccess: true,
|
|
177
|
+
};
|
|
178
|
+
} catch (error) {
|
|
179
|
+
console.log(
|
|
180
|
+
'✗ Automatic login failed:',
|
|
181
|
+
error instanceof Error ? error.message : 'Unknown error',
|
|
182
|
+
);
|
|
183
|
+
return {
|
|
184
|
+
...previousResult,
|
|
185
|
+
authCheckComplete: true,
|
|
186
|
+
status: 'failed',
|
|
187
|
+
autoLoginSuccess: false,
|
|
188
|
+
autoLoginError:
|
|
189
|
+
error instanceof Error ? error.message : 'Unknown error',
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
} else {
|
|
193
|
+
console.log('Please run login command to authenticate');
|
|
194
|
+
return {
|
|
195
|
+
...previousResult,
|
|
196
|
+
authCheckComplete: true,
|
|
197
|
+
status: 'unauthenticated',
|
|
198
|
+
suggestion: 'Run login command to authenticate',
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: 'login-flow',
|
|
207
|
+
description: 'Complete login flow with validation',
|
|
208
|
+
options: {
|
|
209
|
+
email: { hasValue: true, description: 'User email' },
|
|
210
|
+
password: { hasValue: true, description: 'User password' },
|
|
211
|
+
validateAfterLogin: {
|
|
212
|
+
default: true,
|
|
213
|
+
description: 'Validate session after login',
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
steps: [
|
|
217
|
+
{
|
|
218
|
+
name: 'check-existing-session',
|
|
219
|
+
description: 'Check if user is already logged in',
|
|
220
|
+
execute: async (context: CommandContext) => {
|
|
221
|
+
console.log('Checking existing session...');
|
|
222
|
+
|
|
223
|
+
try {
|
|
224
|
+
await loadSession();
|
|
225
|
+
const session = getSession();
|
|
226
|
+
|
|
227
|
+
if (session && session.token) {
|
|
228
|
+
try {
|
|
229
|
+
await userCommands.me();
|
|
230
|
+
console.log('✓ User is already logged in');
|
|
231
|
+
return {
|
|
232
|
+
alreadyLoggedIn: true,
|
|
233
|
+
session: session,
|
|
234
|
+
status: 'authenticated',
|
|
235
|
+
};
|
|
236
|
+
} catch (error) {
|
|
237
|
+
console.log(
|
|
238
|
+
'✗ Existing session is invalid, proceeding with login',
|
|
239
|
+
);
|
|
240
|
+
return {
|
|
241
|
+
alreadyLoggedIn: false,
|
|
242
|
+
session: null,
|
|
243
|
+
status: 'session-expired',
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
} else {
|
|
247
|
+
console.log('No existing session found');
|
|
248
|
+
return {
|
|
249
|
+
alreadyLoggedIn: false,
|
|
250
|
+
session: null,
|
|
251
|
+
status: 'no-session',
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
} catch (error) {
|
|
255
|
+
console.log(
|
|
256
|
+
'Error checking existing session:',
|
|
257
|
+
error instanceof Error ? error.message : 'Unknown error',
|
|
258
|
+
);
|
|
259
|
+
return {
|
|
260
|
+
alreadyLoggedIn: false,
|
|
261
|
+
session: null,
|
|
262
|
+
status: 'error',
|
|
263
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
name: 'perform-login',
|
|
270
|
+
description: 'Perform user login',
|
|
271
|
+
execute: async (context: CommandContext, previousResult: any) => {
|
|
272
|
+
if (previousResult.alreadyLoggedIn) {
|
|
273
|
+
console.log('Skipping login - user already authenticated');
|
|
274
|
+
return {
|
|
275
|
+
...previousResult,
|
|
276
|
+
loginPerformed: false,
|
|
277
|
+
loginSuccess: true,
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
console.log('Performing login...');
|
|
282
|
+
|
|
283
|
+
try {
|
|
284
|
+
const loginArgs = [];
|
|
285
|
+
if (context.options.email) {
|
|
286
|
+
loginArgs.push(context.options.email);
|
|
287
|
+
}
|
|
288
|
+
if (context.options.password) {
|
|
289
|
+
loginArgs.push(context.options.password);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
await userCommands.login({ args: loginArgs });
|
|
293
|
+
console.log('✓ Login successful');
|
|
294
|
+
|
|
295
|
+
return {
|
|
296
|
+
...previousResult,
|
|
297
|
+
loginPerformed: true,
|
|
298
|
+
loginSuccess: true,
|
|
299
|
+
};
|
|
300
|
+
} catch (error) {
|
|
301
|
+
console.log(
|
|
302
|
+
'✗ Login failed:',
|
|
303
|
+
error instanceof Error ? error.message : 'Unknown error',
|
|
304
|
+
);
|
|
305
|
+
return {
|
|
306
|
+
...previousResult,
|
|
307
|
+
loginPerformed: true,
|
|
308
|
+
loginSuccess: false,
|
|
309
|
+
loginError:
|
|
310
|
+
error instanceof Error ? error.message : 'Unknown error',
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
name: 'validate-login',
|
|
317
|
+
description: 'Validate login by getting user info',
|
|
318
|
+
execute: async (context: CommandContext, previousResult: any) => {
|
|
319
|
+
if (
|
|
320
|
+
!previousResult.loginSuccess &&
|
|
321
|
+
!previousResult.alreadyLoggedIn
|
|
322
|
+
) {
|
|
323
|
+
console.log('Login failed, skipping validation');
|
|
324
|
+
return {
|
|
325
|
+
...previousResult,
|
|
326
|
+
validationPerformed: false,
|
|
327
|
+
validationSuccess: false,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (context.options.validateAfterLogin === false) {
|
|
332
|
+
console.log('Skipping validation as requested');
|
|
333
|
+
return {
|
|
334
|
+
...previousResult,
|
|
335
|
+
validationPerformed: false,
|
|
336
|
+
validationSuccess: true,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
console.log('Validating login by getting user information...');
|
|
341
|
+
|
|
342
|
+
try {
|
|
343
|
+
const userInfo = await userCommands.me();
|
|
344
|
+
console.log('✓ Login validation successful');
|
|
345
|
+
|
|
346
|
+
return {
|
|
347
|
+
...previousResult,
|
|
348
|
+
validationPerformed: true,
|
|
349
|
+
validationSuccess: true,
|
|
350
|
+
userInfo,
|
|
351
|
+
};
|
|
352
|
+
} catch (error) {
|
|
353
|
+
console.log(
|
|
354
|
+
'✗ Login validation failed:',
|
|
355
|
+
error instanceof Error ? error.message : 'Unknown error',
|
|
356
|
+
);
|
|
357
|
+
return {
|
|
358
|
+
...previousResult,
|
|
359
|
+
validationPerformed: true,
|
|
360
|
+
validationSuccess: false,
|
|
361
|
+
validationError:
|
|
362
|
+
error instanceof Error ? error.message : 'Unknown error',
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
name: 'login-summary',
|
|
369
|
+
description: 'Provide login flow summary',
|
|
370
|
+
execute: async (context: CommandContext, previousResult: any) => {
|
|
371
|
+
console.log('\n=== Login Flow Summary ===');
|
|
372
|
+
|
|
373
|
+
if (previousResult.alreadyLoggedIn) {
|
|
374
|
+
console.log('Status: Already logged in');
|
|
375
|
+
console.log('Session: Valid');
|
|
376
|
+
} else if (previousResult.loginSuccess) {
|
|
377
|
+
console.log('Status: Login successful');
|
|
378
|
+
if (previousResult.validationSuccess) {
|
|
379
|
+
console.log('Validation: Passed');
|
|
380
|
+
} else {
|
|
381
|
+
console.log('Validation: Failed');
|
|
382
|
+
}
|
|
383
|
+
} else {
|
|
384
|
+
console.log('Status: Login failed');
|
|
385
|
+
console.log(
|
|
386
|
+
'Error:',
|
|
387
|
+
previousResult.loginError || 'Unknown error',
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
console.log('==========================\n');
|
|
392
|
+
|
|
393
|
+
return {
|
|
394
|
+
...previousResult,
|
|
395
|
+
flowComplete: true,
|
|
396
|
+
finalStatus:
|
|
397
|
+
previousResult.alreadyLoggedIn || previousResult.loginSuccess
|
|
398
|
+
? 'success'
|
|
399
|
+
: 'failed',
|
|
400
|
+
};
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
],
|
|
404
|
+
},
|
|
405
|
+
],
|
|
406
|
+
};
|
package/src/package.ts
CHANGED
|
@@ -4,11 +4,11 @@ import { t } from './utils/i18n';
|
|
|
4
4
|
|
|
5
5
|
import { getPlatform, getSelectedApp } from './app';
|
|
6
6
|
|
|
7
|
-
import { getApkInfo, getIpaInfo, getAppInfo } from './utils';
|
|
8
7
|
import Table from 'tty-table';
|
|
8
|
+
import type { Platform } from './types';
|
|
9
|
+
import { getApkInfo, getAppInfo, getIpaInfo } from './utils';
|
|
9
10
|
import { depVersions } from './utils/dep-versions';
|
|
10
11
|
import { getCommitInfo } from './utils/git';
|
|
11
|
-
import type { Platform } from 'types';
|
|
12
12
|
|
|
13
13
|
export async function listPackage(appId: string) {
|
|
14
14
|
const allPkgs = await getAllPackages(appId);
|
|
@@ -22,7 +22,11 @@ export async function listPackage(appId: string) {
|
|
|
22
22
|
const { version } = pkg;
|
|
23
23
|
let versionInfo = '';
|
|
24
24
|
if (version) {
|
|
25
|
-
|
|
25
|
+
const versionObj = version as any;
|
|
26
|
+
versionInfo = t('boundTo', {
|
|
27
|
+
name: versionObj.name || version,
|
|
28
|
+
id: versionObj.id || version,
|
|
29
|
+
});
|
|
26
30
|
}
|
|
27
31
|
let output = pkg.name;
|
|
28
32
|
if (pkg.status === 'paused') {
|
|
@@ -45,7 +49,7 @@ export async function choosePackage(appId: string) {
|
|
|
45
49
|
|
|
46
50
|
while (true) {
|
|
47
51
|
const id = await question(t('enterNativePackageId'));
|
|
48
|
-
const app = list.find((v) => v.id ===
|
|
52
|
+
const app = list.find((v) => v.id.toString() === id);
|
|
49
53
|
if (app) {
|
|
50
54
|
return app;
|
|
51
55
|
}
|
|
@@ -53,17 +57,21 @@ export async function choosePackage(appId: string) {
|
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
export const packageCommands = {
|
|
56
|
-
uploadIpa: async ({
|
|
60
|
+
uploadIpa: async ({
|
|
61
|
+
args,
|
|
62
|
+
options,
|
|
63
|
+
}: {
|
|
64
|
+
args: string[];
|
|
65
|
+
options: Record<string, any>;
|
|
66
|
+
}) => {
|
|
57
67
|
const fn = args[0];
|
|
58
68
|
if (!fn || !fn.endsWith('.ipa')) {
|
|
59
69
|
throw new Error(t('usageUploadIpa'));
|
|
60
70
|
}
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
appKey: appKeyInPkg,
|
|
66
|
-
} = await getIpaInfo(fn);
|
|
71
|
+
const ipaInfo = await getIpaInfo(fn);
|
|
72
|
+
const { versionName: extractedVersionName, buildTime } = ipaInfo;
|
|
73
|
+
const appIdInPkg = (ipaInfo as any).appId;
|
|
74
|
+
const appKeyInPkg = (ipaInfo as any).appKey;
|
|
67
75
|
const { appId, appKey } = await getSelectedApp('ios');
|
|
68
76
|
|
|
69
77
|
if (appIdInPkg && appIdInPkg != appId) {
|
|
@@ -74,6 +82,12 @@ export const packageCommands = {
|
|
|
74
82
|
throw new Error(t('appKeyMismatchIpa', { appKeyInPkg, appKey }));
|
|
75
83
|
}
|
|
76
84
|
|
|
85
|
+
// Use custom version if provided, otherwise use extracted version
|
|
86
|
+
const versionName = options.version || extractedVersionName;
|
|
87
|
+
if (options.version) {
|
|
88
|
+
console.log(t('usingCustomVersion', { version: versionName }));
|
|
89
|
+
}
|
|
90
|
+
|
|
77
91
|
const { hash } = await uploadFile(fn);
|
|
78
92
|
|
|
79
93
|
const { id } = await post(`/app/${appId}/package/create`, {
|
|
@@ -86,17 +100,21 @@ export const packageCommands = {
|
|
|
86
100
|
saveToLocal(fn, `${appId}/package/${id}.ipa`);
|
|
87
101
|
console.log(t('ipaUploadSuccess', { id, version: versionName, buildTime }));
|
|
88
102
|
},
|
|
89
|
-
uploadApk: async ({
|
|
103
|
+
uploadApk: async ({
|
|
104
|
+
args,
|
|
105
|
+
options,
|
|
106
|
+
}: {
|
|
107
|
+
args: string[];
|
|
108
|
+
options: Record<string, any>;
|
|
109
|
+
}) => {
|
|
90
110
|
const fn = args[0];
|
|
91
111
|
if (!fn || !fn.endsWith('.apk')) {
|
|
92
112
|
throw new Error(t('usageUploadApk'));
|
|
93
113
|
}
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
appKey: appKeyInPkg,
|
|
99
|
-
} = await getApkInfo(fn);
|
|
114
|
+
const apkInfo = await getApkInfo(fn);
|
|
115
|
+
const { versionName: extractedVersionName, buildTime } = apkInfo;
|
|
116
|
+
const appIdInPkg = (apkInfo as any).appId;
|
|
117
|
+
const appKeyInPkg = (apkInfo as any).appKey;
|
|
100
118
|
const { appId, appKey } = await getSelectedApp('android');
|
|
101
119
|
|
|
102
120
|
if (appIdInPkg && appIdInPkg != appId) {
|
|
@@ -107,6 +125,12 @@ export const packageCommands = {
|
|
|
107
125
|
throw new Error(t('appKeyMismatchApk', { appKeyInPkg, appKey }));
|
|
108
126
|
}
|
|
109
127
|
|
|
128
|
+
// Use custom version if provided, otherwise use extracted version
|
|
129
|
+
const versionName = options.version || extractedVersionName;
|
|
130
|
+
if (options.version) {
|
|
131
|
+
console.log(t('usingCustomVersion', { version: versionName }));
|
|
132
|
+
}
|
|
133
|
+
|
|
110
134
|
const { hash } = await uploadFile(fn);
|
|
111
135
|
|
|
112
136
|
const { id } = await post(`/app/${appId}/package/create`, {
|
|
@@ -119,17 +143,21 @@ export const packageCommands = {
|
|
|
119
143
|
saveToLocal(fn, `${appId}/package/${id}.apk`);
|
|
120
144
|
console.log(t('apkUploadSuccess', { id, version: versionName, buildTime }));
|
|
121
145
|
},
|
|
122
|
-
uploadApp: async ({
|
|
146
|
+
uploadApp: async ({
|
|
147
|
+
args,
|
|
148
|
+
options,
|
|
149
|
+
}: {
|
|
150
|
+
args: string[];
|
|
151
|
+
options: Record<string, any>;
|
|
152
|
+
}) => {
|
|
123
153
|
const fn = args[0];
|
|
124
154
|
if (!fn || !fn.endsWith('.app')) {
|
|
125
155
|
throw new Error(t('usageUploadApp'));
|
|
126
156
|
}
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
appKey: appKeyInPkg,
|
|
132
|
-
} = await getAppInfo(fn);
|
|
157
|
+
const appInfo = await getAppInfo(fn);
|
|
158
|
+
const { versionName: extractedVersionName, buildTime } = appInfo;
|
|
159
|
+
const appIdInPkg = (appInfo as any).appId;
|
|
160
|
+
const appKeyInPkg = (appInfo as any).appKey;
|
|
133
161
|
const { appId, appKey } = await getSelectedApp('harmony');
|
|
134
162
|
|
|
135
163
|
if (appIdInPkg && appIdInPkg != appId) {
|
|
@@ -140,6 +168,12 @@ export const packageCommands = {
|
|
|
140
168
|
throw new Error(t('appKeyMismatchApp', { appKeyInPkg, appKey }));
|
|
141
169
|
}
|
|
142
170
|
|
|
171
|
+
// Use custom version if provided, otherwise use extracted version
|
|
172
|
+
const versionName = options.version || extractedVersionName;
|
|
173
|
+
if (options.version) {
|
|
174
|
+
console.log(t('usingCustomVersion', { version: versionName }));
|
|
175
|
+
}
|
|
176
|
+
|
|
143
177
|
const { hash } = await uploadFile(fn);
|
|
144
178
|
|
|
145
179
|
const { id } = await post(`/app/${appId}/package/create`, {
|