NOTE: If you have issues with any of the set up, check the Troubleshooting section.
Before anything else, request access to the Club Murray Organisation on GitHub. This can be requested from Owners on this list - you may need another ANDi on the project to access this list on GitHub for you so you know who to ask to grant you access.
Follow the steps on the React Native docs to get setup. You want to follow the 'Installing dependencies' instructions under the React Native CLI Quickstart tab for both iOS and Android.
and-murray
org some of these values can be found in the org variables.
MURRAY_APPS_DEV_REACT_APP_FIREBASE_FUNCTIONS_BASE_URL
MURRAY_APPS_DEV
or MURRAY_APPS_PROD
refers to the environment.REACT_APP_FIREBASE_FUNCTIONS_BASE_URL
refers to the key part. This will match one of the keys in .env.template.env.production
.env.development
yarn install
. We're using yarn in this project instead of npm, so you should not be using npm to execute any commands.
cd ios
) and perform bundle install
rvm install y
followed by rvm use y
, then retry the bundle install
.bundle exec pod install
bundle exec pod install --repo-update
/Library/Application\ Support/Netskope/STAgent/data/nscacert.pem
yarn android:debug:dev
yarn ios:debug:dev
We use match to manage certificates & profiles for running on devices.
gcloud auth application-default
if credentials have expired.yarn ios:setup
to install the certificates.yarn ios:qa:distribute
to deploy your current branch (usually develop or main) to the firebase distribution. This only needs to be done for iOS because Android is handled by the CI and so are the functions.On iOS we have one Scheme but multiple build configurations:
These are a combination of the build settings (Debug & Release) and the backend environment that they hit. The
GoogleService-Info-Dev.plist
& GoogleService-Info-Prod.plist
are stored in ios/Firebase
. A build phase script pulls out the correct one based on the configuration and renames it correctly.
On Android there are the following build variants:
The above are combinations of productFlavours
and buildTypes
.
productFlavours
These are for separate Firebase instances, keeping data separate for each backend.
google-services.json
files are in separate folders for each flavour: android/app/src/development/google-services.json
& android/app/src/production/google-services.json
buildTypes
These are for different types of builds, the release type is optimised and doesn't have any debugging or developer features.
This is all configured from android/app/build.gradle
.
See the Firebase docs for the most up to date instructions.
yarn install
will ensure the cli is installed as it is in the package.json This guide has the most up to date commandsfirebase setup:emulators:firestore
. See this for more up to date setup if required.firebase emulators:start --only firestore --import=EmulatorData --export-on-exit=EmulatorData
.
~/.cache/firebase/emulators/
. Delete the Ui folder ui-v1.11.5
and unzip the zipped version and rerun.Database.ts
for more on this.firebase login
to login. If required.firebase deploy --only firestore:rules
will deploy the rules in the project.firebase functions:shell
you can then run the function by running functionName()
. See hereREACT_APP_USE_EMULATORS
flag in src/util/FirebaseUtils/FirebaseUtils.ts
to true to enable emulation of firebase functions.yarn emulateFirebase:dev
/ emulateFirebase:prod
for just enabling the functions emulation, or firebase use development
/ firebase use production
& firebase emulators:start --import=EmulatorData --export-on-exit=EmulatorData
for use of the emulated firestore as well.There is also an adminsdk json file that contains the secrets that allow admin access for the sdk to do this. This file is generated from the project settings within firebase and should not be shared publicly. Ideally this file would be stored on gitlab CI and not in version control but it is not currently possible to do that and should be done as soon as it is possible.
cd functions
and then yarn install
.yarn build
yarn test-functions
yarn test
We use fastlane lanes for this - Read the guide here
yarn react-native doctor
first, it will guide you/automatically find and fix common react-native issues for you.env /usr/bin/arch -arm64 /bin/zsh --login
. If any of the steps with ruby or bundler fail, try prefixing them with arch -arm64
(e.g. arch -arm64 bundle install
)Failed to launch emulator. Reason: No emulators found as an output of emulator -list-avds
OR
error Failed to install the app. Make sure you have the Android...
yarn react-native doctor
. If this doesn't report Android issues, you may have an issue elsewhere...which yarn
to get the path for Yarn, and then replace the _YARN_GLOBALPATH in the following and run set -U fish_user_paths YARN_GLOBAL_PATH $fish_user_paths
.rvm install X.X.X
rvm use X.X.X
(where X.X.X is the version quoted in the error message)yarn clean-caches
. If it's still not working, you can try deleting node_modules
and running yarn install
.Watchman crawl failed
Seems like Watchman wants to be uninstalled and reinstalled, try the following:
brew uninstall watchman
brew install watchman
watchman shutdown-server # (just in case it's running)
watchman watch-del-all
yarn start --reset-cache