BlogBlog JungleworksGeneral

Yarn: Facebook weaves Efficient Script

By jwork 12th October 2016

The advent of innovations in the technological realm is underscored by the need to be flexible, and dynamic. While these terms have been used relentlessly to describe many recent softwares, like Angular 2.0, there’s always the danger of profit-motives or otherwise hurdling the path to this adaptability and freedom. Companies like Facebook and Google are always prowling for, and creating new software that incorporates these features.

The JavaScript community is an example of this adaptability, as it works on the tenets of the future economy – the sharing economy, with thousands of coders unifying and sharing their code in the form of freeware. This obviously saves many up and coming developers along with veterans, who don’t need to painstakingly keep re-writing the fundamentals of the same code over and over for newer permutations and combinations. As code increasingly becomes dependent on all these ‘packages’ that are linked to one another, the dependency factors are managed by JavaScript package managers.

Facebook, till date, had been managing with the help of the npm client. The npm client, which provides access to more than 300,000 packages in the npm registry is easily the most popular JavaScript package manager to date. Allegedly, it boasts a user base of over 5 million engineers, with an additional 5 billion downloads every month – no mean feat.

However, as concerns most freeware of this scale, the greatest issues come in the form of quality control and more importantly, security. The grade of the script can be trashy and inefficient depending on the engineer’s contribution and calibre. The security concern is obvious, with so many machines and co-dependents technically having access to these code packages.

quality code

Lastly, there were issues with consistency when installing dependencies across different machines and users and the amount of time it took to pull dependencies in – resulting in a LACK of adaptability and efficiency both.

To remedy this, Facebook has begun using its own dependency manager, Yarn. What’s more is, it is entirely open source, in collaboration with big, reliable names in the industry: Exponent, Google, and Tilde.

dependency manager Yarn

Here, the npm registry still exists and can be utilised. However, Yarn can install packages more quickly and manage dependencies consistently across machines or in secure offline environments. It enables engineers to move faster and with confidence when using shared code so they can focus on what matters — ensuring efficient quality control, along with targeted security measures that can be implemented on those sections of the code.

Facebook also alleges that Yarn is decidedly faster – as much as TEN times faster than npm, when it came to executing some of its projects – a bold allegation, and if verified, will significantly result in a shift as concerns this software. Facebook is scheduled to post proofs in the form of benchmarking results soon, to validate this.

Yarn is decidedly faster

Overall, this is a much anticipated release. Yarn’s synergy with npm makes it an immensely favourable option for engineers – it will be altogether only to easy to adapt to. In addition, the efficiency, optimization and targeted transfer of code from the registry to the engineer’s local environment as compared to npm give it a significant advantage.

cyber security

As far as security is concerned, Yarn imposes strict guarantees around package installation. The engineer has control over the scripts that are to be executed for the relevant packages. Checksums, or the sum of correct digits in this digital fragment of data is also stored in a lockfile, preventing breaches in the code when later referenced for troubleshooting or comparison.

All in all, a new, more efficient yarn that weaves code together – made open source in the spirit of the contemporary age. We look forward to a favourable reception of this release.

Subscribe to stay ahead with the latest updates and entrepreneurial insights!

  • Share this article:

  • Blog Jungleworks Blog Jungleworks Blog Jungleworks