Reputation: 41
I have been trying to setup a monorepo using turborepo. I want to have a Nextjs application along with a React Native application (using Expo).
I have come as far as getting everything to work using yarn and it's no-hoist options as well as expo-yarn-workspaces. You can see my repo here: https://github.com/juliusmarminge/turbo-expo-next-starter. This is my first monorepo so not sure if it follows conventions by any means.
The issue I'm getting into is I don't want to be forced to use Yarn, especially since pnpm is getting more popular and I use it for most my other projects. Has anyone any experience in using Expo in a monorepo without using Yarn? Feels like all examples online is using it...
Thanks in advance, Julius
Upvotes: 3
Views: 1101
Reputation: 97
I was struggling with such setup in my project, until successfully solved it.
npm install -g pnpm@latest-10
touch pnpm-workspace.yaml
packages:
- backend
- frontend
- mobile
- shared
{
"name": "@mono/root",
"version": "1.0.0",
"author": "emadunan",
"private": true,
"workspaces": [
"backend",
"frontend",
"mobile",
"shared"
],
"scripts": {
"clean": "find ./ -name node_modules -type d -exec rm -rf {} +",
"dev": "pnpm run dev:backend & pnpm run dev:frontend & pnpm run dev:shared",
"dev:backend": "pnpm --filter @mono/backend run start:dev",
"dev:frontend": "pnpm --filter @mono/frontend run dev",
"dev:mobile": "pnpm --filter @mono/mobile run start",
"dev:shared": "pnpm --filter @mono/shared run watch"
},
"license": "ISC",
"devDependencies": {},
"dependenciesMeta": {
"react": {
"injected": true
},
"react-dom": {
"injected": true
}
}
}
pnpm run clean
rm -f pnpm-lock.yaml
pnpm store prune
pnpm config set node-linker=hoisted --location project
pnpm install
pnpm --filter mobile run start
pnpm --filter frontend run dev
pnpm --filter backend run dev
pnpm --filter shared run watch
Upvotes: 0
Reputation: 9
You can use it with pnpm AND get-workspaces (from yarn) to update your metro.config.js and to resolve node_modules.
Upvotes: -2