Skip to content
This repository has been archived by the owner on Aug 6, 2021. It is now read-only.

What do you get when you run "react native init MercuryApp"?

Oliver George edited this page Jun 2, 2019 · 13 revisions

As a reference point, here's what we get when we run react-native init --version 0.59.5 MercuryApp:

~/repos/mercury-app $ cloc .
      45 text files.
      45 unique files.                              
      20 files ignored.

github.com/AlDanial/cloc v 1.80  T=0.02 s (1282.0 files/s, 43834.0 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Bourne Shell                     1             21             22            129
Gradle                           3             15             89             83
Objective C                      3             26             18             82
JSON                             4              0              0             72
JavaScript                       5             10             20             62
DOS Batch                        1             23              2             59
Java                             2             12              4             44
XML                              4              7              2             36
Skylark                          1              2              1             16
C/C++ Header                     1              4              6              5
ProGuard                         1              2             15              0
-------------------------------------------------------------------------------
SUM:                            26            122            179            588
-------------------------------------------------------------------------------

Babel

Babel is a compiler for writing next generation javascript. React Native uses Babel when transforming source code via presets for React Native applications.

~/repos/mercury-app $ cat babel.config.js 
module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
};

Flow

Facebook Flow "adds static typing to JavaScript to improve developer productivity and code quality".

The related config file is .flowconfig

Watchman

"Watchman exists to watch files and record when they change".

.watchmanconfig is an empty config file.

Android app

Source files & app settings

android/app/src/main/AndroidManifest.xml
android/app/src/main/java/com/mercuryapp/MainApplication.java
android/app/src/main/java/com/mercuryapp/MainActivity.java

Resource files

android/app/src/main/res/mipmap-mdpi/ic_launcher.png
android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
android/app/src/main/res/mipmap-hdpi/ic_launcher.png
android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
android/app/src/main/res/values/styles.xml
android/app/src/main/res/values/strings.xml
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png

Other configuration and build files

android/app/src/debug/AndroidManifest.xml
android/app/proguard-rules.pro
android/app/BUCK
android/app/build.gradle
android/app/build_defs.bzl
android/gradle/wrapper/gradle-wrapper.jar
android/gradle/wrapper/gradle-wrapper.properties
android/gradlew
android/keystores/debug.keystore.properties
android/keystores/BUCK
android/build.gradle
android/gradle.properties
android/gradlew.bat
android/settings.gradle

Note: The generated source code uses the java package "com.mercuryapp". We search and replace with something more appropriate like "au.com.condense.clientapp"

iOS app

Source code

ios/MercuryApp/main.m
ios/MercuryApp/AppDelegate.h
ios/MercuryApp/AppDelegate.m
ios/MercuryApp/Info.plist

Resource files

ios/MercuryApp/Images.xcassets/Contents.json
ios/MercuryApp/Images.xcassets/AppIcon.appiconset/Contents.json
ios/MercuryApp/Base.lproj/LaunchScreen.xib

Note: The iOS app doesn't come with an icon but does come with an empty AppIcon.appiconset. Within Xcode we can drag our app icon images into it.

Note: The iOS app includes a basic launch screen. We can update with our branding via Xcode.

Project files

ios/MercuryApp.xcodeproj/project.pbxproj
ios/MercuryApp.xcodeproj/xcshareddata/xcschemes/MercuryApp.xcscheme
ios/MercuryApp.xcodeproj/xcshareddata/xcschemes/MercuryApp-tvOS.xcscheme

The Xcode project comes with a test target and stubs

ios/MercuryAppTests/MercuryAppTests.m
ios/MercuryAppTests/Info.plist

The Xcode project includes a tvOS target. We will delete the tvOS and tvOSTest targets and associated files.

ios/MercuryApp-tvOS/Info.plist
ios/MercuryApp-tvOSTests/Info.plist

Javascript app

Initially, our app is defined with:

  • index.js
  • App.js
  • package.json
  • tests/App-test.js

Our package.json file includes:

{
  "name": "MercuryApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.8.3",
    "react-native": "0.59.5"
  },
  "devDependencies": {
    "@babel/core": "^7.4.5",
    "@babel/runtime": "^7.4.5",
    "babel-jest": "^24.8.0",
    "jest": "^24.8.0",
    "metro-react-native-babel-preset": "^0.54.1",
    "react-test-renderer": "16.8.3"
  },
  "jest": {
    "preset": "react-native"
  }
}

Expo related files

There's also an app.json file which seems to be associated with ejecting Expo apps. See commit.

Source control config

The .gitignore file has lots of useful exclusions.

There's also a .gitattributes which allows git to merge pbxproj files as part of the upgrade process.

Buck

Buck is a build system developed and used by Facebook. It seems these are included as an alternative to the standard android app build process. The original commit indicates the files were included "to get people familiar with it". Can't find any other references in the build scripts which requires buck.

The related files are:

./.buckconfig
./android/app/BUCK
./android/keystores/BUCK