Files
Detox/scripts/demo-projects.sh
T
mark.devandGitHub f8f0b0cc02 Detox with RN0.85.2 support (#4936)
* initial commit for 0.85.0-rc.7

* RN 0.85.2 update

* CI pipeline for RN085.2

* config update

* updated config

* update for ios 0.84

* iOS on RN0.84

* RN084 update

* pinned to RN085.2

* update for rn084

* cleanup
2026-05-05 09:35:29 +03:00

48 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
source $(dirname "$0")/logger.sh
source $(dirname "$0")/install.sh
extract_minor_version() {
local version="$1"
version="${version#^}"
version="${version#~}"
version="${version#>=}"
version="${version#<=}"
version="${version#>}"
version="${version#<}"
echo "$version" | awk -F. '{print $2}'
}
clear_ios_pod_state_for_rn_downgrade() {
rm -f detox/test/ios/Podfile.lock examples/demo-react-native/ios/Podfile.lock
rm -rf detox/test/ios/Pods examples/demo-react-native/ios/Pods
}
if [ -z "$REACT_NATIVE_VERSION" ]; then
echo "Error: REACT_NATIVE_VERSION variable was not defined!"
exit 1
fi
current_rn_version=$(node -e "console.log(require('./detox/test/package.json').dependencies['react-native'])")
current_minor=$(extract_minor_version "${current_rn_version}")
target_minor=$(extract_minor_version "${REACT_NATIVE_VERSION}")
if [[ "${current_minor}" =~ ^[0-9]+$ ]] && [[ "${target_minor}" =~ ^[0-9]+$ ]] && [ "${current_minor}" -gt "${target_minor}" ]; then
echo "Detected RN downgrade (${current_rn_version} -> ${REACT_NATIVE_VERSION}), clearing iOS pod state"
clear_ios_pod_state_for_rn_downgrade
fi
if [ "$REACT_NATIVE_COMPAT_TEST" != "true" ]; then
node scripts/change_react_native_version.js "detox" ${REACT_NATIVE_VERSION} "devDependencies"
fi
# Update the dependencies of the test project
node scripts/change_react_native_version.js "detox/test" ${REACT_NATIVE_VERSION} "dependencies"
# Only update the demo-react-native project; others will use this binary
node scripts/change_react_native_version.js "examples/demo-react-native" ${REACT_NATIVE_VERSION} "dependencies"
# Update lockfile for new RN version
run_f "yarn install --mode update-lockfile"
run_f "yarn install"