react-native-3rddigital-appupdate 1.0.12 → 1.0.13

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/bundle.js +28 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-3rddigital-appupdate",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "A React Native library for seamless over-the-air (OTA) updates with version checks, automatic bundle download, and customizable user prompts for iOS and Android.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
package/scripts/bundle.js CHANGED
@@ -580,10 +580,16 @@ function getIosTargetMetadata() {
580
580
  })
581
581
  .filter(Boolean);
582
582
 
583
+ const uniqueTargets = targets.filter(
584
+ (target, index, allTargets) =>
585
+ allTargets.findIndex((candidate) => candidate.name === target.name) ===
586
+ index
587
+ );
588
+
583
589
  return {
584
590
  projectFiles,
585
- defaultConfig: targets[0] ?? null,
586
- targets,
591
+ defaultConfig: uniqueTargets[0] ?? null,
592
+ targets: uniqueTargets,
587
593
  };
588
594
  }
589
595
 
@@ -648,29 +654,35 @@ function getIosSchemeMetadata() {
648
654
  })
649
655
  .filter(Boolean);
650
656
 
651
- if (!schemes.length) {
657
+ const schemesByTargetName = new Map(
658
+ schemes.map((scheme) => [scheme.targetName, scheme])
659
+ );
660
+
661
+ const mergedSchemes = iosMetadata.targets.map((target) => {
662
+ const matchedScheme = schemesByTargetName.get(target.name);
663
+ if (matchedScheme) {
664
+ return matchedScheme;
665
+ }
666
+
652
667
  return {
653
- defaultConfig: iosMetadata.defaultConfig,
654
- schemes: iosMetadata.targets.map((target) => ({
655
- name: target.name,
656
- label: target.label,
657
- targetName: target.name,
658
- buildConfiguration: target.buildConfiguration,
659
- appId: target.appId,
660
- version: target.version,
661
- productName: target.productName,
662
- })),
668
+ name: target.name,
669
+ label: `${target.label}${target.buildConfiguration ? ` [${target.buildConfiguration}]` : ''}`,
670
+ targetName: target.name,
671
+ buildConfiguration: target.buildConfiguration,
672
+ appId: target.appId,
673
+ version: target.version,
674
+ productName: target.productName,
663
675
  };
664
- }
676
+ });
665
677
 
666
- const uniqueSchemes = schemes.filter(
678
+ const uniqueSchemes = mergedSchemes.filter(
667
679
  (scheme, index, allSchemes) =>
668
680
  allSchemes.findIndex((candidate) => candidate.name === scheme.name) ===
669
681
  index
670
682
  );
671
683
 
672
684
  return {
673
- defaultConfig: uniqueSchemes[0],
685
+ defaultConfig: uniqueSchemes[0] ?? iosMetadata.defaultConfig,
674
686
  schemes: uniqueSchemes,
675
687
  };
676
688
  }