Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better support for monorepos #278

Open
yoshikischmitz opened this issue Apr 4, 2019 · 82 comments
Open

Better support for monorepos #278

yoshikischmitz opened this issue Apr 4, 2019 · 82 comments
Assignees
Labels
build Related to App Center's Build service feature request New feature request

Comments

@yoshikischmitz
Copy link

Describe the solution you'd like
I would like to be able to control how AppCenter clones my git repo. My app lives inside of a monorepo which is pretty big. It would be nice if AppCenter had a way to configure the git cloning process to use something like a partial fetch.

Describe alternatives you've considered
Alternatives would be changing how our repo works. But I think there are enough monorepo users out there for AppCenter to consider this.

@yoshikischmitz yoshikischmitz added the feature request New feature request label Apr 4, 2019
@patniko patniko added the build Related to App Center's Build service label Apr 5, 2019
@yoshikischmitz
Copy link
Author

Hi, would love to hear from the appcenter team if this is something they're interested in adding!

@patniko
Copy link
Contributor

patniko commented May 8, 2019

Definitely interested. Just a matter of getting to it. We do monitor this repo heavily to see where people are heavily requesting certain features.

@alexanderkrum
Copy link

Yeah +1

@lhrolim
Copy link

lhrolim commented Jul 10, 2019

+1

@0xycvv
Copy link

0xycvv commented Aug 3, 2019

I'm trying to use app center to build react-native.
How can I set the entry file in monorepo build?

@nilofer
Copy link

nilofer commented Aug 5, 2019

@EricYip you cannot specify the file path for builds today. Noted as something that would be important as part of this feature request. Thanks!

@iamchathu
Copy link

We are using monorepo with Lerna and have structured the project with main App with sub packages with shared code and native dependancies. We need a way to specify with package should AppCenter build as main project and use Yarn workspaces or Lerna to install dependancies.

@yoshikischmitz
Copy link
Author

As part of this, another issue I noticed is in the package dropdown, the current selected package shows up as just package.json. When you have many package.json files, this is not super helpful. To disambiguate between packages, it would be much more helpful to either show the path of the package file, or perhaps even better(as it shows you in the dropdown selection), or the name of the package(as specified in the name field).

@putuyoga
Copy link

putuyoga commented Aug 7, 2019

as monorepo become mainstream, this feature would benefit a lot of people out there.

@dluc
Copy link

dluc commented Aug 22, 2019

Hopefully the team will also fix the way a repository is scanned to detect React Native apps. As described in #928 if a RN app is in a subfolder, AppCenter doesn't detect it. Apparently also the "4 layers" search for package.json is not working as expected (see comments).

@brandonpearcy
Copy link

brandonpearcy commented Dec 1, 2019

+1 for AppCenter to support monorepo projects. We were using AppCenter to deploy our react-native project, but have had to move away from it recently after switching over to a monorepo w/ yarn workspaces. We miss you AppCenter! 😢

Our monorepo project structure is as follows:

/projectRoot
    /node_modules (yarn installs most modules here)
    /packages
        /app
            /node_modules (appcenter build incorrectly assume RN modules will be here)
        /shared
        /web

@zeevl
Copy link

zeevl commented Dec 5, 2019

I was able to get this to work with our RN monorepo (using yarn workspaces) by doing the following:

  • configure build to use package.json in RN sub project
  • configure that RN package.json to nohoist it's packages:
  "workspaces": {
    "nohoist": [
      "**"
    ]
  }
  • create a script in that sub project called appcenter-post-clone.sh that does a yarn install in the root project directory
  • create an empty yarn.lock in the RN sub project to trick appcenter into using yarn

We also had to install a more recent version of node in our post-clone script so rn & others could install correctly. This is what appcenter-post-clone.sh looks like for us:

#!/usr/bin/env bash

set -ex

brew uninstall node@6
NODE_VERSION="12.13.0"
curl "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}.pkg" > "$HOME/Downloads/node-installer.pkg"
sudo installer -store -pkg "$HOME/Downloads/node-installer.pkg" -target "/"

# run yarn twice, ignoring errors from the first one
# https://github.com/yarnpkg/yarn/issues/6988
yarn --cwd ../../ install || true
yarn --cwd ../../ install 

@brandonpearcy
Copy link

Thank you! That got me closer, but I'm still seeing errors. I wonder what's different between our configurations.

I added nohoist to packages/app/package.json
Moved react-native.config.js from project root to packages/app
Confirmed that react-native config output all looks reasonable.
Confirmed that react-native run-ios and run-android both build correctly locally.
Added your appcenter-post-clone.sh script to packages/app, and verified that it is running successfully in AppCenter build

For my iOS build, I have AppCenter configured as follows:

  • use packages/app/package.json
  • XCode version 11.2.1
  • Node version: 10.x
  • Use legacy build system: off

Here is where the build fails. The build script is looking for index.js in the projects root directory, instead of packages/app/index.js

##[section]Starting: Generate source map
==============================================================================
Task         : Command line
Description  : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version      : 2.151.2
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
Generating script.
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /Users/runner/runners/2.160.1/work/_temp/c6837c87-5b14-443b-9a75-e1e5c8ac0a5b.sh
Found index.js for ReactNative index.
warn The following packages use deprecated "rnpm" config that will stop working from next release:
  - react-native-code-push: https://microsoft.github.io/code-push
  - rn-fetch-blob: https://npmjs.com/package/rn-fetch-blob
Please notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide.
warning: the transform cache was reset.
error The resource `/Users/runner/runners/2.160.1/work/1/s/index.js` was not found. Run CLI with --verbose flag for more details.
Error: The resource `/Users/runner/runners/2.160.1/work/1/s/index.js` was not found.
    at fs.realpath.err (/Users/runner/runners/2.160.1/work/1/s/packages/app/node_modules/metro/src/IncrementalBundler.js:157:26)
    at gotStat (fs.js:1600:21)
    at FSReqWrap.oncomplete (fs.js:153:21)
##[error]Bash exited with code '1'.

@agusvazquez
Copy link

Hello!

I'm having the same issue as @brandonpearcy
Did you guys find a workarround for this?

Thanks!

@vitalyiegorov
Copy link

Hello, also huge + for implementing monorepo support.

@agusvazquez
Copy link

agusvazquez commented Dec 13, 2019

Hello guys! Got it working by generating the main.js file manually and then pushing the file.

yarn workspace app-name build:ios|android to generate the bundle file

Remember to add this to the scripts part of package.json

"build:android": "react-native bundle --entry-file=./packages/mobile/index.js --bundle-output=./android/CodePush/index.android.bundle --assets-dest ./android/CodePush/ --dev=false --platform=android",
"build:ios": "react-native bundle --entry-file=./packages/mobile/index.js --bundle-output=./ios/CodePush/main.jsbundle --assets-dest ./ios/CodePush/ --dev=false --platform=ios",

When the folder is created, just do a release

appcenter codepush release -c ./packages/mobile/ios/CodePush -t **VERSION** -a **PROJECT** -d **ENVIRONMENT**

or

appcenter codepush release -c ./packages/mobile/android/CodePush -t **VERSION** -a **PROJECT** -d **ENVIRONMENT**

@vitalyiegorov
Copy link

vitalyiegorov commented Dec 16, 2019

Using RN 0.61.5 tried @zeevl solution, it does not work with following error:

* Where:
Script '/Users/runner/runners/2.163.1/work/1/s/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 206

* What went wrong:
A problem occurred evaluating script.
> React Native CLI failed to determine Android project configuration. This is likely due to misconfiguration. Config output:
  [root:/Users/runner/runners/2.163.1/work/1/s, reactNativePath:/Users/runner/runners/2.163.1/work/1/s/node_modules/react-native, dependencies:[@react-native-community/masked-view:...

I guess the problem is that reactNativePath is resolved to the root node_modules folder

@zeevl Maybe you have a clue?

@agusvazquez
Copy link

Hey @vitalyiegorov try generating the bundle js manually and uploading it to code push like I explained on my previus post.

That should work and there is no need for black magic on the project.

@vitalyiegorov
Copy link

@agusvazquez Thanks for the solution! I will try to integrate it to speed up our builds.

Your solution is viable but it does not fully fit our development process, as our project is in the MVP stage we continue adding new native modules, thus we need to rebuild our APK and CodePush deployment that you have suggested will only partly solve our needs as we would love to dedicate build process for iOS/Android to Appcenter.

Anyway, we need someone help from @microsoft @patniko team to investigate and improve monorepo support as it is getting more and more popular, maybe some things need to be also fixed inside react-native-cli for running RNCLI inside the subfolders, latest RN 0.61.5 release states that monorepo support has been improved which means that the RN team dedicating its resources for it.

@agusvazquez
Copy link

agusvazquez commented Dec 17, 2019

@vitalyiegorov if your project has a lot of native modules, then Code Push makes no sense because you will always need to update the native code, therefore you will need to send another APK / IPA for approval to Google / iTunes.

Unless you want to do quick JS only fixes.

The solution I gave is for just doing a code push changing only javascript code. If you need to change native code of course you will need to recompile everything.

@vitalyiegorov
Copy link

@agusvazquez Again thank you very much for your advice, but this issue, in general, is not about publishing a new CodePush version, it is related to Appcenter monorepo support which is currently not working, we should be able to build monorepo projects.

@pontusab
Copy link

I guess we need to have a config for --entryFile for react native cli build command on AppCenter. Choosing package.json in the subdirectory of the monorepo is not enough.

@GoMino
Copy link

GoMino commented Jan 10, 2020

to fix @brandonpearcy issue and trick app-center when using a monorepo, a quick hack is it to create a index.js file at the root of the monorepo and require the index of your react-native project:

require("./packages/mobile");

@Maushundb
Copy link

Maushundb commented Jan 16, 2020

@GoMino I tried that and it seemed to fix the index not found error folks have been describing, but now its telling me error Unable to resolve module lib/graphQl/ApolloClient from packages/mobile/src/App.js: lib/graphQl/ApolloClient could not be found within the project., which is the first non-node_modules import I have in my app.

I have a hunch it's trying to resolve imports relative to the root, rather than the package/mobile directory because of require("./packages/mobile");. Any other way to get appcenter to find the right index?

Setting the build setting to use packages/mobile/package.json and changes build:ios to --entry-file=./packages/mobile/index.js didn't seem to fix it.

@zeevl
Copy link

zeevl commented Jan 16, 2020

Hey all, just wanted to pipe in -- we're successfully building both iOS and android apps from a monorepo on appcenter, using the normal appcenter build tools. Keys for me were:

  1. this comment,

  2. Pinning the rn cli to 3.0.0 by adding the following to the root package.json:

  "resolutions": {
    "@react-native-community/cli-platform-android": "3.0.0"
  }

due to #1518 and react-native-community/cli#852

I'm not sure I'll be able to provide any support other than that, as so many of the issues in this thread are not issues I encountered. But, I wanted to post this to let you know, it is possible.

@Maushundb
Copy link

@zeevl Did you change your build settings to use the root package.json or the sub-folder package.json?

@airtonix
Copy link

airtonix commented Apr 30, 2022

Yeah I wouldn't bother. Microsoft are focusing on GitHub and Azure.

A more reliable monorepo react native ci system can be made with fastlane, dpx, changesets/cli and changesets/bot 👍

@penx
Copy link

penx commented Apr 30, 2022

We’re moving away from app center for this very reason.

But still, for those stuck with it, it’s not stale 😄

@flexbox
Copy link

flexbox commented May 3, 2022

I just randomly landed on this thread after days of try / hard.

A more reliable monorepo react native ci system can be made with fastlane, dpx, changesets/cli and changesets/bot 👍

@airtonix Do you have a 2022 example, last time with fastlance for me was 5 years ago 😅

@kokoskiwi
Copy link

kokoskiwi commented May 9, 2022

+1 for AppCenter to support monorepo projects. We were using AppCenter to deploy our react-native project, but have had to move away from it recently after switching over to a monorepo w/ yarn workspaces. We miss you AppCenter! 😢

Our monorepo project structure is as follows:

/projectRoot
    /node_modules (yarn installs most modules here)
    /packages
        /app
            /node_modules (appcenter build incorrectly assume RN modules will be here)
        /shared
        /web

@brandonpearcy How can I use NX with the AppCenter CodePush? Or better asked: is there a CodePush Alternative? i don't really need App Center, I need only CodePush
Maybe u guys have an idea @flexbox @penx

I would be very happy about every help https://www.reddit.com/r/reactnative/comments/ulo2mm/is_react_native_for_nx_stable_enough_are_there_no/

edit: is expo-updates compatible with NX? https://docs.expo.dev/versions/latest/sdk/updates/

@charkcl
Copy link

charkcl commented May 19, 2022

+1 for AppCenter to support monorepo projects. We were using AppCenter to deploy our react-native project, but have had to move away from it recently after switching over to a monorepo w/ yarn workspaces. We miss you AppCenter! 😢

Our monorepo project structure is as follows:

/projectRoot
    /node_modules (yarn installs most modules here)
    /packages
        /app
            /node_modules (appcenter build incorrectly assume RN modules will be here)
        /shared
        /web

@brandonpearcy which platform did you switch to build?

@airtonix
Copy link

I just randomly landed on this thread after days of try / hard.

A more reliable monorepo react native ci system can be made with fastlane, dpx, changesets/cli and changesets/bot +1

@airtonix Do you have a 2022 example, last time with fastlance for me was 5 years ago sweat_smile

Apologies, at the moment our implementation at Reckon is private.

Through my experimentation I discovered that successful automation of both IOS and Android builds to the stores is not something you can do without also tying together the following:

  • auto generate app versions (stores reject incorrect versioned builds)
  • certs/profiles and keyfiles (Letting developers manually handle these things just results in problems for everyone)
  • building aab and ipa is cpu intensive... so you need to spawn separate ci tasks
  • you need good "what changed detection" (I really wish I understood NX.DEV at the time because i ended up basically reinventing it - poorly)

Our fastlane implementation is not publicly available, but i can explain the concepts i had to deal with.

But essentially, we use a combination of CircleCI (looking to move to github actions) and Fastlane with:

  • a codesigning repo where our IOS profiles/certs and Android keyfiles live (we use cryptex for the android side of things)
  • our local builds don't use codesigning at all
  • our PR process requires the use of changesets/cli
  • PRs merge into develop which triggers our changeset processing task, this calculates all the package.json#version fields that need to change
  • we auto build dev releases every 3hrs and prod builds once a day
  • the dev build process decided what app changed and then spawns two separate CircleCi pipelines for that app (android and ios) - we've noticed that android builds are significantly faster due to being able to run in docker
  • once a day we try merging develop into master and the same "what app changed" process occurs which then also spawns two new pipelines for each changed app, but now with production settings.
  • our fastlane setup is configured through a layering of yaml (app release > app > global release > global) files some of which is computed at build time (most important here is APPLICATION_VERSION and APPLICATION_SEMVER which is driven by ☝🏻 the apps package.json#version due to changeset/cli ). Each layer is merged ontop of the next below which kinda looks like :
/app/ds/fastlane/config/settings.development-release.yml
  /app/ds/fastlane/config/settings.yml
    /tools/fastlane/config/settings.development-release.yml
      /tools/fastlane/config/settings.yml
  • these yaml files also drive the creation of the apps .env file for react-native-config
  • these yaml files also drive all the options for every lane in fastlane as defaults - so you can manually run the lanes from cli, but any missing parameters are derived from the computed yaml configuration
  • since we only do Typescript at Reckon, the .env file is also backed by a .d.ts so developers get typesaftey for the items from react-native-config
  • we have an obscene amount of npm scripts that help glue this together so the developer only has to do
yarn clean
yarn setup
# if no new native-modules
yarn app:X start
# if there's new native modules
yarn app:X android:dev
yarn app:X ios:dev

The biggest problem we have is due to not using NX.dev and instead relying on package.json deps for our depgraph as the mechanism for understanding what changed when we need to make a build.

We only have two apps and about 30 design-system packages - a yarn setup can take 20 minutes

then a build can take somewhere between 15mins or an hour depending on the compute power available.

I would strongly advise anyone setting up a new react-native monorepo to instead :

  • use NX.dev and yarn2 with PnP and the nodeLinker
  • only have one single package.json in your whole repo, this will contribute hugely to speeding up your install times (with 3000 packages this is 20 minutes versus 1-2 minutes)
  • don't use npm scripts, instead use https://github.com/casey/just with maybe https://github.com/google/zx they're both going to save you a lot of time with tooling

@ghost ghost added the Stale label Jul 19, 2022
@ghost
Copy link

ghost commented Jul 19, 2022

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

@charkcl
Copy link

charkcl commented Aug 1, 2022

still need better support:)

@ghost ghost removed the Stale label Aug 1, 2022
@dylan-westbury
Copy link

dylan-westbury commented Sep 20, 2022

I managed to get it working through attempting various hacks over a whole day.

I use Lerna and AWS Amplify and this is how the project directory is set up:

packages

  • backend
  • reactnativeapp
  • shared

reactnativeapp has a dependency on shared.

For the build configuration I have the package.json selected within the react native app package

Screen Shot 2022-09-20 at 1 50 14 pm

I managed to get everything working within the appcenter-post-clone.sh build script (refer to comments within 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 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

Optionally if you are using AWS amplify and you have the backend within the Monorepo, here is a appcenter-pre-build.sh script to get aws-exports.js file within React native package.

#!/usr/bin/env bash

# Env variables to add to ms app center
# AWS_ACCESS_KEY_ID="" # iam app center role
# AWS_SECRET_ACCESS_KEY="" # iam app center role
# AWS_REGION="us-east-1" # region of app
# AMPLIFY_ENV="dev" # env to use
# AMPLIFY_PROJECT_NAME=""  # name in amplify
# AMPLIFY_APP_ID="" # app id in amplify

ls

REACTNATIVECONFIG="{\
\"SourceDir\":\"src\",\
\"DistributionDir\":\"build\",\
\"BuildCommand\":\"yarn build\",\
\"StartCommand\":\"yarn start\"\
}"

AWSCONFIG="{\
\"configLevel\":\"general\",\
\"useProfile\":false,\
\"profileName\":\"default\",\
\"accessKeyId\":\"${AWS_ACCESS_KEY_ID}\",\
\"secretAccessKey\":\"${AWS_SECRET_ACCESS_KEY}\",\
\"region\":\"${AWS_REGION}\"\
}"

AMPLIFY="{\
\"projectName\":\"${AMPLIFY_PROJECT_NAME}\"\
\"appId\":\"${AMPLIFY_APP_ID}\"\
\"envName\":\"${AMPLIFY_ENV}\"\
\"defaultEditor\":\"none\"\
}"

PROVIDERS="{\
\"awscloudformation\":${AWSCONFIG}\
}"

CODEGEN="{\
\"generateCode\":false,\
\"generateDocs\":false\
}"

FRONTEND="{\
\"frontend\":\"javascript\",\
\"framework\":\"react-native\",\
\"config\":${REACTNATIVECONFIG}\
}"

cd ../backend && amplify pull --frontend "${FRONTEND}" --amplify "${AMPLIFY}" --providers "${PROVIDERS}" --codegen "${CODEGEN}" --yes

cp src/aws-exports.js ../reactnativeapp/src

I notices some comments in this thread are hidden, but after unhidding them they helped me achieve this solution

@jameshhood
Copy link

I already have a disadvantage having a capacitor app it seems but now I also have a lerna/monorepo and it cannot find dependencies correctly. I guess I will just have to resort to manually uploading builds.

@Twisterat57
Copy link

+1

@mzekrallah
Copy link

+1 for monorepo fetch support

@mzekrallah
Copy link

3 years waiting for this already

@macrozone
Copy link

macrozone commented Apr 13, 2023

as many pointed out, one problem is that appcenter's yarn detection is just broken. (see #278 (comment))

This is shocking as a more stable implementation would be very easy to do.

If appcenter would at least give us more control over that, as they seem to fail to implement a simple fix for that problem.

I am currently trying the hack described by #278 (comment)

Edit: also switching to fastlane, since we already have a sophisticated CI/CD-pipeline

@CDBridger
Copy link

I managed to get it working through attempting various hacks over a whole day.

I use Lerna and AWS Amplify and this is how the project directory is set up:

packages

* backend

* reactnativeapp

* shared

reactnativeapp has a dependency on shared.

For the build configuration I have the package.json selected within the react native app package

Screen Shot 2022-09-20 at 1 50 14 pm

I managed to get everything working within the appcenter-post-clone.sh build script (refer to comments within 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 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

Optionally if you are using AWS amplify and you have the backend within the Monorepo, here is a appcenter-pre-build.sh script to get aws-exports.js file within React native package.

#!/usr/bin/env bash

# Env variables to add to ms app center
# AWS_ACCESS_KEY_ID="" # iam app center role
# AWS_SECRET_ACCESS_KEY="" # iam app center role
# AWS_REGION="us-east-1" # region of app
# AMPLIFY_ENV="dev" # env to use
# AMPLIFY_PROJECT_NAME=""  # name in amplify
# AMPLIFY_APP_ID="" # app id in amplify

ls

REACTNATIVECONFIG="{\
\"SourceDir\":\"src\",\
\"DistributionDir\":\"build\",\
\"BuildCommand\":\"yarn build\",\
\"StartCommand\":\"yarn start\"\
}"

AWSCONFIG="{\
\"configLevel\":\"general\",\
\"useProfile\":false,\
\"profileName\":\"default\",\
\"accessKeyId\":\"${AWS_ACCESS_KEY_ID}\",\
\"secretAccessKey\":\"${AWS_SECRET_ACCESS_KEY}\",\
\"region\":\"${AWS_REGION}\"\
}"

AMPLIFY="{\
\"projectName\":\"${AMPLIFY_PROJECT_NAME}\"\
\"appId\":\"${AMPLIFY_APP_ID}\"\
\"envName\":\"${AMPLIFY_ENV}\"\
\"defaultEditor\":\"none\"\
}"

PROVIDERS="{\
\"awscloudformation\":${AWSCONFIG}\
}"

CODEGEN="{\
\"generateCode\":false,\
\"generateDocs\":false\
}"

FRONTEND="{\
\"frontend\":\"javascript\",\
\"framework\":\"react-native\",\
\"config\":${REACTNATIVECONFIG}\
}"

cd ../backend && amplify pull --frontend "${FRONTEND}" --amplify "${AMPLIFY}" --providers "${PROVIDERS}" --codegen "${CODEGEN}" --yes

cp src/aws-exports.js ../reactnativeapp/src

I notices some comments in this thread are hidden, but after unhidding them they helped me achieve this solution

I tried this ^^^ which fixed this issue

##[section]Starting: Generate source map
==============================================================================
Task         : Command line
Description  : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version      : 2.212.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
Generating script.
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /Users/runner/work/_temp/e533315a-e7e4-4106-870e-9b369cb4bd5a.sh
Found index.js for ReactNative index.
node:internal/modules/cjs/loader:1029
  throw err;
  ^

Error: Cannot find module '/Users/runner/work/1/s/apps/pp-app/node_modules/react-native/local-cli/cli.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1026:15)
    at Function.Module._load (node:internal/modules/cjs/loader:871:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
##[error]Bash exited with code '1'.
##[section]Finishing: Generate source map

but now I get this

##[section]Starting: Generate source map
==============================================================================
Task         : Command line
Description  : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version      : 2.212.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
Generating script.
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /Users/runner/work/_temp/fd3abc53-7ab7-450e-a4b4-7daa70170202.sh
Found index.js for ReactNative index.
warning: the transform cache was reset.
error The resource `/Users/runner/work/1/s/index.js` was not found.
Error: The resource `/Users/runner/work/1/s/index.js` was not found.
    at /Users/runner/work/1/s/node_modules/metro/src/IncrementalBundler.js:289:24
    at gotStat (node:fs:2684:21)
    at FSReqCallback.oncomplete (node:fs:202:21)
info Run CLI with --verbose flag for more details.
##[error]Bash exited with code '1'.
##[section]Finishing: Generate source map

I can build locally, just not in appcenter. My layout is

-- apps
    -- pp-app
--libs
    -- sharedlibs

using lerna

@microsoft-github-policy-service
Copy link
Contributor

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

@microsoft-github-policy-service
Copy link
Contributor

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

@maakcode
Copy link

+1

IgorNadj added a commit to beyondessential/tupaia that referenced this issue Oct 31, 2023
IgorNadj added a commit to beyondessential/tupaia that referenced this issue Oct 31, 2023
@sebastiandg7
Copy link

Keeping this alive. Happy 2024 🎉 !

@arcifius
Copy link

arcifius commented Jan 9, 2024

+1

@moniquealtero
Copy link

I'm just tired of making workarounds to use appcenter with monorepos :(

@juanolmedo1
Copy link

Please we need support for monorepos 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Related to App Center's Build service feature request New feature request
Projects
None yet
Development

No branches or pull requests