react-native-update-cli 2.8.5 → 2.9.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/api.d.ts +18 -0
- package/lib/app.d.ts +38 -0
- package/lib/app.js +5 -4
- package/lib/bundle-pack.d.ts +1 -0
- package/lib/bundle-pack.js +104 -0
- package/lib/bundle-runner.d.ts +20 -0
- package/lib/bundle-runner.js +404 -0
- package/lib/bundle.d.ts +6 -0
- package/lib/bundle.js +73 -471
- package/lib/diff.d.ts +13 -0
- package/lib/diff.js +144 -123
- package/lib/exports.d.ts +12 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +5 -13
- package/lib/install.d.ts +4 -0
- package/lib/locales/en.d.ts +137 -0
- package/lib/locales/zh.d.ts +136 -0
- package/lib/module-manager.d.ts +20 -0
- package/lib/module-manager.js +3 -9
- package/lib/modules/app-module.d.ts +2 -0
- package/lib/modules/app-module.js +84 -44
- package/lib/modules/bundle-module.d.ts +2 -0
- package/lib/modules/bundle-module.js +7 -8
- package/lib/modules/index.d.ts +6 -0
- package/lib/modules/package-module.d.ts +2 -0
- package/lib/modules/user-module.d.ts +2 -0
- package/lib/modules/user-module.js +55 -44
- package/lib/modules/version-module.d.ts +2 -0
- package/lib/package.d.ts +58 -0
- package/lib/package.js +103 -139
- package/lib/provider.d.ts +26 -0
- package/lib/provider.js +115 -217
- package/lib/types.d.ts +120 -0
- package/lib/user.d.ts +8 -0
- package/lib/utils/add-gitignore.d.ts +1 -0
- package/lib/utils/app-info-parser/aab.d.ts +22 -0
- package/lib/utils/app-info-parser/aab.js +0 -4
- package/lib/utils/app-info-parser/apk.d.ts +14 -0
- package/lib/utils/app-info-parser/apk.js +6 -4
- package/lib/utils/app-info-parser/app.d.ts +4 -0
- package/lib/utils/app-info-parser/app.js +3 -0
- package/lib/utils/app-info-parser/index.d.ts +16 -0
- package/lib/utils/app-info-parser/index.js +2 -0
- package/lib/utils/app-info-parser/ipa.d.ts +14 -0
- package/lib/utils/app-info-parser/ipa.js +1 -1
- package/lib/utils/app-info-parser/resource-finder.d.ts +49 -0
- package/lib/utils/app-info-parser/utils.d.ts +31 -0
- package/lib/utils/app-info-parser/utils.js +1 -0
- package/lib/utils/app-info-parser/xml-parser/binary.d.ts +56 -0
- package/lib/utils/app-info-parser/xml-parser/manifest.d.ts +10 -0
- package/lib/utils/app-info-parser/zip.d.ts +18 -0
- package/lib/utils/app-info-parser/zip.js +7 -9
- package/lib/utils/check-lockfile.d.ts +1 -0
- package/lib/utils/check-plugin.d.ts +7 -0
- package/lib/utils/command-result.d.ts +3 -0
- package/lib/utils/command-result.js +35 -0
- package/lib/utils/constants.d.ts +9 -0
- package/lib/utils/dep-versions.d.ts +1 -0
- package/lib/utils/git.d.ts +8 -0
- package/lib/utils/http-helper.d.ts +4 -0
- package/lib/utils/i18n.d.ts +12 -0
- package/lib/utils/index.d.ts +22 -0
- package/lib/utils/index.js +52 -22
- package/lib/utils/latest-version/cli.d.ts +1 -0
- package/lib/utils/latest-version/cli.js +24 -60
- package/lib/utils/latest-version/index.d.ts +146 -0
- package/lib/utils/latest-version/index.js +22 -22
- package/lib/utils/options.d.ts +4 -0
- package/lib/utils/options.js +63 -0
- package/lib/utils/plugin-config.d.ts +9 -0
- package/lib/utils/zip-entries.d.ts +3 -0
- package/lib/versions.d.ts +43 -0
- package/lib/workflow-runner.d.ts +2 -0
- package/lib/workflow-runner.js +25 -0
- package/package.json +20 -5
- package/src/api.ts +1 -1
- package/src/app.ts +20 -11
- package/src/bundle-pack.ts +51 -0
- package/src/bundle-runner.ts +463 -0
- package/src/bundle.ts +184 -571
- package/src/diff.ts +208 -174
- package/src/index.ts +15 -17
- package/src/module-manager.ts +15 -15
- package/src/modules/app-module.ts +120 -48
- package/src/modules/bundle-module.ts +21 -11
- package/src/modules/package-module.ts +0 -1
- package/src/modules/user-module.ts +117 -58
- package/src/package.ts +158 -138
- package/src/provider.ts +164 -240
- package/src/types.ts +13 -8
- package/src/utils/app-info-parser/aab.ts +0 -7
- package/src/utils/app-info-parser/apk.ts +9 -6
- package/src/utils/app-info-parser/app.ts +5 -1
- package/src/utils/app-info-parser/index.ts +11 -6
- package/src/utils/app-info-parser/ipa.ts +1 -1
- package/src/utils/app-info-parser/utils.ts +3 -0
- package/src/utils/app-info-parser/xml-parser/manifest.ts +3 -1
- package/src/utils/app-info-parser/zip.ts +12 -14
- package/src/utils/command-result.ts +24 -0
- package/src/utils/index.ts +138 -39
- package/src/utils/latest-version/cli.ts +22 -20
- package/src/utils/latest-version/index.ts +20 -20
- package/src/utils/options.ts +56 -0
- package/src/utils/zip-entries.ts +1 -1
- package/src/workflow-runner.ts +24 -0
- package/index.js +0 -1
|
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "userModule", {
|
|
|
10
10
|
});
|
|
11
11
|
const _api = require("../api");
|
|
12
12
|
const _user = require("../user");
|
|
13
|
+
const _options = require("../utils/options");
|
|
13
14
|
function _getRequireWildcardCache(nodeInterop) {
|
|
14
15
|
if (typeof WeakMap !== "function") return null;
|
|
15
16
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -78,21 +79,20 @@ const userModule = {
|
|
|
78
79
|
try {
|
|
79
80
|
await (0, _api.loadSession)();
|
|
80
81
|
const session = (0, _api.getSession)();
|
|
81
|
-
if (session
|
|
82
|
+
if (session == null ? void 0 : session.token) {
|
|
82
83
|
console.log('✓ Session found in local storage');
|
|
83
84
|
return {
|
|
84
85
|
sessionLoaded: true,
|
|
85
86
|
hasToken: true,
|
|
86
87
|
session
|
|
87
88
|
};
|
|
88
|
-
} else {
|
|
89
|
-
console.log('✗ No valid session found in local storage');
|
|
90
|
-
return {
|
|
91
|
-
sessionLoaded: true,
|
|
92
|
-
hasToken: false,
|
|
93
|
-
session: null
|
|
94
|
-
};
|
|
95
89
|
}
|
|
90
|
+
console.log('✗ No valid session found in local storage');
|
|
91
|
+
return {
|
|
92
|
+
sessionLoaded: true,
|
|
93
|
+
hasToken: false,
|
|
94
|
+
session: null
|
|
95
|
+
};
|
|
96
96
|
} catch (error) {
|
|
97
97
|
console.log('✗ Failed to load session:', error instanceof Error ? error.message : 'Unknown error');
|
|
98
98
|
return {
|
|
@@ -108,10 +108,11 @@ const userModule = {
|
|
|
108
108
|
name: 'validate-session',
|
|
109
109
|
description: 'Validate session by calling API',
|
|
110
110
|
execute: async (context, previousResult)=>{
|
|
111
|
-
|
|
111
|
+
const state = (0, _options.toObjectState)(previousResult, {});
|
|
112
|
+
if (!state.hasToken) {
|
|
112
113
|
console.log('No token available, skipping validation');
|
|
113
114
|
return {
|
|
114
|
-
...
|
|
115
|
+
...state,
|
|
115
116
|
validated: false,
|
|
116
117
|
reason: 'No token available'
|
|
117
118
|
};
|
|
@@ -121,14 +122,14 @@ const userModule = {
|
|
|
121
122
|
await _user.userCommands.me();
|
|
122
123
|
console.log('✓ Session is valid');
|
|
123
124
|
return {
|
|
124
|
-
...
|
|
125
|
+
...state,
|
|
125
126
|
validated: true,
|
|
126
127
|
reason: 'Session validated successfully'
|
|
127
128
|
};
|
|
128
129
|
} catch (error) {
|
|
129
130
|
console.log('✗ Session validation failed:', error instanceof Error ? error.message : 'Unknown error');
|
|
130
131
|
return {
|
|
131
|
-
...
|
|
132
|
+
...state,
|
|
132
133
|
validated: false,
|
|
133
134
|
reason: error instanceof Error ? error.message : 'Unknown error'
|
|
134
135
|
};
|
|
@@ -139,10 +140,11 @@ const userModule = {
|
|
|
139
140
|
name: 'get-user-info',
|
|
140
141
|
description: 'Get current user information',
|
|
141
142
|
execute: async (context, previousResult)=>{
|
|
142
|
-
|
|
143
|
+
const state = (0, _options.toObjectState)(previousResult, {});
|
|
144
|
+
if (!state.validated) {
|
|
143
145
|
console.log('Session not valid, cannot get user info');
|
|
144
146
|
return {
|
|
145
|
-
...
|
|
147
|
+
...state,
|
|
146
148
|
userInfo: null,
|
|
147
149
|
reason: 'Session not valid'
|
|
148
150
|
};
|
|
@@ -152,7 +154,8 @@ const userModule = {
|
|
|
152
154
|
const { get } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../api")));
|
|
153
155
|
const userInfo = await get('/user/me');
|
|
154
156
|
console.log('✓ User information retrieved successfully');
|
|
155
|
-
|
|
157
|
+
const showDetails = (0, _options.getBooleanOption)(context.options, 'showDetails', true);
|
|
158
|
+
if (showDetails) {
|
|
156
159
|
console.log('\n=== User Information ===');
|
|
157
160
|
for (const [key, value] of Object.entries(userInfo)){
|
|
158
161
|
if (key !== 'ok') {
|
|
@@ -162,14 +165,14 @@ const userModule = {
|
|
|
162
165
|
console.log('========================\n');
|
|
163
166
|
}
|
|
164
167
|
return {
|
|
165
|
-
...
|
|
168
|
+
...state,
|
|
166
169
|
userInfo,
|
|
167
170
|
reason: 'User info retrieved successfully'
|
|
168
171
|
};
|
|
169
172
|
} catch (error) {
|
|
170
173
|
console.log('✗ Failed to get user info:', error instanceof Error ? error.message : 'Unknown error');
|
|
171
174
|
return {
|
|
172
|
-
...
|
|
175
|
+
...state,
|
|
173
176
|
userInfo: null,
|
|
174
177
|
reason: error instanceof Error ? error.message : 'Unknown error'
|
|
175
178
|
};
|
|
@@ -180,16 +183,18 @@ const userModule = {
|
|
|
180
183
|
name: 'handle-auth-failure',
|
|
181
184
|
description: 'Handle authentication failure',
|
|
182
185
|
execute: async (context, previousResult)=>{
|
|
183
|
-
|
|
186
|
+
const state = (0, _options.toObjectState)(previousResult, {});
|
|
187
|
+
if (state.validated) {
|
|
184
188
|
console.log('✓ Authentication check completed successfully');
|
|
185
189
|
return {
|
|
186
|
-
...
|
|
190
|
+
...state,
|
|
187
191
|
authCheckComplete: true,
|
|
188
192
|
status: 'authenticated'
|
|
189
193
|
};
|
|
190
194
|
}
|
|
191
195
|
console.log('✗ Authentication check failed');
|
|
192
|
-
|
|
196
|
+
const autoLogin = (0, _options.getBooleanOption)(context.options, 'autoLogin', false);
|
|
197
|
+
if (autoLogin) {
|
|
193
198
|
console.log('Attempting automatic login...');
|
|
194
199
|
try {
|
|
195
200
|
await _user.userCommands.login({
|
|
@@ -197,7 +202,7 @@ const userModule = {
|
|
|
197
202
|
});
|
|
198
203
|
console.log('✓ Automatic login successful');
|
|
199
204
|
return {
|
|
200
|
-
...
|
|
205
|
+
...state,
|
|
201
206
|
authCheckComplete: true,
|
|
202
207
|
status: 'auto-logged-in',
|
|
203
208
|
autoLoginSuccess: true
|
|
@@ -205,7 +210,7 @@ const userModule = {
|
|
|
205
210
|
} catch (error) {
|
|
206
211
|
console.log('✗ Automatic login failed:', error instanceof Error ? error.message : 'Unknown error');
|
|
207
212
|
return {
|
|
208
|
-
...
|
|
213
|
+
...state,
|
|
209
214
|
authCheckComplete: true,
|
|
210
215
|
status: 'failed',
|
|
211
216
|
autoLoginSuccess: false,
|
|
@@ -215,7 +220,7 @@ const userModule = {
|
|
|
215
220
|
} else {
|
|
216
221
|
console.log('Please run login command to authenticate');
|
|
217
222
|
return {
|
|
218
|
-
...
|
|
223
|
+
...state,
|
|
219
224
|
authCheckComplete: true,
|
|
220
225
|
status: 'unauthenticated',
|
|
221
226
|
suggestion: 'Run login command to authenticate'
|
|
@@ -251,7 +256,7 @@ const userModule = {
|
|
|
251
256
|
try {
|
|
252
257
|
await (0, _api.loadSession)();
|
|
253
258
|
const session = (0, _api.getSession)();
|
|
254
|
-
if (session
|
|
259
|
+
if (session == null ? void 0 : session.token) {
|
|
255
260
|
try {
|
|
256
261
|
await _user.userCommands.me();
|
|
257
262
|
console.log('✓ User is already logged in');
|
|
@@ -291,10 +296,11 @@ const userModule = {
|
|
|
291
296
|
name: 'perform-login',
|
|
292
297
|
description: 'Perform user login',
|
|
293
298
|
execute: async (context, previousResult)=>{
|
|
294
|
-
|
|
299
|
+
const state = (0, _options.toObjectState)(previousResult, {});
|
|
300
|
+
if (state.alreadyLoggedIn) {
|
|
295
301
|
console.log('Skipping login - user already authenticated');
|
|
296
302
|
return {
|
|
297
|
-
...
|
|
303
|
+
...state,
|
|
298
304
|
loginPerformed: false,
|
|
299
305
|
loginSuccess: true
|
|
300
306
|
};
|
|
@@ -302,25 +308,27 @@ const userModule = {
|
|
|
302
308
|
console.log('Performing login...');
|
|
303
309
|
try {
|
|
304
310
|
const loginArgs = [];
|
|
305
|
-
|
|
306
|
-
|
|
311
|
+
const email = (0, _options.getOptionalStringOption)(context.options, 'email');
|
|
312
|
+
if (email) {
|
|
313
|
+
loginArgs.push(email);
|
|
307
314
|
}
|
|
308
|
-
|
|
309
|
-
|
|
315
|
+
const password = (0, _options.getOptionalStringOption)(context.options, 'password');
|
|
316
|
+
if (password) {
|
|
317
|
+
loginArgs.push(password);
|
|
310
318
|
}
|
|
311
319
|
await _user.userCommands.login({
|
|
312
320
|
args: loginArgs
|
|
313
321
|
});
|
|
314
322
|
console.log('✓ Login successful');
|
|
315
323
|
return {
|
|
316
|
-
...
|
|
324
|
+
...state,
|
|
317
325
|
loginPerformed: true,
|
|
318
326
|
loginSuccess: true
|
|
319
327
|
};
|
|
320
328
|
} catch (error) {
|
|
321
329
|
console.log('✗ Login failed:', error instanceof Error ? error.message : 'Unknown error');
|
|
322
330
|
return {
|
|
323
|
-
...
|
|
331
|
+
...state,
|
|
324
332
|
loginPerformed: true,
|
|
325
333
|
loginSuccess: false,
|
|
326
334
|
loginError: error instanceof Error ? error.message : 'Unknown error'
|
|
@@ -332,18 +340,20 @@ const userModule = {
|
|
|
332
340
|
name: 'validate-login',
|
|
333
341
|
description: 'Validate login by getting user info',
|
|
334
342
|
execute: async (context, previousResult)=>{
|
|
335
|
-
|
|
343
|
+
const state = (0, _options.toObjectState)(previousResult, {});
|
|
344
|
+
if (!state.loginSuccess && !state.alreadyLoggedIn) {
|
|
336
345
|
console.log('Login failed, skipping validation');
|
|
337
346
|
return {
|
|
338
|
-
...
|
|
347
|
+
...state,
|
|
339
348
|
validationPerformed: false,
|
|
340
349
|
validationSuccess: false
|
|
341
350
|
};
|
|
342
351
|
}
|
|
343
|
-
|
|
352
|
+
const validateAfterLogin = (0, _options.getBooleanOption)(context.options, 'validateAfterLogin', true);
|
|
353
|
+
if (!validateAfterLogin) {
|
|
344
354
|
console.log('Skipping validation as requested');
|
|
345
355
|
return {
|
|
346
|
-
...
|
|
356
|
+
...state,
|
|
347
357
|
validationPerformed: false,
|
|
348
358
|
validationSuccess: true
|
|
349
359
|
};
|
|
@@ -353,7 +363,7 @@ const userModule = {
|
|
|
353
363
|
const userInfo = await _user.userCommands.me();
|
|
354
364
|
console.log('✓ Login validation successful');
|
|
355
365
|
return {
|
|
356
|
-
...
|
|
366
|
+
...state,
|
|
357
367
|
validationPerformed: true,
|
|
358
368
|
validationSuccess: true,
|
|
359
369
|
userInfo
|
|
@@ -361,7 +371,7 @@ const userModule = {
|
|
|
361
371
|
} catch (error) {
|
|
362
372
|
console.log('✗ Login validation failed:', error instanceof Error ? error.message : 'Unknown error');
|
|
363
373
|
return {
|
|
364
|
-
...
|
|
374
|
+
...state,
|
|
365
375
|
validationPerformed: true,
|
|
366
376
|
validationSuccess: false,
|
|
367
377
|
validationError: error instanceof Error ? error.message : 'Unknown error'
|
|
@@ -373,26 +383,27 @@ const userModule = {
|
|
|
373
383
|
name: 'login-summary',
|
|
374
384
|
description: 'Provide login flow summary',
|
|
375
385
|
execute: async (context, previousResult)=>{
|
|
386
|
+
const state = (0, _options.toObjectState)(previousResult, {});
|
|
376
387
|
console.log('\n=== Login Flow Summary ===');
|
|
377
|
-
if (
|
|
388
|
+
if (state.alreadyLoggedIn) {
|
|
378
389
|
console.log('Status: Already logged in');
|
|
379
390
|
console.log('Session: Valid');
|
|
380
|
-
} else if (
|
|
391
|
+
} else if (state.loginSuccess) {
|
|
381
392
|
console.log('Status: Login successful');
|
|
382
|
-
if (
|
|
393
|
+
if (state.validationSuccess) {
|
|
383
394
|
console.log('Validation: Passed');
|
|
384
395
|
} else {
|
|
385
396
|
console.log('Validation: Failed');
|
|
386
397
|
}
|
|
387
398
|
} else {
|
|
388
399
|
console.log('Status: Login failed');
|
|
389
|
-
console.log('Error:',
|
|
400
|
+
console.log('Error:', state.loginError || 'Unknown error');
|
|
390
401
|
}
|
|
391
402
|
console.log('==========================\n');
|
|
392
403
|
return {
|
|
393
|
-
...
|
|
404
|
+
...state,
|
|
394
405
|
flowComplete: true,
|
|
395
|
-
finalStatus:
|
|
406
|
+
finalStatus: state.alreadyLoggedIn || state.loginSuccess ? 'success' : 'failed'
|
|
396
407
|
};
|
|
397
408
|
}
|
|
398
409
|
}
|
package/lib/package.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Platform } from './types';
|
|
2
|
+
type PackageCommandOptions = Record<string, unknown> & {
|
|
3
|
+
version?: string;
|
|
4
|
+
includeAllSplits?: boolean | string;
|
|
5
|
+
splits?: string;
|
|
6
|
+
output?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function listPackage(appId: string): Promise<import("./types").Package[]>;
|
|
9
|
+
export declare function choosePackage(appId: string): Promise<import("./types").Package>;
|
|
10
|
+
export declare const packageCommands: {
|
|
11
|
+
uploadIpa: ({ args, options, }: {
|
|
12
|
+
args: string[];
|
|
13
|
+
options: PackageCommandOptions;
|
|
14
|
+
}) => Promise<void>;
|
|
15
|
+
uploadApk: ({ args, options, }: {
|
|
16
|
+
args: string[];
|
|
17
|
+
options: PackageCommandOptions;
|
|
18
|
+
}) => Promise<void>;
|
|
19
|
+
uploadAab: ({ args, options, }: {
|
|
20
|
+
args: string[];
|
|
21
|
+
options: PackageCommandOptions;
|
|
22
|
+
}) => Promise<void>;
|
|
23
|
+
uploadApp: ({ args, options, }: {
|
|
24
|
+
args: string[];
|
|
25
|
+
options: PackageCommandOptions;
|
|
26
|
+
}) => Promise<void>;
|
|
27
|
+
parseApp: ({ args }: {
|
|
28
|
+
args: string[];
|
|
29
|
+
}) => Promise<void>;
|
|
30
|
+
parseIpa: ({ args }: {
|
|
31
|
+
args: string[];
|
|
32
|
+
}) => Promise<void>;
|
|
33
|
+
parseApk: ({ args }: {
|
|
34
|
+
args: string[];
|
|
35
|
+
}) => Promise<void>;
|
|
36
|
+
parseAab: ({ args }: {
|
|
37
|
+
args: string[];
|
|
38
|
+
}) => Promise<void>;
|
|
39
|
+
extractApk: ({ args, options, }: {
|
|
40
|
+
args: string[];
|
|
41
|
+
options: PackageCommandOptions;
|
|
42
|
+
}) => Promise<void>;
|
|
43
|
+
packages: ({ options }: {
|
|
44
|
+
options: {
|
|
45
|
+
platform: Platform;
|
|
46
|
+
};
|
|
47
|
+
}) => Promise<void>;
|
|
48
|
+
deletePackage: ({ args, options, }: {
|
|
49
|
+
args: string[];
|
|
50
|
+
options: {
|
|
51
|
+
appId?: string;
|
|
52
|
+
packageId?: string;
|
|
53
|
+
packageVersion?: string;
|
|
54
|
+
platform?: Platform;
|
|
55
|
+
};
|
|
56
|
+
}) => Promise<void>;
|
|
57
|
+
};
|
|
58
|
+
export {};
|
package/lib/package.js
CHANGED
|
@@ -35,6 +35,72 @@ function _interop_require_default(obj) {
|
|
|
35
35
|
default: obj
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
+
function ensureFileByExt(filePath, extension, usageKey) {
|
|
39
|
+
if (!filePath || !filePath.endsWith(extension)) {
|
|
40
|
+
throw new Error((0, _i18n.t)(usageKey));
|
|
41
|
+
}
|
|
42
|
+
return filePath;
|
|
43
|
+
}
|
|
44
|
+
function parseBooleanOption(value) {
|
|
45
|
+
return value === true || value === 'true';
|
|
46
|
+
}
|
|
47
|
+
function parseCsvOption(value) {
|
|
48
|
+
if (typeof value !== 'string') {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const parsed = value.split(',').map((item)=>item.trim()).filter(Boolean);
|
|
52
|
+
return parsed.length > 0 ? parsed : null;
|
|
53
|
+
}
|
|
54
|
+
function getVersionBinding(version) {
|
|
55
|
+
if (!version || typeof version !== 'object') {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
const v = version;
|
|
59
|
+
return {
|
|
60
|
+
id: v.id,
|
|
61
|
+
name: v.name
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
async function uploadNativePackage(filePath, options, config) {
|
|
65
|
+
const info = await config.getInfo(filePath);
|
|
66
|
+
const { versionName: extractedVersionName, buildTime } = info;
|
|
67
|
+
const { appId: appIdInPkg, appKey: appKeyInPkg } = info;
|
|
68
|
+
const { appId, appKey } = await (0, _app.getSelectedApp)(config.platform);
|
|
69
|
+
if (appIdInPkg && appIdInPkg != appId) {
|
|
70
|
+
throw new Error((0, _i18n.t)(config.appIdMismatchKey, {
|
|
71
|
+
appIdInPkg,
|
|
72
|
+
appId
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
if (appKeyInPkg && appKeyInPkg !== appKey) {
|
|
76
|
+
throw new Error((0, _i18n.t)(config.appKeyMismatchKey, {
|
|
77
|
+
appKeyInPkg,
|
|
78
|
+
appKey
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
const customVersion = typeof options.version === 'string' && options.version ? options.version : undefined;
|
|
82
|
+
const versionName = customVersion != null ? customVersion : extractedVersionName;
|
|
83
|
+
if (customVersion !== undefined) {
|
|
84
|
+
console.log((0, _i18n.t)('usingCustomVersion', {
|
|
85
|
+
version: versionName
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
const { hash } = await (0, _api.uploadFile)(filePath);
|
|
89
|
+
const normalizedBuildTime = config.normalizeBuildTime ? config.normalizeBuildTime(buildTime) : buildTime;
|
|
90
|
+
const { id } = await (0, _api.post)(`/app/${appId}/package/create`, {
|
|
91
|
+
name: versionName,
|
|
92
|
+
hash,
|
|
93
|
+
buildTime: normalizedBuildTime,
|
|
94
|
+
deps: _depversions.depVersions,
|
|
95
|
+
commit: await (0, _git.getCommitInfo)()
|
|
96
|
+
});
|
|
97
|
+
(0, _utils.saveToLocal)(filePath, `${appId}/package/${id}${config.extension}`);
|
|
98
|
+
console.log((0, _i18n.t)(config.successKey, {
|
|
99
|
+
id,
|
|
100
|
+
version: versionName,
|
|
101
|
+
buildTime: normalizedBuildTime
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
38
104
|
async function listPackage(appId) {
|
|
39
105
|
const allPkgs = await (0, _api.getAllPackages)(appId) || [];
|
|
40
106
|
const header = [
|
|
@@ -50,10 +116,11 @@ async function listPackage(appId) {
|
|
|
50
116
|
const { version } = pkg;
|
|
51
117
|
let versionInfo = '';
|
|
52
118
|
if (version) {
|
|
53
|
-
const versionObj = version;
|
|
119
|
+
const versionObj = getVersionBinding(version);
|
|
120
|
+
var _versionObj_name, _versionObj_id;
|
|
54
121
|
versionInfo = (0, _i18n.t)('boundTo', {
|
|
55
|
-
name: versionObj.name
|
|
56
|
-
id: versionObj.id
|
|
122
|
+
name: (_versionObj_name = versionObj == null ? void 0 : versionObj.name) != null ? _versionObj_name : version,
|
|
123
|
+
id: (_versionObj_id = versionObj == null ? void 0 : versionObj.id) != null ? _versionObj_id : version
|
|
57
124
|
});
|
|
58
125
|
}
|
|
59
126
|
let output = pkg.name;
|
|
@@ -87,101 +154,32 @@ async function choosePackage(appId) {
|
|
|
87
154
|
}
|
|
88
155
|
const packageCommands = {
|
|
89
156
|
uploadIpa: async ({ args, options })=>{
|
|
90
|
-
const fn = args[0];
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const { appId, appKey } = await (0, _app.getSelectedApp)('ios');
|
|
99
|
-
if (appIdInPkg && appIdInPkg != appId) {
|
|
100
|
-
throw new Error((0, _i18n.t)('appIdMismatchIpa', {
|
|
101
|
-
appIdInPkg,
|
|
102
|
-
appId
|
|
103
|
-
}));
|
|
104
|
-
}
|
|
105
|
-
if (appKeyInPkg && appKeyInPkg !== appKey) {
|
|
106
|
-
throw new Error((0, _i18n.t)('appKeyMismatchIpa', {
|
|
107
|
-
appKeyInPkg,
|
|
108
|
-
appKey
|
|
109
|
-
}));
|
|
110
|
-
}
|
|
111
|
-
// Use custom version if provided, otherwise use extracted version
|
|
112
|
-
const versionName = options.version || extractedVersionName;
|
|
113
|
-
if (options.version) {
|
|
114
|
-
console.log((0, _i18n.t)('usingCustomVersion', {
|
|
115
|
-
version: versionName
|
|
116
|
-
}));
|
|
117
|
-
}
|
|
118
|
-
const { hash } = await (0, _api.uploadFile)(fn);
|
|
119
|
-
const { id } = await (0, _api.post)(`/app/${appId}/package/create`, {
|
|
120
|
-
name: versionName,
|
|
121
|
-
hash,
|
|
122
|
-
buildTime,
|
|
123
|
-
deps: _depversions.depVersions,
|
|
124
|
-
commit: await (0, _git.getCommitInfo)()
|
|
157
|
+
const fn = ensureFileByExt(args[0], '.ipa', 'usageUploadIpa');
|
|
158
|
+
await uploadNativePackage(fn, options, {
|
|
159
|
+
extension: '.ipa',
|
|
160
|
+
platform: 'ios',
|
|
161
|
+
appIdMismatchKey: 'appIdMismatchIpa',
|
|
162
|
+
appKeyMismatchKey: 'appKeyMismatchIpa',
|
|
163
|
+
successKey: 'ipaUploadSuccess',
|
|
164
|
+
getInfo: (filePath)=>(0, _utils.getIpaInfo)(filePath)
|
|
125
165
|
});
|
|
126
|
-
(0, _utils.saveToLocal)(fn, `${appId}/package/${id}.ipa`);
|
|
127
|
-
console.log((0, _i18n.t)('ipaUploadSuccess', {
|
|
128
|
-
id,
|
|
129
|
-
version: versionName,
|
|
130
|
-
buildTime
|
|
131
|
-
}));
|
|
132
166
|
},
|
|
133
167
|
uploadApk: async ({ args, options })=>{
|
|
134
|
-
const fn = args[0];
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const { appId, appKey } = await (0, _app.getSelectedApp)('android');
|
|
143
|
-
if (appIdInPkg && appIdInPkg != appId) {
|
|
144
|
-
throw new Error((0, _i18n.t)('appIdMismatchApk', {
|
|
145
|
-
appIdInPkg,
|
|
146
|
-
appId
|
|
147
|
-
}));
|
|
148
|
-
}
|
|
149
|
-
if (appKeyInPkg && appKeyInPkg !== appKey) {
|
|
150
|
-
throw new Error((0, _i18n.t)('appKeyMismatchApk', {
|
|
151
|
-
appKeyInPkg,
|
|
152
|
-
appKey
|
|
153
|
-
}));
|
|
154
|
-
}
|
|
155
|
-
// Use custom version if provided, otherwise use extracted version
|
|
156
|
-
const versionName = options.version || extractedVersionName;
|
|
157
|
-
if (options.version) {
|
|
158
|
-
console.log((0, _i18n.t)('usingCustomVersion', {
|
|
159
|
-
version: versionName
|
|
160
|
-
}));
|
|
161
|
-
}
|
|
162
|
-
const { hash } = await (0, _api.uploadFile)(fn);
|
|
163
|
-
const { id } = await (0, _api.post)(`/app/${appId}/package/create`, {
|
|
164
|
-
name: versionName,
|
|
165
|
-
hash,
|
|
166
|
-
buildTime,
|
|
167
|
-
deps: _depversions.depVersions,
|
|
168
|
-
commit: await (0, _git.getCommitInfo)()
|
|
168
|
+
const fn = ensureFileByExt(args[0], '.apk', 'usageUploadApk');
|
|
169
|
+
await uploadNativePackage(fn, options, {
|
|
170
|
+
extension: '.apk',
|
|
171
|
+
platform: 'android',
|
|
172
|
+
appIdMismatchKey: 'appIdMismatchApk',
|
|
173
|
+
appKeyMismatchKey: 'appKeyMismatchApk',
|
|
174
|
+
successKey: 'apkUploadSuccess',
|
|
175
|
+
getInfo: (filePath)=>(0, _utils.getApkInfo)(filePath)
|
|
169
176
|
});
|
|
170
|
-
(0, _utils.saveToLocal)(fn, `${appId}/package/${id}.apk`);
|
|
171
|
-
console.log((0, _i18n.t)('apkUploadSuccess', {
|
|
172
|
-
id,
|
|
173
|
-
version: versionName,
|
|
174
|
-
buildTime
|
|
175
|
-
}));
|
|
176
177
|
},
|
|
177
178
|
uploadAab: async ({ args, options })=>{
|
|
178
|
-
const source = args[0];
|
|
179
|
-
if (!source || !source.endsWith('.aab')) {
|
|
180
|
-
throw new Error((0, _i18n.t)('usageUploadAab'));
|
|
181
|
-
}
|
|
179
|
+
const source = ensureFileByExt(args[0], '.aab', 'usageUploadAab');
|
|
182
180
|
const output = _path.default.join(_os.default.tmpdir(), `${_path.default.basename(source, _path.default.extname(source))}-${Date.now()}.apk`);
|
|
183
|
-
const includeAllSplits = options.includeAllSplits
|
|
184
|
-
const splits =
|
|
181
|
+
const includeAllSplits = parseBooleanOption(options.includeAllSplits);
|
|
182
|
+
const splits = parseCsvOption(options.splits);
|
|
185
183
|
const parser = new _aab.AabParser(source);
|
|
186
184
|
try {
|
|
187
185
|
await parser.extractApk(output, {
|
|
@@ -201,48 +199,16 @@ const packageCommands = {
|
|
|
201
199
|
}
|
|
202
200
|
},
|
|
203
201
|
uploadApp: async ({ args, options })=>{
|
|
204
|
-
const fn = args[0];
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
if (appIdInPkg && appIdInPkg != appId) {
|
|
214
|
-
throw new Error((0, _i18n.t)('appIdMismatchApp', {
|
|
215
|
-
appIdInPkg,
|
|
216
|
-
appId
|
|
217
|
-
}));
|
|
218
|
-
}
|
|
219
|
-
if (appKeyInPkg && appKeyInPkg !== appKey) {
|
|
220
|
-
throw new Error((0, _i18n.t)('appKeyMismatchApp', {
|
|
221
|
-
appKeyInPkg,
|
|
222
|
-
appKey
|
|
223
|
-
}));
|
|
224
|
-
}
|
|
225
|
-
// Use custom version if provided, otherwise use extracted version
|
|
226
|
-
const versionName = options.version || extractedVersionName;
|
|
227
|
-
if (options.version) {
|
|
228
|
-
console.log((0, _i18n.t)('usingCustomVersion', {
|
|
229
|
-
version: versionName
|
|
230
|
-
}));
|
|
231
|
-
}
|
|
232
|
-
const { hash } = await (0, _api.uploadFile)(fn);
|
|
233
|
-
const { id } = await (0, _api.post)(`/app/${appId}/package/create`, {
|
|
234
|
-
name: versionName,
|
|
235
|
-
hash,
|
|
236
|
-
buildTime: String(buildTime),
|
|
237
|
-
deps: _depversions.depVersions,
|
|
238
|
-
commit: await (0, _git.getCommitInfo)()
|
|
202
|
+
const fn = ensureFileByExt(args[0], '.app', 'usageUploadApp');
|
|
203
|
+
await uploadNativePackage(fn, options, {
|
|
204
|
+
extension: '.app',
|
|
205
|
+
platform: 'harmony',
|
|
206
|
+
appIdMismatchKey: 'appIdMismatchApp',
|
|
207
|
+
appKeyMismatchKey: 'appKeyMismatchApp',
|
|
208
|
+
successKey: 'appUploadSuccess',
|
|
209
|
+
getInfo: (filePath)=>(0, _utils.getAppInfo)(filePath),
|
|
210
|
+
normalizeBuildTime: (buildTime)=>String(buildTime)
|
|
239
211
|
});
|
|
240
|
-
(0, _utils.saveToLocal)(fn, `${appId}/package/${id}.app`);
|
|
241
|
-
console.log((0, _i18n.t)('appUploadSuccess', {
|
|
242
|
-
id,
|
|
243
|
-
version: versionName,
|
|
244
|
-
buildTime
|
|
245
|
-
}));
|
|
246
212
|
},
|
|
247
213
|
parseApp: async ({ args })=>{
|
|
248
214
|
const fn = args[0];
|
|
@@ -273,13 +239,10 @@ const packageCommands = {
|
|
|
273
239
|
console.log(await (0, _utils.getAabInfo)(fn));
|
|
274
240
|
},
|
|
275
241
|
extractApk: async ({ args, options })=>{
|
|
276
|
-
const source = args[0];
|
|
277
|
-
if (!source || !source.endsWith('.aab')) {
|
|
278
|
-
throw new Error((0, _i18n.t)('usageExtractApk'));
|
|
279
|
-
}
|
|
242
|
+
const source = ensureFileByExt(args[0], '.aab', 'usageExtractApk');
|
|
280
243
|
const output = options.output || _path.default.join(_path.default.dirname(source), `${_path.default.basename(source, _path.default.extname(source))}.apk`);
|
|
281
|
-
const includeAllSplits = options.includeAllSplits
|
|
282
|
-
const splits =
|
|
244
|
+
const includeAllSplits = parseBooleanOption(options.includeAllSplits);
|
|
245
|
+
const splits = parseCsvOption(options.splits);
|
|
283
246
|
const parser = new _aab.AabParser(source);
|
|
284
247
|
await parser.extractApk(output, {
|
|
285
248
|
includeAllSplits,
|
|
@@ -333,9 +296,10 @@ const packageCommands = {
|
|
|
333
296
|
packageId
|
|
334
297
|
}));
|
|
335
298
|
} catch (error) {
|
|
299
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
336
300
|
throw new Error((0, _i18n.t)('deletePackageError', {
|
|
337
301
|
packageId,
|
|
338
|
-
error:
|
|
302
|
+
error: message
|
|
339
303
|
}));
|
|
340
304
|
}
|
|
341
305
|
}
|