-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BACKLOG] Change monorepo tool from Nx to Turborepo #456
Comments
I believe @leomotors had some experience with Turbo too |
Turborepo versioning with Changeset is complete now! (I guess) https://github.com/saenyakorn/turborepo-versioning-demo |
From my direct experience, Turbo repo is more easily to use than nx a lot. It's also has well document too. |
🤔 |
Here's my full example of Turborepo versioning using Changeset. I also added building Docker workflow for deploy published app. You can fork the repo and play with it. |
Problem
TL;DR Nx is an over-engineer tool that makes everything harder. Use Turborepo instead.
To create a new app under Nx monorepo, you must use Nrwl CLI to generate it. For example, creating a Next.js app using
@nrwl/next
. Moreover, Nx does not use workspace feature of yarn or pnpm but uses their workspace management tools (e.g.nx.json
,project.json
), which is not a standard for developing Typescript/Javascript apps. It consumes lots of time to understand what it does, which means it's hard to create a new app in this repo. So, we'll deliver our new product late.One of the crucial problems is shared node_modules and single package.json. For now, to build the Docker image for each app. We have to build the target app outside Docker images before copying the files to its since we don't know which packages are used in the app. That's a really hacked technique. It may cause a problem when the local and the image environment do not match.
In addition,
node_modules
for just the Nx library is like a black hole for some reason.Nx is tough to integrate the python app into this repo. Since creating a new app needs their CLI, and there's no official CLI for python. I did not try it yet, but it would be F hard to integrate the python app into this repo now.
But Nx provided some good things for us.
build
,lint
,test
). Because of it, we can reduce workflow time usage by half.So, since Nx makes our life harder. I want to propose the new monorepo tools, Turborepo by Vercel
Why Turborepo?
Turborepo is a monorepo management tool that fully utilizes yarn or pnpm workspace features.
Turborepo is simple! The thing you need when creating a new app is just
package.json
, which contains a proper name, version, and some scripts. Each app will have its ownnode_modules
. It may be hard to clear allnode_modules
in the project, but I think it's not a big problem.Since Turborepo fully utilizes the workspace feature of Node package manager. You can run the app with simple commands like
yarn workspace app1 dev
orpnpm --filter app1 dev
. But using that command will not use the Turborepo feature; pipeline.Turborepo can run multiple tasks concurrently using the pipeline feature. You can read more about how it works here. https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks#most-tools-dont-optimize-for-speed
Note: pipeline is defined In
turbo.json
. It's a bit hard to understand, but only the maintainer has to define this. Then it's not a common problem.Turborepo also provides official instructions for building Docker images in their docs. You can follow it here. https://turbo.build/repo/docs/handbook/deploying-with-docker
In their docs, they also mention how to version the apps and packages using the different tools, which is great for us to make a proper process for versioning apps and packages.
Notes
I have been playing Turborepo recently for building Docler images and versioning the app. I'll write about them later when I fully prepare the demo.
Task Description
Step 1
Step 2
This task might affect other issues such as
Additional Context
My Demo
With Docker
With Versioning
Related Teams
Task Advisors
No response
The text was updated successfully, but these errors were encountered: