react-native-bspatch 3.0.1 → 3.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-bspatch",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
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",
@@ -98,16 +98,18 @@ if [ "$ACTION" = "setup" ]; then
98
98
  fi
99
99
 
100
100
  # ── Build environment ──────────────────────────────────────────────────────
101
- echo "Preparing build environment..."
102
- # Kill any existing Metro processes to prevent file locks
103
- pkill -f "react-native/local-cli/cli.js" || true
104
- pkill -f "metro-config/src/index.js" || true
105
-
106
- # Manually clear metro cache if it exists (robust vs ENOTEMPTY error)
107
- METRO_CACHE_DIR=$(node -e "console.log(require('os').tmpdir())")/metro-cache
108
- if [ -d "$METRO_CACHE_DIR" ]; then
109
- echo " Cleaning Metro cache..."
110
- rm -rf "$METRO_CACHE_DIR"
101
+ if [ "$ACTION" = "ota" ]; then
102
+ echo "Preparing build environment..."
103
+ # Kill any existing Metro processes to prevent file locks
104
+ pkill -f "react-native/local-cli/cli.js" || true
105
+ pkill -f "metro-config/src/index.js" || true
106
+
107
+ # Manually clear metro cache if it exists (robust vs ENOTEMPTY error)
108
+ METRO_CACHE_DIR=$(node -e "console.log(require('os').tmpdir())")/metro-cache
109
+ if [ -d "$METRO_CACHE_DIR" ]; then
110
+ echo " Cleaning Metro cache..."
111
+ rm -rf "$METRO_CACHE_DIR"
112
+ fi
111
113
  fi
112
114
 
113
115
  mkdir -p "$ROOT/android/output"
@@ -123,8 +125,7 @@ if [ "$ACTION" != "setup" ]; then
123
125
  BASE_URL="${OTA_BASE_URL:-}"
124
126
  BASE_FOLDER="${OTA_FOLDER:-ota}"
125
127
 
126
- echo " Using URL: $BASE_URL"
127
- echo " Using Folder: $BASE_FOLDER"
128
+ echo " Storage: ${OTA_R2_BUCKET:+R2 $OTA_R2_BUCKET → }$BASE_URL/$BASE_FOLDER"
128
129
 
129
130
  if [[ -n "${OTA_R2_BUCKET:-}" ]]; then
130
131
  R2_URL="https://${OTA_R2_ACCOUNT_ID:?set OTA_R2_ACCOUNT_ID}.r2.cloudflarestorage.com/${OTA_R2_BUCKET}"
@@ -234,7 +235,9 @@ fi
234
235
  # Confirm in a terminal (Enter keeps the detected version); CI / -y / --release-version skip it
235
236
  if [ -t 0 ] && [ "$CONFIRM_VERSION" = true ] && [ -z "$APP_VERSION_ARG" ]; then
236
237
  echo ""
237
- read -r -p " Release version for ${PLATFORM_ARG:-android + ios} [${APP_VERSION:-none detected}]: " INPUT_VERSION
238
+ if [ "$ACTION" = "reset" ]; then PROMPT_WHAT="Release version to RESET ($FLAVOR_LOWER, android + ios)"
239
+ else PROMPT_WHAT="Release version for ${PLATFORM_ARG:-android + ios} ($FLAVOR_LOWER)"; fi
240
+ read -r -p " $PROMPT_WHAT [${APP_VERSION:-none detected}]: " INPUT_VERSION
238
241
  INPUT_VERSION="${INPUT_VERSION// /}"
239
242
  APP_VERSION="${INPUT_VERSION:-$APP_VERSION}"
240
243
  fi
@@ -10,7 +10,7 @@
10
10
  ROOT_DIR=$(pwd)
11
11
 
12
12
  BASE_URL="${OTA_BASE_URL:-}"
13
- BASE_FOLDER="${OTA_FOLDER:-${6:-ota}}"
13
+ BASE_FOLDER="${OTA_FOLDER:-ota}"
14
14
  APP_VERSION="$1"
15
15
  CHANNEL="$2"
16
16
  OTA_VERSION="$3"
@@ -26,7 +26,7 @@ fi
26
26
 
27
27
  # Validate
28
28
  if [[ -z "$APP_VERSION" || -z "$OTA_VERSION" ]]; then
29
- echo "Usage: $0 <app_version> <channel> <ota_version> <bundle_path> [platform] [base_folder]"
29
+ echo "Usage: $0 <app_version> <channel> <ota_version> <bundle_path> [platform] [--clean-remote]"
30
30
  exit 1
31
31
  fi
32
32
  if [[ ! -f "$REGISTRY_FILE" ]]; then
@@ -67,11 +67,15 @@ if [[ -n "${OTA_R2_BUCKET:-}" ]]; then
67
67
 
68
68
  echo " → Cloudflare R2: $OTA_R2_BUCKET/$RELEASE_PREFIX"
69
69
  if [ "$CLEAN_REMOTE" = true ]; then
70
- echo " Deleting $RELEASE_PREFIX/ ..."
70
+ echo " Deleting $RELEASE_PREFIX/ ..."
71
71
  # ponytail: one ListObjectsV2 page (1000 keys); a release+channel holds far fewer
72
- for KEY in $(r2 -f "$R2_URL?list-type=2&prefix=$RELEASE_PREFIX/" | grep -o '<Key>[^<]*</Key>' | sed 's/<[^>]*>//g'); do
73
- r2 -f -X DELETE "$R2_URL/$KEY" -o /dev/null && echo " ✗ $KEY"
72
+ LISTING=$(r2 -f "$R2_URL?list-type=2&prefix=$RELEASE_PREFIX/") || { echo " ❌ Listing $RELEASE_PREFIX/ failed"; exit 1; }
73
+ DELETED=0
74
+ for KEY in $(echo "$LISTING" | grep -o '<Key>[^<]*</Key>' | sed 's/<[^>]*>//g'); do
75
+ r2 -f -X DELETE "$R2_URL/$KEY" -o /dev/null || { echo " ❌ Delete failed: $KEY"; exit 1; }
76
+ echo " ✗ $KEY"; DELETED=$((DELETED + 1))
74
77
  done
78
+ echo " ✓ $DELETED object(s) deleted"
75
79
  else
76
80
  # Only this version's files: earlier bundles/patches are already uploaded and never change
77
81
  RELEASE_FILES=()