Yarn’s workspaces transforms the original code base into a “mono-repository” to give focus to smaller parts of a larger project. It automatically aggregates all the dependencies from multiple package.json files to install them concurrently. Similarly, there is a single yarn.lock file that sits on the root to lock the dependencies all at once. Yarn also create symlinks between all the dependent workspaces to bring the latest code to use pervasively.
“By making workspaces native to Yarn, we hope to enable faster and lighter installations by preventing package duplication between the smaller parts of a larger project,” Facebook’s team, consists of Burak Yiğit Kaya, Christoph Nakazawa and Maël Nison, writes in a blog post.
Other notable improvements
The latest Yarn version automates the handling process of a merge conflict that emerges once dependencies get updated in separate pull requests subsequently. You can leverage the advanced integration by running yarn install command.
Facebook has also added a selective version resolution feature to the new Yarn release. This new addition helps you to define a resolutions field in your project’s package.json file to instruct the package manager to use specific versions of certain sub-dependencies. It is vital when you need to push important bug fixes or critical security updates to your packages. Besides, there are several bug fixes and security improvements on board.