Looks like we've saved almost more than 8,500 hours. And even better, all this saved time is time that your task runners aren't running. So whether those be GitHub Actions, Jenkins, GitLab CI CD, wherever they are, those are machines that don't have to do as much work.
So how can you get set up to do this too? An easy way is with npx create turbo at latest. I'll go ahead and run this, and I'll be prompted a few times. I already ran this in the background for the sake of the demo, but this will go ahead and grab a few files from GitHub, and you'll be set up and ready to go with your own monorepo.
A quick pro tip, install turbo globally. If I do turbo dash dash help here, you'll see that we get our help text. This makes it really easy to work in a monorepo, and now that I have that available, I can just type turbo build, and we'll start building the two applications in this monorepo in parallel. We'll see that we handled both of those builds, no problem, in parallel 14 seconds later.
I can also start throwing more tasks into the mix. I can throw a lint in next to those builds, and I will be doing lints across this repo in parallel as well. But you'll notice something interesting here. Two of these tasks were cache, and among the five that we ran, and even cooler, I can write turbo lint build, and we'll get a full turbo. This is all work that we've done before, we haven't changed any source code, we haven't changed anything about this repo, so why do that work again?
TurboRepo can also help you at develop time, so if I do turbo dev, we'll be running our docs development script and our web development script at the same time, and this actually gives me a nice opportunity to show off one thing that we love about monorepos, that you can use one shared library at the same time. So if I go ahead and open up packages UI here, we'll go ahead and maybe I'll edit this button such that I'll put a test text in front here. I went and grabbed us a browser to look at now, so we can see here in this web app, we have this test in front of the actual text, and then we can also jump to 3001, where our docs application is running, and we'll see docs here and test click me. I'll go ahead and remove that, get us back to where we were, and you can see that that hot reloaded in that docs application. I'll go ahead and grab 3000 again, and you can see test has gone as well here too. My changes just propagate one commit, and I'm done. We're a lot faster at develop time now, but what about the part that really matters? Shipping.
In just a few minutes, I can have TurboRepo help me at ship time too by building a fully distributed caching system that works across all my CI machines, as well as my development machine here too. I'm going to demonstrate this using GitHub and Vercel. There's a lot of other iterations that you can use to wire up all of these parts, but this is the quickest way for me to do this in the scope of a demo, and I can have this caching system done in just a few minutes. First things first, I need a repo to push my work to, so I'll go ahead and use gh-repo-create. I'll push a local repo here, and you'll see that this happens pretty quickly. I didn't even have to leave my terminal. Pretty convenient. And we'll eventually use this to push our work to Vercel. Vercel will use the Git integration and just understand when I push changes.
Comments