Code Monkey home page Code Monkey logo

nx-reactnative-appcenter's Introduction

Demo: Nx + React Native + AppCenter

This repo aims to provide an example react native application under an Nx workspace using AppCenter for it's CI/CD.

Versions used:

  • Package manager: yarn@1
  • Nx: 18.0.3
  • Node: 18.X
  • React native: 0.73.2
  • Java JDK: 17.0.10
Platform Status
Android image working โœ…
iOS image working โœ…

Backlog

  • Re-use workspace dependencies installation
  • Reusable AppCenter custom build scripts via zx
  • Only run if mobile Nx project is affected by the changes
  • Cache node_modules dependencies
  • Cache Pod dependencies for iOS

Workspace layout

image

Configuration

To make things work in AppCenter, we need to tune our project configuration as follows.

AppCenter project creation

Go ahead to AppCenter and create an Android project and an iOS project for your react native app.

  1. Create the AppCenter project using React Native as platform and Android/iOS as OS.

Android image

iOS image

  1. Add build configuration to your branch using the app's package.json, not the workspace root package.json.
image
  1. Envrionment variables

Refer to the environment variables section about what to add for each platform build configuration.

Custom build scripts

Using AppCenter custom build scripts we can setup the Nx workspace dependencies so that workspace libs are included in our build.

Check the following scripts:

  • apps/mobile/appcenter-post-clone.sh

AppCenter environment variables

The following are the custom environment variables you need to add in the AppCenter build configuration for each project.

Name Value Platform
APPCENTER_CURRENT_PLATFORM android or ios both
APPCENTER_NX_PROJECT mobile both
APPCENTER_NX_PROJECT_DIR apps/mobile both
JAVA_HOME $(JAVA_HOME_17_X64) android

Significant changes

In order to make the react-native build work from AppCenter some files needed changes as we cannot spawn the nx build targets (AppCenter runs their own build commands).

./apps/mobile/.babelrc.js

image

nx-reactnative-appcenter's People

Contributors

reriveram avatar sebastiandg7 avatar

Stargazers

 avatar

Watchers

 avatar

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.