react-native-update-cli 2.0.0 → 2.1.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 CHANGED
@@ -49,14 +49,14 @@ const provider = moduleManager.getProvider();
49
49
  const bundleResult = await provider.bundle({
50
50
  platform: 'ios',
51
51
  dev: false,
52
- sourcemap: true
52
+ sourcemap: true,
53
53
  });
54
54
 
55
55
  // Publish version
56
56
  const publishResult = await provider.publish({
57
57
  name: 'v1.2.3',
58
58
  description: 'Bug fixes and improvements',
59
- rollout: 100
59
+ rollout: 100,
60
60
  });
61
61
  ```
62
62
 
@@ -65,12 +65,16 @@ const publishResult = await provider.publish({
65
65
  ### 1. Define Module
66
66
 
67
67
  ```typescript
68
- import type { CLIModule, CommandDefinition, CustomWorkflow } from 'react-native-update-cli';
68
+ import type {
69
+ CLIModule,
70
+ CommandDefinition,
71
+ CustomWorkflow,
72
+ } from 'react-native-update-cli';
69
73
 
70
74
  export const myCustomModule: CLIModule = {
71
75
  name: 'my-custom',
72
76
  version: '1.0.0',
73
-
77
+
74
78
  commands: [
75
79
  {
76
80
  name: 'custom-command',
@@ -79,15 +83,15 @@ export const myCustomModule: CLIModule = {
79
83
  console.log('Executing custom command...');
80
84
  return {
81
85
  success: true,
82
- data: { message: 'Custom command executed' }
86
+ data: { message: 'Custom command executed' },
83
87
  };
84
88
  },
85
89
  options: {
86
- param: { hasValue: true, description: 'Custom parameter' }
87
- }
88
- }
90
+ param: { hasValue: true, description: 'Custom parameter' },
91
+ },
92
+ },
89
93
  ],
90
-
94
+
91
95
  workflows: [
92
96
  {
93
97
  name: 'my-workflow',
@@ -99,7 +103,7 @@ export const myCustomModule: CLIModule = {
99
103
  execute: async (context, previousResult) => {
100
104
  console.log('Executing step 1...');
101
105
  return { step1Completed: true };
102
- }
106
+ },
103
107
  },
104
108
  {
105
109
  name: 'step2',
@@ -107,19 +111,19 @@ export const myCustomModule: CLIModule = {
107
111
  execute: async (context, previousResult) => {
108
112
  console.log('Executing step 2...');
109
113
  return { ...previousResult, step2Completed: true };
110
- }
111
- }
112
- ]
113
- }
114
+ },
115
+ },
116
+ ],
117
+ },
114
118
  ],
115
-
119
+
116
120
  init: (provider) => {
117
121
  console.log('Custom module initialized');
118
122
  },
119
-
123
+
120
124
  cleanup: () => {
121
125
  console.log('Custom module cleanup');
122
- }
126
+ },
123
127
  };
124
128
  ```
125
129
 
@@ -135,13 +139,13 @@ moduleManager.registerModule(myCustomModule);
135
139
  // Execute custom command
136
140
  const result = await moduleManager.executeCommand('custom-command', {
137
141
  args: [],
138
- options: { param: 'value' }
142
+ options: { param: 'value' },
139
143
  });
140
144
 
141
145
  // Execute custom workflow
142
146
  const workflowResult = await moduleManager.executeWorkflow('my-workflow', {
143
147
  args: [],
144
- options: {}
148
+ options: {},
145
149
  });
146
150
  ```
147
151
 
@@ -191,6 +195,7 @@ Each workflow step contains:
191
195
  ## 📋 Built-in Modules
192
196
 
193
197
  ### Bundle Module (`bundle`)
198
+
194
199
  - `bundle`: Bundle JavaScript code and optionally publish
195
200
  - `diff`: Generate differences between two PPK files
196
201
  - `hdiff`: Generate hdiff between two PPK files
@@ -201,27 +206,31 @@ Each workflow step contains:
201
206
  - `hdiffFromIpa`: Generate hdiff from IPA files
202
207
 
203
208
  ### Version Module (`version`)
209
+
204
210
  - `publish`: Publish new version
205
211
  - `versions`: List all versions
206
212
  - `update`: Update version information
207
213
  - `updateVersionInfo`: Update version metadata
208
214
 
209
215
  ### App Module (`app`)
216
+
210
217
  - `createApp`: Create new application
211
218
  - `apps`: List all applications
212
219
  - `selectApp`: Select application
213
220
  - `deleteApp`: Delete application
214
221
 
215
222
  ### Package Module (`package`)
216
- - `uploadIpa`: Upload IPA files
217
- - `uploadApk`: Upload APK files
218
- - `uploadApp`: Upload APP files
223
+
224
+ - `uploadIpa`: Upload IPA files (supports `--version` to override extracted version)
225
+ - `uploadApk`: Upload APK files (supports `--version` to override extracted version)
226
+ - `uploadApp`: Upload APP files (supports `--version` to override extracted version)
219
227
  - `parseApp`: Parse APP file information
220
228
  - `parseIpa`: Parse IPA file information
221
229
  - `parseApk`: Parse APK file information
222
230
  - `packages`: List packages
223
231
 
224
232
  ### User Module (`user`)
233
+
225
234
  - `login`: Login
226
235
  - `logout`: Logout
227
236
  - `me`: Show user information
@@ -234,36 +243,45 @@ Each workflow step contains:
234
243
  interface CLIProvider {
235
244
  // Bundle
236
245
  bundle(options: BundleOptions): Promise<CommandResult>;
237
-
246
+
238
247
  // Publish
239
248
  publish(options: PublishOptions): Promise<CommandResult>;
240
-
249
+
241
250
  // Upload
242
251
  upload(options: UploadOptions): Promise<CommandResult>;
243
-
252
+
244
253
  // Application management
245
- getSelectedApp(platform?: Platform): Promise<{ appId: string; platform: Platform }>;
254
+ getSelectedApp(
255
+ platform?: Platform,
256
+ ): Promise<{ appId: string; platform: Platform }>;
246
257
  listApps(platform?: Platform): Promise<CommandResult>;
247
258
  createApp(name: string, platform: Platform): Promise<CommandResult>;
248
-
259
+
249
260
  // Version management
250
261
  listVersions(appId: string): Promise<CommandResult>;
251
262
  getVersion(appId: string, versionId: string): Promise<CommandResult>;
252
- updateVersion(appId: string, versionId: string, updates: Partial<Version>): Promise<CommandResult>;
253
-
263
+ updateVersion(
264
+ appId: string,
265
+ versionId: string,
266
+ updates: Partial<Version>,
267
+ ): Promise<CommandResult>;
268
+
254
269
  // Package management
255
270
  listPackages(appId: string, platform?: Platform): Promise<CommandResult>;
256
271
  getPackage(appId: string, packageId: string): Promise<CommandResult>;
257
-
272
+
258
273
  // Utility functions
259
274
  getPlatform(platform?: Platform): Promise<Platform>;
260
275
  loadSession(): Promise<Session>;
261
276
  saveToLocal(key: string, value: string): void;
262
277
  question(prompt: string): Promise<string>;
263
-
278
+
264
279
  // Workflows
265
280
  registerWorkflow(workflow: CustomWorkflow): void;
266
- executeWorkflow(workflowName: string, context: CommandContext): Promise<CommandResult>;
281
+ executeWorkflow(
282
+ workflowName: string,
283
+ context: CommandContext,
284
+ ): Promise<CommandResult>;
267
285
  }
268
286
  ```
269
287
 
@@ -276,8 +294,8 @@ const bundleResult = await moduleManager.executeCommand('custom-bundle', {
276
294
  options: {
277
295
  platform: 'android',
278
296
  validate: true,
279
- optimize: true
280
- }
297
+ optimize: true,
298
+ },
281
299
  });
282
300
 
283
301
  // Generate diff file
@@ -286,8 +304,8 @@ const diffResult = await moduleManager.executeCommand('diff', {
286
304
  options: {
287
305
  origin: './build/v1.0.0.ppk',
288
306
  next: './build/v1.1.0.ppk',
289
- output: './build/diff.patch'
290
- }
307
+ output: './build/diff.patch',
308
+ },
291
309
  });
292
310
 
293
311
  // Generate diff from APK files
@@ -296,8 +314,8 @@ const apkDiffResult = await moduleManager.executeCommand('diffFromApk', {
296
314
  options: {
297
315
  origin: './build/app-v1.0.0.apk',
298
316
  next: './build/app-v1.1.0.apk',
299
- output: './build/apk-diff.patch'
300
- }
317
+ output: './build/apk-diff.patch',
318
+ },
301
319
  });
302
320
  ```
303
321
 
@@ -349,29 +367,31 @@ Provider provides a concise programming interface suitable for integrating React
349
367
  ### 📋 Core API Methods
350
368
 
351
369
  #### Core Business Functions
370
+
352
371
  ```typescript
353
372
  // Bundle application
354
373
  await provider.bundle({
355
374
  platform: 'ios',
356
375
  dev: false,
357
- sourcemap: true
376
+ sourcemap: true,
358
377
  });
359
378
 
360
379
  // Publish version
361
380
  await provider.publish({
362
381
  name: 'v1.0.0',
363
382
  description: 'Bug fixes',
364
- rollout: 100
383
+ rollout: 100,
365
384
  });
366
385
 
367
386
  // Upload file
368
387
  await provider.upload({
369
388
  filePath: 'app.ipa',
370
- platform: 'ios'
389
+ platform: 'ios',
371
390
  });
372
391
  ```
373
392
 
374
393
  #### Application Management
394
+
375
395
  ```typescript
376
396
  // Create application
377
397
  await provider.createApp('MyApp', 'ios');
@@ -384,6 +404,7 @@ const { appId, platform } = await provider.getSelectedApp('ios');
384
404
  ```
385
405
 
386
406
  #### Version Management
407
+
387
408
  ```typescript
388
409
  // List versions
389
410
  await provider.listVersions('app123');
@@ -391,11 +412,12 @@ await provider.listVersions('app123');
391
412
  // Update version
392
413
  await provider.updateVersion('app123', 'version456', {
393
414
  name: 'v1.1.0',
394
- description: 'New features'
415
+ description: 'New features',
395
416
  });
396
417
  ```
397
418
 
398
419
  #### Utility Functions
420
+
399
421
  ```typescript
400
422
  // Get platform
401
423
  const platform = await provider.getPlatform('ios');
@@ -407,72 +429,75 @@ const session = await provider.loadSession();
407
429
  ### 🎯 Use Cases
408
430
 
409
431
  #### 1. Automated Build Scripts
432
+
410
433
  ```typescript
411
434
  import { moduleManager } from 'react-native-update-cli';
412
435
 
413
436
  async function buildAndPublish() {
414
437
  const provider = moduleManager.getProvider();
415
-
438
+
416
439
  // 1. Bundle
417
440
  const bundleResult = await provider.bundle({
418
441
  platform: 'ios',
419
442
  dev: false,
420
- sourcemap: true
443
+ sourcemap: true,
421
444
  });
422
-
445
+
423
446
  if (!bundleResult.success) {
424
447
  throw new Error(`Bundle failed: ${bundleResult.error}`);
425
448
  }
426
-
449
+
427
450
  // 2. Publish
428
451
  const publishResult = await provider.publish({
429
452
  name: 'v1.2.3',
430
453
  description: 'Bug fixes and performance improvements',
431
- rollout: 100
454
+ rollout: 100,
432
455
  });
433
-
456
+
434
457
  if (!publishResult.success) {
435
458
  throw new Error(`Publish failed: ${publishResult.error}`);
436
459
  }
437
-
460
+
438
461
  console.log('Build and publish completed!');
439
462
  }
440
463
  ```
441
464
 
442
465
  #### 2. CI/CD Integration
466
+
443
467
  ```typescript
444
468
  async function ciBuild() {
445
469
  const provider = moduleManager.getProvider();
446
-
470
+
447
471
  const result = await provider.bundle({
448
472
  platform: process.env.PLATFORM as 'ios' | 'android',
449
473
  dev: process.env.NODE_ENV !== 'production',
450
- sourcemap: process.env.NODE_ENV === 'production'
474
+ sourcemap: process.env.NODE_ENV === 'production',
451
475
  });
452
-
476
+
453
477
  return result;
454
478
  }
455
479
  ```
456
480
 
457
481
  #### 3. Application Management Service
482
+
458
483
  ```typescript
459
484
  class AppManagementService {
460
485
  private provider = moduleManager.getProvider();
461
-
486
+
462
487
  async setupNewApp(name: string, platform: Platform) {
463
488
  // Create application
464
489
  const createResult = await this.provider.createApp(name, platform);
465
-
490
+
466
491
  if (createResult.success) {
467
492
  // Get application information
468
493
  const { appId } = await this.provider.getSelectedApp(platform);
469
-
494
+
470
495
  // List versions
471
496
  await this.provider.listVersions(appId);
472
-
497
+
473
498
  return { appId, success: true };
474
499
  }
475
-
500
+
476
501
  return { success: false, error: createResult.error };
477
502
  }
478
503
  }
@@ -488,6 +513,7 @@ class AppManagementService {
488
513
  ### 🔧 Advanced Features
489
514
 
490
515
  #### Custom Workflows
516
+
491
517
  ```typescript
492
518
  // Register custom workflow
493
519
  provider.registerWorkflow({
@@ -498,7 +524,7 @@ provider.registerWorkflow({
498
524
  name: 'bundle',
499
525
  execute: async () => {
500
526
  return await provider.bundle({ platform: 'ios', dev: false });
501
- }
527
+ },
502
528
  },
503
529
  {
504
530
  name: 'publish',
@@ -507,9 +533,9 @@ provider.registerWorkflow({
507
533
  throw new Error('Bundle failed, cannot publish');
508
534
  }
509
535
  return await provider.publish({ name: 'auto-release', rollout: 50 });
510
- }
511
- }
512
- ]
536
+ },
537
+ },
538
+ ],
513
539
  });
514
540
 
515
541
  // Execute workflow
@@ -523,50 +549,49 @@ import { moduleManager } from 'react-native-update-cli';
523
549
 
524
550
  class ReactNativeUpdateService {
525
551
  private provider = moduleManager.getProvider();
526
-
552
+
527
553
  async initialize() {
528
554
  // Load session
529
555
  await this.provider.loadSession();
530
556
  }
531
-
557
+
532
558
  async buildAndDeploy(platform: Platform, version: string) {
533
559
  try {
534
560
  // 1. Bundle
535
561
  const bundleResult = await this.provider.bundle({
536
562
  platform,
537
563
  dev: false,
538
- sourcemap: true
564
+ sourcemap: true,
539
565
  });
540
-
566
+
541
567
  if (!bundleResult.success) {
542
568
  throw new Error(`Bundle failed: ${bundleResult.error}`);
543
569
  }
544
-
570
+
545
571
  // 2. Publish
546
572
  const publishResult = await this.provider.publish({
547
573
  name: version,
548
574
  description: `Release ${version}`,
549
- rollout: 100
575
+ rollout: 100,
550
576
  });
551
-
577
+
552
578
  if (!publishResult.success) {
553
579
  throw new Error(`Publish failed: ${publishResult.error}`);
554
580
  }
555
-
581
+
556
582
  return { success: true, data: publishResult.data };
557
-
558
583
  } catch (error) {
559
- return {
560
- success: false,
561
- error: error instanceof Error ? error.message : 'Unknown error'
584
+ return {
585
+ success: false,
586
+ error: error instanceof Error ? error.message : 'Unknown error',
562
587
  };
563
588
  }
564
589
  }
565
-
590
+
566
591
  async getAppInfo(platform: Platform) {
567
592
  const { appId } = await this.provider.getSelectedApp(platform);
568
593
  const versions = await this.provider.listVersions(appId);
569
-
594
+
570
595
  return { appId, versions };
571
596
  }
572
597
  }
@@ -575,4 +600,4 @@ class ReactNativeUpdateService {
575
600
  const service = new ReactNativeUpdateService();
576
601
  await service.initialize();
577
602
  await service.buildAndDeploy('ios', 'v1.0.0');
578
- ```
603
+ ```