Facebook launches Yarn 1.0 with a feature to aggregate JavaScript dependencies automatically

0
4650
Facebook

Facebook's Yarn 1.0 with workspaces

Facebook’s development team has launched the first major release of Yarn JavaScript package manager 11 months after its initial release. The new version, Yarn 1.0, comes with a feature called workspaces that helps developers prevent package duplication between their projects.

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.

The Yarn 1.0 release is not the first development by Facebook to use workspaces as a solution to prevent package duplication. Projects like Babel are inherently using the same approach from the past several months. But the latest development brings workspaces to the mainstream and enables developers with the ease to refine their JavaScript projects.

“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.

Yarn 1.0 is a result of contributions from over 40 contributors. Importantly, Facebook is coverage a significant share in the open source space through Yarn that has been deployed on more than 175,000 GitHub projects and receives around 3 billion package downloads in a month. But what makes the solution successful is the collaborative efforts of Google, Exponent and Tilde that have partnered with the social networking giant to bring a convenient JavaScript package manager.

LEAVE A REPLY

Please enter your comment!
Please enter your name here