Giter Site home page Giter Site logo

locphan87 / react-native-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 8.0 776 KB

A feature oriented react native boilerplate using functional patterns and tools

JavaScript 98.31% Makefile 1.69%
react-native functional-js boilerplate feature-oriented-programming react

react-native-boilerplate's Introduction

CircleCI codecov Maintainability

React Native Boilerplate

A feature-oriented react native boilerplate using functional patterns and tools

Table of Contents

tltr;

Sounds good and you just want to see how it works? Here is a quick start guide:

$ git clone https://github.com/phanhoangloc/react-native-boilerplate
$ cd react-native-ts
$ yarn install
$ yarn start

Architecture

Details

Please note that in this boilerplate, we use JavaScript + Flow instead of TypeScript

Getting started

Requirements

Before you get started, make sure you have the following dependencies installed on your machine:

  • NodeJS >= 8.11 with yarn and npm 5
  • Latest React Native CLI
$ npm install -g react-native-cli
$ npm install -g expo-cli

Installation

  • Install dependencies
$ yarn install
  • Create configuration files
$ yarn setup

Development workflow

Run the app

  • Start a local server for your app
$ yarn start
  • Opens your app in Expo in a currently running iOS simulator on your computer
$ yarn ios
  • Opens your app in Expo on a connected Android device
$ yarn android

Test the app

  • Run unit tests
$ yarn test
  • Run tests every time code changes
$ yarn test:watch
  • Generate code coverage report
$ yarn test:coverage
  • Run tests every time code changes and generate code coverage report
$ yarn test:wc

It's quite slow to watch file changes and then generate code coverage report. Despite that, it's useful to run it on isolated/small test cases

Debugging

For standard debugging select Debug JS Remotely from the React Native Development context menu (To open the context menu, press CMD+D in iOS or D+D in Android). This will open a new Chrome tab under http://localhost:8081/debugger-ui and prints all actions to the console.

For advanced debugging under MacOS we suggest using the standalone React Native Debugger, which is based on the official debugger of React Native. It includes the React Inspector and Redux DevTools so you can inspect React views and get a detailed history of the Redux state.

You can install it via brew and run it as a standalone app:

$ brew update && brew cask install react-native-debugger

Open React Native Debugger on a different port (i.e 19002)

$ open "rndebugger://set-debugger-loc?host=localhost&port=19002"

Note: Make sure you close all active chrome debugger tabs and then restart the debugger from the React Native Development context menu.

Deployment

Login to Expo

Make sure to login to the correct account

$ expo login
$ expo whoami // check the current user

Publish to Expo

We need to specify the environment and the release channel for deployment

Publish to staging

$ ENV=staging CHANNEL=staging yarn deploy

Publish to production (we use the default channel for production)

$ ENV=production yarn deploy

There is a post publish hook that we can benefit to do extra stuff:

  • notify the new build on Slack
  • build and upload source maps for an error reporting service (i.e Sentry)
  • ...

Make a new release

We show the build info directly in the app: app version, build time, environment, etc. Here are the steps to increase the app version when deploying:

  • Open app.json in the target environment. Example: You are deploying to staging, the file would be ./src/environments/staging/app.json
  • Update the key expo.version
  • Commit the change and push it to the repository

Licensing

MIT

react-native-boilerplate's People

Contributors

locphan87 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-native-boilerplate's Issues

move goal app code to an example branch

Objectives:

  • clean up code base at the master branch
  • keep the repo simple and easier to approach (not everyone wants a complex app at first)
  • easy to extend by following good examples

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.