axeldelafosse / eas-monorepo-example

An example monorepo for EAS or just Expo usage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EAS monorepo example

Enterprise-ready Expo Application Service monorepo with code sharing

managed preview latest standalone build license

Structure  —  Workflows  —  How to use it  —  Caveats  —  Common Errors

📁 Structure

  • apps - Expo apps that only use packages and aren't aware of other apps.
  • packages - Node packages that may use external and/or local packages.

Apps

  • apps/ejected - Expo bare app using babel, eslint, and ui packages.
  • apps/managed - Expo managed app using babel, eslint, and ui packages.
  • apps/with-sentry - Expo managed app with expo-sentry integrated.

Packages

  • packages/babel - Preconfigured Babel configuration for Expo.
  • packages/eslint - Preconfigured ESLint coniguration for Expo.
  • packages/ui - Shared React Native UI components for the apps, using the eslint package.

👷 Workflows

  • preview - Publishes managed apps to a PR-specific release channel and adds a QR code to that PR.
  • standalone - Starts the EAS builds for user-provided OS and build profiles.
  • test - Ensures that the apps and packages are passing lint and build checks.

🚀 How to use it

To set this repository up, you need an Expo account with access to EAS. After that, you need to run these commands.

  • $ yarn - This installs all required Node libraries using Yarn Workspaces
  • $ yarn build - To precompile the packages to publish them to NPM and/or use them in your apps.
  • Change the expo.owner and expo.android.package / expo.ios.bundleIdentifier properties in app.json for all apps.

Starting apps

After the initial setup, you can start the apps from their app directories. Or you can use yarn workspace <name> expo start command, see scripts in package.json.

  • $ yarn ejected expo run:android|ios - This will execute expo run:android|ios in the ejected app.
  • $ yarn managed expo start - This will execute expo start in the managed app.
  • $ yarn with-sentry expo start - This will execute expo start in the with-sentry app.

⚠️ Caveats

Precompile packages

EAS only sends the files which are committed to the repository. That means the packages/*/build folders need to be generated before building our apps. To tell EAS how to compile our packages, we can use the postinstall hook.

Running EAS from apps directories

As of writing, the eas build command needs to be executed from the package folder itself. EAS will still create a tarball with all files from your monorepo, but runs the build commands from this local folder. You can see this happening in the standalone workflow.

Using local credentials in CI

If you want to maintain the keystore or certificates yourself, you have to configure EAS with local credentials. When your CI provider doesn't allow you to add "secret files", you can encode these files to base64 strings and decode whenever you need it.

It's highly recommended to keep keystores and certificates out of your repository to avoid security issues.

Common Errors

We are still testing for potential issues, but none are found yet!


with ❤️  byCedric

About

An example monorepo for EAS or just Expo usage

License:MIT License


Languages

Language:Java 33.2%Language:TypeScript 20.0%Language:JavaScript 16.6%Language:Objective-C 15.3%Language:Starlark 7.9%Language:Ruby 6.1%Language:Swift 0.5%Language:C 0.4%