DEV Community

Cover image for How to insert an Expo project in a Monorepo

How to insert an Expo project in a Monorepo

Mauricio Reatto Duarte on April 09, 2020

Introduction In this post, I'll cover about adding an Expo project inside a Monorepo project. I found on the internet so many people try...
Collapse
 
vpicone profile image
Vince Picone

This was super helpful thank you! One point of confusion for the dependencies. If you're adding it to the root, you shouldn't need to specify a workspace right? Also I don't the the metro-config dep is necessary.

So this:

 yarn workspace @monorepo/expo-app add expo-yarn-workspaces metro-config -D -W
Enter fullscreen mode Exit fullscreen mode

Could be:

   yarn workspace add -D -W expo-yarn-workspaces
Enter fullscreen mode Exit fullscreen mode
Collapse
 
albertgao profile image
AlbertGao • Edited

AlbertGao@Albert-LottoNZ-Laptop monorepo % pwd
/Users/AlbertGao/codes/teamingCloud/workspace/monorepo
AlbertGao@Albert-LottoNZ-Laptop monorepo % yarn workspace @monorepo/universal add expo-yarn-workspaces metro-config -D -W
yarn workspace v1.22.4
error Cannot find the root of your workspace - are you sure you're currently in a workspace?
info Visit yarnpkg.com/en/docs/cli/workspace for documentation about this command.
AlbertGao@Albert-LottoNZ-Laptop monorepo %

Thanks for the post!
Stuck at the 1st step... Anything I am missing?

Collapse
 
mauriciord profile image
Mauricio Reatto Duarte Expo Lovers ♥️

As the error says, are you in a workspace?

// /Users/AlbertGao/codes/teamingCloud/workspace/monorepo/package.json

{
  "name": "monorepo",
   // ...
  "workspaces": {
    "packages": [
      "packages/*"
    ]
  },
Collapse
 
albertgao profile image
AlbertGao

Thanks! I wondered why there is no such creating step in the blog, then I thought yarn might magic figure it out, haha was wrong.

I ended up following the official yarn doc to create a workspace, and make sure it is working, then I followed the 2nd part of this blog to add the expo support, all good now!

Thanks! :)

Thread Thread
 
mauriciord profile image
Mauricio Reatto Duarte Expo Lovers ♥️

Thank you! I'll edit this post and write a link how to config an monorepo.

Collapse
 
jeloagnasin profile image
jeloagnasin

How do we setup for a bare workflow?

Collapse
 
leejunhui profile image
leejunhui

+1