
The directory structure itself needed work.Īt Caribou, net-new functionality or highly complex additions to our systems must go through a design document process. We started from a flat file system containing multiple apps that were all located in the project’s root folder.

( "" ) from 'react-native/Libraries/NewAppScreen' Ĭonst isDarkMode = useColorScheme() = 'light' Ĭonst isDarkMode = useColorScheme() = 'dark' īackgroundColor : !isDarkMode ? Colors.darker : Colors.lighter,
MONOREPO NPM WORKSPACES ANDROID
!Remember to repeat this for each app in your monorepo! Android setup Open XCode and your project, select the Project navigator and click on the name of your project.If you are in the packages/app* folder run:
MONOREPO NPM WORKSPACES INSTALL
require_relative './node_modules/react-native/scripts/react_native_pods' - require_relative + require_relative './././node_modules/react-native/scripts/react_native_pods' + require_relative Open your terminal and install pods. Open Podfile go into your app and change paths to the node_modules.No worries, we’ll fix this in the next step: IOS configuration Most likely your apps have now been created but pods will not install. Where app1 and app2 are the names of both our apps and their directories. Npx react-native init app2 -template react-native-template-typescript Npx react-native init app1 -template react-native-template-typescript If your app names and directories match you can use this instead: cd packages Npx react-native init SecondApp -directory app2 -template react-native-template-typescript Npx react-native init FirstApp -directory app1 -template react-native-template-typescript To create React Native projects we can use the following commands: cd packages Workspaces: our workspace with the projects structured in a tree.That's very important because we don't want to make our workspaces public. open and check your package.json file.create a package.json file with yarn init -y,.open your terminal and go to the root directory cd my-app,.


Creating a package.json file in the root directory Shared/ <- folder for shared components, logic, etc. Here’s an example of how our project structure can look like: my -app/ Our projects need to be divided into subfolders. When creating a monorepo for react native applications, it is better to avoid using nohoist because we don't need duplicates inside the root level and inside the project level node_modules.

This can unlock a variety of benefits like core sharing, simplified ci/cd process and consistent tooling. Monorepos enable sharing of components, functions and logic between all of the included applications. To start we should ask a simple question: why should I use a monorepo for React Native apps? It's actually very useful when you have two (or more) similar applications.
