react-native-bspatch 4.0.0 → 4.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/tools/build_ota.sh +17 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-bspatch",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Premium OTA Update Solution for React Native using TurboModules and bsdiff",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -239,6 +239,20 @@ step_done() {
239
239
  step_line "$1 ${DIM}· $((SECONDS - STEP_START))s${RESET}"; printf "\n"
240
240
  }
241
241
  step_fail() { if [ -t 1 ]; then printf "\n"; fi; } # leave the step line before error output
242
+ # run_logged LOG cmd… — run cmd with output to LOG; in a terminal, tick elapsed time + the log's last line
243
+ run_logged() {
244
+ local LOG="$1"; shift
245
+ "$@" > "$LOG" 2>&1 &
246
+ local PID=$!
247
+ if [ -t 1 ]; then
248
+ while kill -0 "$PID" 2>/dev/null; do
249
+ local LAST=$(tail -n 1 "$LOG" 2>/dev/null | tr -d '\r\033' | cut -c1-50)
250
+ step_progress "$((SECONDS - STEP_START))s${LAST:+ · $LAST}"
251
+ sleep 1
252
+ done
253
+ fi
254
+ wait "$PID"
255
+ }
242
256
  export -f human_size file_size
243
257
 
244
258
  # ── Release version (native app version the OTA targets) ─────────────────────
@@ -369,14 +383,14 @@ build_platform() {
369
383
  if [ "$PLATFORM" == "android" ]; then
370
384
  step "Bundle JS"
371
385
  # Gradle's config noise goes to a log; shown only on failure
372
- if ! (cd "$ROOT/android" && ./gradlew ":app:createBundle${FLAVOR_CAP}ReleaseJsAndAssets" -Pkotlin.incremental=false --quiet) > "$BUILD_LOG" 2>&1; then
386
+ if ! run_logged "$BUILD_LOG" bash -c 'cd "$1/android" && ./gradlew ":app:createBundle${2}ReleaseJsAndAssets" -Pkotlin.incremental=false --quiet' _ "$ROOT" "$FLAVOR_CAP"; then
373
387
  step_fail; tail -n 40 "$BUILD_LOG"; echo " ❌ Gradle bundle failed (full log: $BUILD_LOG)"; exit 1
374
388
  fi
375
389
  BUNDLE_SOURCE="$ROOT/android/app/build/generated/assets/react/${FLAVOR_LOWER}Release/index.android.bundle"
376
390
  else
377
391
  step "Bundle JS"
378
- if ! npx react-native bundle --platform ios --dev false --entry-file index.js \
379
- --bundle-output "$WORKSPACE/source.bundle" --assets-dest "$OUTPUT/assets" > "$BUILD_LOG" 2>&1; then
392
+ if ! run_logged "$BUILD_LOG" npx react-native bundle --platform ios --dev false --entry-file index.js \
393
+ --bundle-output "$WORKSPACE/source.bundle" --assets-dest "$OUTPUT/assets"; then
380
394
  step_fail; tail -n 40 "$BUILD_LOG"; echo " ❌ Bundle failed (full log: $BUILD_LOG)"; exit 1
381
395
  fi
382
396
  BUNDLE_SOURCE="$WORKSPACE/source.bundle"