MetaFactoryAI / mf-app

https://beta.mf.app
6 stars 3 forks source link

MetaFactory App Monorepo

Monorepo with Expo + Next.js + Tailwind. Uses yarn workspaces.

GETTING STARTED

Folders

Running

Creating Directus extensions

  1. Run yarn create directus-extension inside the root extensions folder. Remove the npm lockfile
  2. cd back to root and run yarn
  3. Run yarn cms add directus-extension-<name>@1

Practices

In order to run a yarn command in the app folder, you can prepend it with yarn app. For example, to install a package in the app folder:

# add a package
yarn app add restyled
# install again at root so workspaces can work its magic
yarn install

# post install will inject the nessecery libraries for web3.js

The nice thing about the monorepo is that you only need each package to be in one package.json file. You don't need to add a dependency in every package.json. So we can use the main app as the entry point for basically every dependency.

You should also run yarn install at the root every time you add a package, since we use a patch-package postinstall script at the root folder.

EAS Build

If you're using EAS from Expo, you might need to add packages to your package.json's expo-yarn-workspaces.symlinks array.

For starters, you should create a separate folder called native-app or something like that. That's where your bare expo app should live.

Then you should put a react-native resolution in your root package.json to avoid version conflicts. Or, just make sure you have only one react-native in a package.json. It should be in your the package that has your bare app.

Put this in your root package.json if you want to avoid excessive callbacks as an error:

{
  "resolutions": { "react-native": "0.63.4" }
}

If you encounter a build error indicating you don't have these, you should add them. Apparently Expo is working on making this step simpler with a single symlink.

Typically you have to do this: