react-native-bspatch 1.0.9 → 1.1.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.
Files changed (35) hide show
  1. package/README.md +18 -0
  2. package/lib/commonjs/ota/OtaProvider.js +27 -4
  3. package/lib/commonjs/ota/OtaProvider.js.map +1 -1
  4. package/lib/commonjs/ota/otaAssetResolver.js +14 -4
  5. package/lib/commonjs/ota/otaAssetResolver.js.map +1 -1
  6. package/lib/commonjs/ota/otaCore.js +4 -0
  7. package/lib/commonjs/ota/otaCore.js.map +1 -1
  8. package/lib/commonjs/ota/otaMetadata.js +3 -0
  9. package/lib/commonjs/ota/otaMetadata.js.map +1 -1
  10. package/lib/commonjs/ota/types.js.map +1 -1
  11. package/lib/module/ota/OtaProvider.js +27 -4
  12. package/lib/module/ota/OtaProvider.js.map +1 -1
  13. package/lib/module/ota/otaAssetResolver.js +14 -4
  14. package/lib/module/ota/otaAssetResolver.js.map +1 -1
  15. package/lib/module/ota/otaCore.js +4 -0
  16. package/lib/module/ota/otaCore.js.map +1 -1
  17. package/lib/module/ota/otaMetadata.js +3 -0
  18. package/lib/module/ota/otaMetadata.js.map +1 -1
  19. package/lib/module/ota/types.js.map +1 -1
  20. package/lib/typescript/ota/OtaProvider.d.ts.map +1 -1
  21. package/lib/typescript/ota/otaAssetResolver.d.ts.map +1 -1
  22. package/lib/typescript/ota/otaCore.d.ts.map +1 -1
  23. package/lib/typescript/ota/otaMetadata.d.ts.map +1 -1
  24. package/lib/typescript/ota/types.d.ts +5 -0
  25. package/lib/typescript/ota/types.d.ts.map +1 -1
  26. package/package.json +1 -1
  27. package/src/ota/OtaProvider.tsx +34 -4
  28. package/src/ota/otaAssetResolver.ts +15 -5
  29. package/src/ota/otaCore.ts +8 -0
  30. package/src/ota/otaMetadata.ts +4 -0
  31. package/src/ota/types.ts +5 -0
  32. package/tools/build_ota.sh +2 -3
  33. package/tools/setup_project.js +45 -12
  34. package/tools/update_registry.js +0 -47
  35. package/tools/upload_ota_custom.sh +9 -0
@@ -96,50 +96,3 @@ fs.writeFileSync(registryPath, JSON.stringify(registry, null, 2) + '\n');
96
96
  console.log(
97
97
  ` ✓ Registry updated | App: ${appVersion} | Flavor: ${flavor} | latestOta: ${toOtaVersion}`,
98
98
  );
99
-
100
- // ── Regenerate otaPatches.generated.ts ──────────────────────────────────────
101
- // Flatten all patches from all apps and flavors into the TS file
102
- const allPatches = [];
103
- for (const ver in registry.apps) {
104
- const app = registry.apps[ver];
105
- if (app.flavors) {
106
- for (const f in app.flavors) {
107
- allPatches.push(...app.flavors[f].patches);
108
- }
109
- }
110
- }
111
-
112
- const patchLines = allPatches
113
- .map(p => {
114
- const fields = [
115
- `id: '${p.id}'`,
116
- `label: '${p.label}'`,
117
- `appVersion: '${p.appVersion}'`,
118
- `filename: '${p.filename}'`,
119
- `fromVersion: ${p.fromVersion}`,
120
- `toVersion: ${p.toVersion}`,
121
- `platform: '${p.platform || 'android'}'`,
122
- ];
123
- if (p.baseHash) fields.push(`baseHash: '${p.baseHash}'`);
124
- if (p.bundleHash) fields.push(`bundleHash: '${p.bundleHash}'`);
125
- if (p.fullBundleUrl) fields.push(`fullBundleUrl: '${p.fullBundleUrl}'`);
126
- if (p.assetManifestUrl) fields.push(`assetManifestUrl: '${p.assetManifestUrl}'`);
127
- // Add flavor for runtime filtering if needed
128
- fields.push(`flavor: '${p.flavor || ''}'`);
129
-
130
- return ` { ${fields.join(', ')} },`;
131
- })
132
- .join('\n');
133
-
134
- const tsContent = `// AUTO-GENERATED by build_ota.sh — do not edit manually
135
- import type { OtaPatch } from 'react-native-bspatch';
136
-
137
- export const OTA_PATCHES: OtaPatch[] = [
138
- ${patchLines}
139
- ];
140
- `;
141
-
142
- fs.writeFileSync(generatedPath, tsContent);
143
- console.log(
144
- ` ✓ otaPatches.generated.ts updated (${allPatches.length} total patches across all flavors)`,
145
- );
@@ -107,6 +107,15 @@ if [[ "$BASE_URL" == *"github"* ]] || [[ "$BASE_URL" == *"raw.githubusercontent"
107
107
  for FILE in "$OUTPUT_DIR"/*_${CHANNEL}.json "$OUTPUT_DIR"/*_${CHANNEL}.hbc "$OUTPUT_DIR"/*_${CHANNEL}_*.patch "$OUTPUT_DIR"/*_${CHANNEL}.patch; do
108
108
  [[ -f "$FILE" ]] || continue
109
109
  FNAME=$(basename "$FILE")
110
+ if [[ "$FNAME" == "patch_"* ]] || [[ "$FNAME" == "bundle_"* ]]; then
111
+ if [[ "$FNAME" != *"_${APP_VERSION}_"* ]]; then
112
+ continue
113
+ fi
114
+ fi
115
+
116
+ if [[ "$FNAME" != *"_${APP_VERSION}_"* ]] && [[ "$FNAME" != *"_${CHANNEL}_"* ]] && [[ "$FNAME" != "asset-manifest"* ]] && [[ "$FNAME" != "base-assets"* ]]; then
117
+ continue
118
+ fi
110
119
  cp "$FILE" "$TARGET_RELEASE_DIR/$FNAME"
111
120
  done
112
121