-
Notifications
You must be signed in to change notification settings - Fork 222
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
feat: set up turborepo #2065
Merged
Merged
feat: set up turborepo #2065
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@cprussin is attempting to deploy a commit to the Pyth Network Team on Vercel. A member of the Team first needs to authorize it. |
Nice! |
cprussin
force-pushed
the
set-up-turborepo
branch
from
October 25, 2024 02:00
4df3bbc
to
4649cd5
Compare
cprussin
force-pushed
the
set-up-turborepo
branch
from
October 25, 2024 03:27
4649cd5
to
6f5fc3b
Compare
cprussin
force-pushed
the
set-up-turborepo
branch
from
October 25, 2024 03:38
6f5fc3b
to
06adab0
Compare
cprussin
force-pushed
the
set-up-turborepo
branch
from
October 25, 2024 04:49
06adab0
to
3ae5877
Compare
ali-bahjati
approved these changes
Oct 25, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
cprussin
force-pushed
the
set-up-turborepo
branch
from
October 25, 2024 17:45
3ae5877
to
e08052c
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR sets up turborepo for monorepo task orchestration.
Scope
This PR mostly just adds turborepo to the repository, configures it and some packages to hook their tasks into top level commands
test
,build
,start:dev
,start:prod
, andfix
, and converts commands that used to use lerna to use turbo instead. To do this correctly I had to restructure a bit of how some packages were built.But why?
A monorepo orchestration tool enables us to declaratively configure task orchestration between and within packages within the monorepo. It makes it much easier to define and reproduce complex build pipelines. It also enables caching task execution and re-running only what needs to run based on what's changing in the repo.
With a good monorepo orchestration tool properly configured, the typical development and CI commands are solely concerned with what you want to do (i.e. "start the dev servers") and not the steps required to accomplish that, and the tool ensures only necessary work is done and is cached and re-used as possible.
What about lerna?
We already had lerna in the monorepo, but lerna lacks many modern features of a monorepo task orchestration framework, including task caching and defining complex task dependency relationships (e.g. you must run
build
on all dependencies of a package before you can test it, or you must pull the.env.local
from Vercel before running a nextjs dev server, or that dependencies must be built before you can run typescript type checking, etc)Lerna isn't going away in this PR and is still useful for managing publishing and versioning packages. However, we are no longer using lerna for task orchestration.
What about nx?
I evaluated using nx which is used by lerna under the hood, but I found myself fighting a lot of UX issues with nx that made turborepo feel like a better fit here:
package.json
at the root, see https://nx.dev/deprecated/integrated-vs-package-based. While nx claims this is no longer the case, I found many issues where things just wouldn't work correctly or it was unclear how to use them in a repo where each package has it's ownpackage.json
. It's clear that our style of monorepo is not nx's primary intended use case.What about bazel/buck/etc?
I've used these tools in the past and while they're extremely powerful, they're also extremely complex and hard to configure correctly, and require a ton of maintenance and in many cases fairly significant changes to how packages are built.
Where those tools really shine is dealing inter-dependencies between packages from various programming languages. That could become valuable to us eventually, although it is possible to use turborepo in a polyglot environment (however it's a bit clunky). But for now, we are only managing javascript/typescript packages and bazel/buck/etc would be an extremely expensive lift compared to turborepo.
Perhaps this will be worth revisiting eventually if our needs for complex task orchestration between packages of different languages grows.
What's next?
There are a ton more things we can do to improve things, which I'll hold off as follow ups. Significant follow-up improvements would be:
build
task, and running thebuild
task in CI, to ensure changes don't break docker buildsfix