We are going to be going through Turborepo speeds up your builds and testing with caching. When a command is first run in Turborepo, it gets cached. This way if something has changed in one of your repos in your Monorepo, it will detect that change. For the repos that haven't changed, it will pull their info from the cache inside of
node_modules instead of fully re-running that command. For the repo that has changed, it will run that command solely on that repo.
Instructor: [0:00] The first time you run a command in Turborepo, it will cache it unless you tell it not to. All right, so this finished and it took around four seconds. Now, let's clear this and let's run it again. It only need took 55 milliseconds because everything is cache now. [0:19] Turborepo cache lives inside, node modules then .cash, then turbo, and here, you will find all the artifacts built by Turborepo. Let's open this 466 and this belongs to the utils package after being built.
[0:40] This one belongs to the next application and this one belongs to the Vijay's application. Now let's run npx turbo run, build again. Let's scroll all the way to the top and we see that utils build has this cache 466.
[0:58] Here, you have it, 466, belongs to the utils package. What you can do to delete the cache from your local machine, you can do RM, RF, and then delete the Turbo folder inside the cache, inside node modules.
[1:14] To recap, whenever you run a Turborepo pipeline, it is going to store the cache inside the node modules folder and then inside the cache folder and then inside the Turbo folder. To delete the local cache, you can just remove the Turbo folder inside .cache inside node modules.
[1:35] If we run npx Turbo run build again, we'll see that it is starts creating it from scratch. If we run this again, we'll see that Turborepo is not running those commands and instead, it is using the cache version.