From e31c9aacd0417f2357d82ba3623436d549d6b0f7 Mon Sep 17 00:00:00 2001 From: Will Taylor Date: Wed, 29 Apr 2026 17:29:35 -0500 Subject: [PATCH 1/2] Create build.sh --- scripts/build.sh | 103 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100755 scripts/build.sh diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 000000000..2497e33b8 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,103 @@ +#!/usr/bin/env bash + +# Usage: +# scripts/build.sh Build the full SDK stack: JS/web, iOS, and Android. +# scripts/build.sh ios Install JS dependencies and pods, then build JS and the iOS example workspace. +# scripts/build.sh android Install JS dependencies, then build JS and Android. +# scripts/build.sh web Install JS dependencies, then build the web/Expo package. +# +# Valid platforms: ios, android, web. + +set -euo pipefail + +usage() { + echo "Usage: $0 [ios|android|web]" +} + +if [ "$#" -gt 1 ]; then + usage + exit 1 +fi + +platform="${1:-}" + +build_js_sdk() { + yarn build +} + +install_js_dependencies() { + yarn +} + +install_ios_dependencies() { + yarn example pods +} + +build_web_sdk() { + yarn prepare-expo +} + +is_xcpretty_installed() { + command -v xcpretty >/dev/null 2>&1 +} + +compile_ios_sdk_and_purchase_tester() { + if is_xcpretty_installed; then + xcodebuild \ + -workspace examples/purchaseTesterTypescript/ios/PurchaseTester.xcworkspace \ + -scheme PurchaseTester \ + -configuration Debug \ + -sdk iphonesimulator \ + -destination "generic/platform=iOS Simulator" \ + build | xcpretty + else + xcodebuild \ + -workspace examples/purchaseTesterTypescript/ios/PurchaseTester.xcworkspace \ + -scheme PurchaseTester \ + -configuration Debug \ + -sdk iphonesimulator \ + -destination "generic/platform=iOS Simulator" \ + build + fi +} + +compile_android_sdk_and_purchase_tester() { + ( + cd examples/purchaseTesterTypescript/android + ./gradlew :react-native-purchases:assembleDebug + ) +} + +case "$platform" in + "") + echo "About to build the RevenueCat React Native SDK for all platforms." + yarn bootstrap + compile_ios_sdk_and_purchase_tester + compile_android_sdk_and_purchase_tester + ;; + ios) + echo "About to build the RevenueCat React Native SDK for iOS only." + install_js_dependencies + install_ios_dependencies + build_js_sdk + compile_ios_sdk_and_purchase_tester + ;; + android) + echo "About to build the RevenueCat React Native SDK for Android only." + install_js_dependencies + build_js_sdk + compile_android_sdk_and_purchase_tester + ;; + web) + echo "About to build the RevenueCat React Native SDK for web only." + install_js_dependencies + build_web_sdk + ;; + *) + echo "Invalid platform: $platform" + usage + exit 1 + ;; +esac + +echo "Done building the RevenueCat React Native SDK." From 9bbac615301cf00dda3ee425feaeaa8302c50891 Mon Sep 17 00:00:00 2001 From: Will Taylor Date: Wed, 29 Apr 2026 17:52:25 -0500 Subject: [PATCH 2/2] comment copy --- scripts/build.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 2497e33b8..cc637b6d9 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,12 +1,14 @@ #!/usr/bin/env bash +# Builds the React Native SDK. +# # Usage: -# scripts/build.sh Build the full SDK stack: JS/web, iOS, and Android. -# scripts/build.sh ios Install JS dependencies and pods, then build JS and the iOS example workspace. -# scripts/build.sh android Install JS dependencies, then build JS and Android. -# scripts/build.sh web Install JS dependencies, then build the web/Expo package. +# ./build.sh Build the full SDK stack: JS/web, iOS, and Android. +# ./build.sh ios Install JS dependencies and pods, then build JS and the iOS example workspace. +# ./build.sh android Install JS dependencies, then build JS and Android. +# ./build.sh web Install JS dependencies, then build the web/Expo package. # -# Valid platforms: ios, android, web. +# Valid platforms: ios, android, web set -euo pipefail