Another workflow that we are using are Zero-installs. The idea isn't that complicated. It's just that we decided to keep the cache of the project inside the repository itself. So, for each package that we have, we keep exactly one zip file into the repository. As a result, anyone that loads the project is able to instantly start working on Yarn. They don't even have to run Yarn install. More importantly, it means that our contributors are able to switch from one branch to another at almost no cost in terms of context switching. That's extremely valuable because it ties into the FAPR experimentation subject that I mentioned earlier.
We can quickly iterate on multiple different branches without having to pay the cognitive costs of having to run frequent installs each time you run git checkout. I safely need to mention that adding the packages of the cache into the repository is a trade-off that we made for our project, but it's not something that you absolutely have to do yourself if you're not convinced by the idea. We know that a few other projects have decided that they wanted to run Yarn install as they always used to and that's perfectly fine. It's just that nowadays you have the choice.
One problem when you have a lot of work spaces, and we have a lot, I think we have something like 44 at the moment, is that it becomes difficult to make sure that all the workspaces are aligned in their configuration. For instance, how do you ensure that no two work spaces will depend on different versions of the same dependency? It can become a daunting task and existing tools didn't help much with that. Now, thanks to the constraint feature in Yarn core, we are able to enforce past-period patterns across all work spaces in a very few lines. Better yet, Yarn can apply the fixes itself. So for example, the Yarn repository itself, we are using that feature, not only to enforce that all dependencies of all workspaces are the same one, but we also use it to ensure that, for example, the license is properly set on all of our packages, that the build scripts are consistent, this kind of thing. So, those three examples give you a good idea of what value approach projects can derive from Yarn. In general, they no longer need tools like learner or churn sets, as those workflows now receive first party support. But InterLab projects can benefit from Yarn as well, as we are going to see.
I work at Datalog, and Datalog is a huge web application along with a sizable JavaScript infrastructure supporting everything from linting to deployments. Yarn also central places in the engine, and we'll go over three examples. So, if you don't know what Datalog is, we are making some really good cloud monitoring, extracting signals out of arbitrary metrics. Given this DMA, it won't surprise you to know that we also monitor the way our developers interact with our own infrastructure, in particular in terms of response time. To achieve this, we wrote a plugin for Yarn that watches all scripts that get executed, how much time they take, and sends it all to the dashboard. All this data then helps us identify potential bottlenecks before they become a problem, and generally helps us prioritize our work. As we saw with the Yarn repository itself, checking in dependencies has poor full effect on one's ability to efficiently contribute to a project. But even in corporate environments, this pattern has its use. From our data, the remote registry goes down approximately once a month. By keeping our own copy of the packages, we're never blocked during our deployments.
Comments