androidreact-nativecode-pushreact-native-code-push

How to determine if native apk / JS bundle has to be created for apps with RN >=0.60


I have been using code-push in production for more than 2 years.

How I implemented?

In the latest RN version >=0.60, we have auto-linking of native modules. Because of this, I am not able to identify if any library newly added requires a native APK to be generated or just a bundle update.

Please provide suggestion how can this be done?

Environment

react-native-code-push version: 6.0.0

react-native version: 0.61.4


Solution

  • For all those people who have similar needs. Here's what I did.

    Here's help on how to do conditional pipelines on Circle CI. https://medium.com/labs42/monorepo-with-circleci-conditional-workflows-69e65d3f1bd0

    FILES_CHANGED=`git diff --name-only $1 $2 | grep "android/\|ios/"`
    
    PARAMETERS='"trigger": false,'
    if [[ $FILES_CHANGED == '' ]]; then
      PARAMETERS+='"js": true'
      echo "JS Code changes detected..."
    else 
      PARAMETERS+='"native": true'
      echo "Native Code changes detected..."
    fi
    

    Above snippet of shell code helps check the files changed.