How can I build / distribute react native apps on appcenter using a monorepo? I've tried lerna and nx but no luck with either.
Asked
Active
Viewed 806 times
2 Answers
0
I'm using NX react native with MS App Center. I did a lot of workaround to make it work. In my opinion, if you using NX, avoid to MS App Center.

Kumkao
- 37
- 1
- 2
0
I have not tried with NX, just with Lerna only. I was able to do so within a post-clone script.
My project set up is:
packages
- backend
- reactnativeapp
- shared
I select the package.json within the React Native app's package / directory:
Here is the appcenter-post-clone.sh
build script, with appropriate comments in the code:
#!/usr/bin/env bash
# Create fake yarn lock so appcenter uses Yarn instead of npm install
touch yarn.lock
# Navigate to root directory
cd ../../
# Add global dependencies
yarn global add @aws-amplify/cli # for aws amplify - exclude if not using
yarn global add lerna
# Private github package permissions - exclude or update based on your needs
npm config set @apptractive:registry https://npm.pkg.github.com
npm config set always-auth true
npm config set //https://npm.pkg.github.com/:_authToken="${NPM_AUTH_TOKEN}"
# Install dependencies using Lerna
yarn run bootstrap --include-dependencies
# Copy RN CLI that Ms App Center depends on
mkdir -p packages/reactnativeapp/node_modules/react-native/local-cli/
cp node_modules/react-native/local-cli/cli.js packages/reactnativeapp/node_modules/react-native/local-cli/cli.js
# Build other packages within monorepo that React Native depends on
cd packages/shared && yarn build
I have posted more details on an App Center Github issue, particularly if you are using AWS Amplify also

Dylan w
- 2,565
- 1
- 18
- 30