- This guide is was created with a Apple Mac. If you have a windows machine, terminal commands may be different.
- Please use
yarn
to install packages. - A reference to all the package.json scripts are at the bottom of this document.
- Getting Started
- Quick Start!
- Create icon and splash screen graphics for app
- IOS - Setup local environment for builds and E2E testing
- Android - Setup local environment for builds and E2E testing
- Setup Android emulator for development builds
- Tests - CI/CD
- Android Internal Testing set-up
- Known issues
- Package.json script definitions
- View UI components in isolation
- Setting up Clerk Auth for Production
- General trouble shooting
- de-bug production IOS app
- de-bug production Android app
Note: You must have Xcode and Android studio installed on your machine. The links below provide the Expo instructions.
install EAS client globally
npm install --global eas-cli
After you have installed the tools above then run the commands below.
yarn install
yarn start
Download the figma template, use the guide to help you if necessary. Once you have created your icons replace the icons in the assets
folder with your own.
Replace your the images in the /assets
folder with your new images.
IOS - Setup local environment for builds and E2E testing (MAC) {#ios-setup-local-environment-for-builds-and-e2e-testing-mac}
Before you try to build the IOS app on your machines infrastructure you must have the following packages installed on your machine.
We may need to create the same environment as the EAS build environment which runs on the following package versions. You can try to start a build without these versions but if you run into issues you may need to install these versions.
- Xcode 14.2 (14C18)
- Node.js 16.18.1
- npm 8.1.2
- fastlane 2.211.0
- CocoaPods 1.11.3
- Ruby 2.7
- Expo CLI 6.0.0
-
Xcode Install Xcode
-
Cocopods
sudo gem install cocoapods
3. Fastlane
```bash
sudo gem install fastlane -NV
- Maestro (E2E Testing)
Follow the documentation and install all the dependencies for maestro.
add this to your .zshrc
or .bashrc
files.
export PATH=$PATH:$HOME/.maestro/bin
If you run yarn local-dev-i
and you get an error like this error: The sandbox is not in sync with the Podfile.lock...
or if you run into an issue concerning SocketRocket
run this command pod repo update
or pod install --repo-update
You will get some feedback in the terminal which may ask you to run something like this gem pristine ffi --version 1.15.5
, run it. and that should fix the error.
- Now attempt to run
yarn local-dev-i
to build the IOS app with expo dev client.
We need to build an app with dev client enabled so we can e2e test with maestro while live coding.
If you run into a credential issue while running yarn local-dev-i
check this out and update your keychain apple credentials.
-
Once the
yarn local-dev-i
command is complete you will get a.tar.gz
file. The path for the file will be displayed in your terminal. Unzip it, and drag the .app file into your IOS emulator. It will install. You can also install this app on a physical device via itunes. -
Now you can run
yarn dev
and run the development build (the build you just created).
we use yarn dev
instead of yarn start
so we run tests while we code using maestro. Testing only works on IOS simulator as of 1/5/2023
yarn dev
- Once the expo dev-client server is running on your IOS simulator you can run
yarn cosmos
, This will allow you to open cosmos playground at http://localhost:500\* and view components in isolation. The URL will appear in the terminal.
yarn cosmos
Note: to run yarn dev
you need to have built a development build via yarn local-dev-a
and installed the build on the simulator or physical device.
Open a new terminal; If you want to run tests while you develop you must run yarn dev
NOT yarn start
. This will start a dev-client-sever allowing maestro to orchestrate tests against the app.
cd into the app root directory and run the example test file to see this in action yarn t
. The test should run in your terminal and should pass.
yarn t
to run all tests in the tests
folder at the same time run yarn test
yarn test
With the help of maestro studio you can build tests easily and quickly! Read about maestro studio
yarn studio
Android - Setup local environment for builds and E2E testing (MAC) {#android-setup-local-environment-for-builds-and-e2e-testing}
Note: Depending on your machines current environment state you may need to uninstall your version of Java or Gradle and set paths to the android SDK in your .zshrc
or .bashrc
files.
We may need to create the same environment as the EAS build environment which runs on the following package versions. You can try to start a build without these versions but if you run into issues you may need to install these versions.
- NDK 21.4.7075529
- Node.js 16.18.1
- Java 11
- Expo CLI 6.0.0
- You must have android studio installed on your machine and at least one android emulator installed.
- Check you have the right gradle version installed
gradle -v
If you do not have gradle 7.5.1 uninstall your current version and install gradle via SDKMAN
brew uninstall gradle
- DO THIS BEFORE YOU INSTALL GRADEL! install SDKMAN first!
sdk install gradle 7.5.1
- Now we need to check what Java version you are running on your machine. It's likely that it's not Java 11 which is what we need to build andriod apps locally.
java -version
To uninstall Java correctly you need to download the Java installer run the file and select remove
. This option will uninstall your current version if Java.
- Once it Java is removed you can install the version needed to build. Download the version of Java 11 needed for your MAC machine.
You may need to sign up or oracle for free before you can download the installer.
- Now we must add the paths to the android SDK to your your
.zshrc
or.bashrc
files
copy and paste this code into your file and save
export ANDROID_HOME=~/Library/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
- In your terminal run
source ~/.zshrc
orsource ~/.bashrc
- Finally you can run the command below and see if you can build a android app successfully.
yarn local-dev-a
-
Once the command is finished it will install the app on your emulator and give you a QR code and URL to open the app on a physical android device.
-
Run these commands to start the dev-client-server and cosmos playground.
Now you can run yarn dev
and run the development build.
yarn dev
After the dev-client server is running in your android simulator you can run yarn cosmos
, This will allow you to open cosmos playground at http://localhost:500\* and view components in isolation. The URL will appear in the terminal.
yarn cosmos
Note: to run yarn dev
you need to have built a development build via yarn local-dev-a
and installed the build on the simulator or physical device.
Open a new terminal; If you want to run tests while you develop you must run yarn dev
NOT yarn start
. This will start a dev-client-sever allowing maestro to orchestrate tests against the app.
cd into the app root directory and run the example test file to see this in action yarn t
. The test should run in your terminal and should pass.
yarn t
to run all tests in the tests
folder at the same time run yarn test
yarn test
With the help of maestro studio you can build tests easily and quickly! Read about maestro studio
yarn studio
- Open Android studio
- Open of virtual devices manager
- Create a new virtual device
- Select a device with the google play store icon
follow this guide if you need more help
TBA Reference: https://cloud.mobile.dev/
to set up internal testing go into your google play store app and enable internal testing for the app.
- If you do not have developer options enabled on your android device you will need to enable them. To do this go to
settings > about phone > software information > tap build number 7 times
. This will enable developer options on your device. - Now go to
settings > developer options > internal app sharing
- Enable internal app sharing and copy the link to the app from Google Play Console
- You need to accept the invite via your phone into the developer program. You can do this by clicking the link in the email you received from google play console.
- Once you have accepted the invite you can open the link in your phone and install the app. To get the link use the
web version
from theinternal test
section, click thetesters
tab and copy the link from the there, remember to access these links from your phone.
- As Cosmos is still in alpha you may encounter a
cannot connect to renderer
error. If you get any errors you can runyarn clean
and thenyarn i
package manager we recommend is yarn
i
: Installs dependenciesstart
: Starts the app via Expo Godev
: Starts the app via Expo Go using the starts the dev-client-serverclean
: Deletes node_modulesdoctor
: Checks for issues with your project and dependenciesstudio
: Opens maestro studio (GUI for building tests)rm-build
: Delete all app builds from file systembuild
: runs the shell scriptbuild.sh
that updates the app version in package.json, creates a versioned git commit, creates a versioned git tag and builds a app store ready app locally for IOS ready for deployment to the app store. (runyarn local-dev-a
) after there script has executed in a different terminal window to build the android app.
local-dev-i
: Builds a development build for iOS using your local machine infrastructurelocal-dev-a
: Builds a development build for Android using your local machine infrastructurelocal-prod-i
: Builds a production build for iOS using your local machine infrastructurelocal-prod-a
: Builds a production build for Android using your local machine infrastructurelocal-app-store
: Builds a production build for iOS app store distribution using your local machine infrastructure.local-google-store
: Builds a production build for Android play store distribution using your local machine infrastructure.
prefix these commands with yarn
.
cloud-dev-i
: Builds a development build for iOS using EAS infrastructurecloud-dev-a
: Builds a development build for Android using EAS infrastructurecloud-prod-i
: Builds a production build for iOS using EAS infrastructurecloud-prod-a
: Builds a production build for Android using EAS infrastructurecloud-app-store
: Builds a production build for iOS app store distribution using EAS infrastructure.cloud-google-store
: Builds a production build for Android play store distribution using EAS infrastructure.
submit
commands require you to have a build already built and ready to submit in EAS cloud.
(you need to have a build already in EAS services to use these commands)
submit-i
: Submits a production build for iOS app store distribution using EAS infrastructure.submit-a
: Submits a production build for Android play store distribution using EAS infrastructure.submit-all
: Submits a production build for iOS and Android app store distribution using EAS infrastructure.
(creates builds using cloud services and submits to app stores automatically)
deploy-i
: Build IOS app and submit to app storedeploy-a
: Build Android app and submit to play store
test:
Runs all tests in the tests foldert
: Runs the example test file in the tests folderwatch-fix
: Fixes any issues with the watchman package
cosmos
: Runs cosmos playground (view components in isolation)
You need to generate a service account to use the submit-a
and submit-all
commands.
- Follow the setup guide for expo
- Login to your Clerk account and go to the
social connections
tab and set up your auth as you want. - Click the
sessions
tab and add these toredirect URLs
acme://oauth-callback
acme://oauth-native-callback
acme://oauth-native-callback#
exp://192.168.1.1/oauth-callback
These will allow you to use the production setup in the the dev-client-server and in production.
yarn watch-fix
watchman shutdown-server
and restart your server.
- yarn remove
@react-native-async-storage/async-storage
- yarn remove cache
- yarn clean
- yarn add
@react-native-async-storage/async-storage
- delete development build and create a new one
- run app
- Open mac's
console
app - Connect your phone to your computer
- Open the app on your phone
- In the
console
app, search for your apps process name in to focus in on the apps activity. - start debugging.
- Make sure you have
developer options
enabled and enable "USB Debugging" - run while your phone is connected to your computer
adb devices
- run
adb logcat
to see the logs from your phone as you interact with the app. - start debugging.
npm install -g i18nexus-cli
yarn translations
(You do not have to run this, unless you are working with translations or need to re-download them)