Skip to content

Latest commit

 

History

History
288 lines (181 loc) · 9.07 KB

getting_started.md

File metadata and controls

288 lines (181 loc) · 9.07 KB

Getting Started

It is recommended to follow the steps for a fresh environment setup from the react native docs depending on the version that you are aiming to develop for.

Prerequisites

You'll need homebrew asdf, Yarn and Watchman installed (brew install watchman).

Setting up asdf

There are instructions here: https://asdf-vm.com/guide/getting-started.html You will want the java, nodejs, and ruby plugins to get all of our tooling.

brew install asdf
# configure your shell setup scripts for your shell, see asdfs instructions on the site
asdf plugin add ruby
asdf plugin add nodejs
asdf plugin add java

Set up iOS

Download Xcode version 16. You can find all available versions of Xcode at Apple's Developer Portal 🔐.

Ask your mentor to add you on the firebase.console to be able to release.

NOTE: After installing Xcode

Check that Command Line Tools version is added in the Locations tab. Xcode>Settings>Locations: command-line-tools

Set up Android

Important

We use asdf for managing java, you can skip the section in the docs below around the Java Development Kit. Instead do:

asdf install in the eigen directory.

then set JAVA_HOME in you shell config (e.g. .zshrc) to the asdf java install path.

find that path by running:

asdf where java

and then add to your shell config:

export JAVA_HOME="<YOUR-ASDF-JAVA-PATH-HERE>"

  1. Android development environment: Follow the official docs. Select "React Native CLI Quickstart" tab

  2. Create a virtual device on which to run the Android app.

Run Eigen

Get eigen

git clone https://github.com/artsy/eigen.git
cd eigen

Install the dependencies

Work at Artsy?
  1. Run
asdf install
yarn setup:artsy
yarn install:all
yarn relay

You will need awscli to get our ENV vars.

Independent Contributor?

Set up awscli

You will need awscli to get our font files. You can configure it with a personal user account.

Set up your env file and download assets:

yarn setup:oss # this is `yarn setup:artsy` if you're working at Artsy

Get a mapbox token and set it in .env.shared:

You can create an account on mapbox and get a token with their free tier:

Follow the instructions here: https://docs.mapbox.com/ios/maps/guides/install.

Add the token to .env.shared as MAPBOX_DOWNLOAD_TOKEN

Install dependencies and generate relay files:

yarn install:all
yarn relay

Known limitations

Some third party services will not function when working as an open source contributor including but not limited to Braze, Unleash, Sentry and Google Sign In. The conversations tab and related features are also inaccessible. Thanks for supporting open source!

Note: yarn pod-install (which is included in yarn install:all) may fail the first time you run it (due to a bug in a dependency of ours). Re-running the command should work.

Troubleshooting

If there are issues setting up the app, see the troubleshooting doc.

Contribute

We welcome independent contributions! Feel free to open an issue and open a PR and assign one of Brian Beckerle, George Kartalis, Mounir Dhahri as a reviewer or anyone else listed here.

If you work at Artsy you can find a ticket on CX backlog 🔐 and look for a #good-first-issue

Run the app

Start the react-native bundler:

yarn start

Run the iOS app

First, ask for your apple developer account to be added on the project and login with your apple id under settings/accounts/apple Id.

Using Xcode

Open the app in Xcode:

open ios/Artsy.xcworkspace

From Xcode, run the app by hitting Product > Run (or ⌘R). This will start the Artsy app in an iOS simulator, pointed at Artsy's staging environment.

Using terminal

Make sure that you have a simulator running before running the command. In order to do so you can use the yarn open-sim command

yarn ios

Run the Android app

yarn android

This will start the Artsy app in an Android emulator, pointed at Artsy's staging environment.

Wifi setup on Android emulators

In order to have internet access on android emulator you need to add Google's DNS servers to your device's network settings. You can do that by following these steps:

  1. Click Apple menu > System Preferences > Search for DNS.
  2. Click DNS Domains.
  3. Select the DNS tab.
  4. Add 8.8.8.8 and 8.8.4.4
  5. Click OK > Apply.
  6. Restart the emulator with cold boot now. (Android Studio > Device Manager > Three Dots (settings) > Cold Boot Now)

⚠️ You might need to run the last step above after you get setup with Artsy's VPN or if you edit your DNS settings!

Run native tests

We can only run tests in one specific environment, today that is iPhone 12 Pro with the iOS 14.2 Simulator. This is because we use visual snapshots for UI regressions.

Run tests in Xcode

Tap cmd + u to run all tests, use ctrl + alt + cmd + g to run the last set you clicked on via the GUI.

Run tests via command line

You can run tests via the CLI using:

./scripts/ci/test-ios

Certificates

We use Xcode's auto-codesigning. It should magically "just work" if you log in to Xcode with an iTunes account which is on the Artsy team.

We have cert troubleshooting here

Connect a device

iOS

When you connect an iPhone to your machine, Xcode will prompt you to join a team, then to enable the device for development. If you have to choose a team, choose Art.sY Inc..

Android

  1. On your Android device go to Settings > About Phone
  2. Find the 'Build number' menu item and tap it 7 times to enable developer mode.
  3. Now go to Settings > System > Developer Options, and turn on 'USB Debugging'
  4. Connect your device to your computer via USB cable. After a moment the device should show a prompt for you to allow USB debugging for your computer. Press yes.
  5. After that run yarn android from within the eigen directory. This will build the app, install it on your device, and run it.

Read more

Learn about what things are architecturally here, then move to the blog. for more in-depth discussions on Eigen.

Steps To Upgrade react-native to 0.73.9 on your machine:

Upgrading JAVA:

For asdf users:

  1. install the new Java version:
# in the eigen directory
asdf install
  1. Update $JAVA_HOME in your shell config (.zshrc) to the asdf java install path.
  • Open your .zshrc file with the editor of your choice and add the following lines:
. ~/.asdf/plugins/java/set-java-home.zsh
  • Save the file and run source ~/.zshrc to make the changes effective.
  1. Set global java version in your machine (optional):
$ asdf global java zulu-17.50.19

For brew users:

  1. install the new Java version
brew install --cask zulu@17

# Get path to where cask was installed to double-click installer
brew info --cask zulu@17
  1. Update $JAVA_HOME in your shell config (.zshrc) to the homebrew java install path.
  • Open your .zshrc file with the editor of your choice and add the following lines:
export JAVA_HOME="/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home"
  • Save the file and run source ~/.zshrc to make the changes effective.

Note

For both approaches - you can try out in the terminal by typing $JAVA_HOME to make sure that it was updated properly.

Before running the app and in order to install without any caching issues

# Delete node modules and caches:
rm -rf node_modules && rm -rf .cache && rm -rf "$TMPDIR/metro*" && rm -rf "$TMPDIR/haste-map-*"

# install all the dependencies needed
yarn install:all

# you will most likely have to run also the following to bump hermes-engine:
cd ios && bundle exec pod update hermes-engine --no-repo-update & cd ..

Read more on proper environmet setup

You can also find more information on how to properly setup your environment for react native in this official doc.