Skip to content

Commit

Permalink
fix: expo managed project detection
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorJohn committed Jul 25, 2024
1 parent b4d4c80 commit ea6a1e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
5 changes: 2 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ project.ext {

apply from: file("./app-json.gradle")

def rootPackageJson = PackageJson.getForProject(rootProject)
def isExpoProject = rootPackageJson['dependencies'].containsKey('expo')
def isManagedExpoProject = !rootProject.file("android").exists() && !rootProject.file("ios").exists()
def appJSONGoogleMobileAdsAppIDString = ""
def appJSONGoogleMobileAdsDelayAppMeasurementInitBool = false
def appJSONGoogleMobileAdsOptimizeInitializationBool = true
Expand All @@ -88,7 +87,7 @@ if (rootProject.ext.has("googleMobileAdsJson")) {
appJSONGoogleMobileAdsOptimizeAdLoadingBool = rootProject.ext.googleMobileAdsJson.isFlagEnabled("optimize_ad_loading", true)
}

if (!appJSONGoogleMobileAdsAppIDString && !isExpoProject) {
if (!appJSONGoogleMobileAdsAppIDString && !isManagedExpoProject) {
println "\n\n\n"
println "**************************************************************************************************************"
println "\n\n\n"
Expand Down
9 changes: 3 additions & 6 deletions ios_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,9 @@ while true; do
_CURRENT_LOOKUPS=$((_CURRENT_LOOKUPS+1))
done

# Bail out if project is using Expo
_PACKAGE_JSON_PATH=$(dirname "${_SEARCH_RESULT}")/${_PACKAGE_JSON_NAME}
_IS_PROJECT_USING_EXPO=$(ruby -KU -e "require 'json'; package=JSON.parse(File.read('${_PACKAGE_JSON_PATH}')); puts package['dependencies'].key?('expo')")

if [[ ${_IS_PROJECT_USING_EXPO} == "true" ]]; then
echo "info: Expo project detected, assume Expo Config Plugin is used."
# Bail out if project is a managed Expo project:
if [[ ! -d "${PROJECT_DIR}/ios" ]] && [[ ! -d "${PROJECT_DIR}/android" ]]; then
echo "info: Project does not contain an ios or android folder, assume it's a managed Expo project using our Expo Config Plugin."
exit 0
fi

Expand Down

0 comments on commit ea6a1e0

Please sign in to comment.