未加星标

Testing yarn, a fast npm for JavaScript

字体大小 | |
[数据库(综合) 所属分类 数据库(综合) | 发布者 店小二03 | 时间 2016 | 作者 红领巾 ] 0人收藏点击收藏

TL;DR: It’s crazy fast and you should get it asap

Hello,

Today, a group of engineers from Facebook, Google, Exponentjs and Tilde released a new tool called yarn . It’s a new tool aiming to replace npm and all the headaches introduced by this tool: slow installation…

The first step is to download the installation from the official website (I’m a windows user), or use the appropriate installation for linux or macOS.

Init a newproject

The command is like npm:

yarn init

It keeps asking you about project name, author… But after that it creates a basic package.json file, no big deal here.

Next step I tried the -y flag:

yarn init -y

It’s actually not working, just for the records.

Installing a simplepackage

Next test was installing a simple package: express.

Using npm: 11.99s

Using yang: 8.3s

Not bad. In fact, yarn cache your already downloaded packages for later use. So let’s try installing express one more time:

Using yang (2nd time): 1.33s

Well, that was fast…

Note:I know I need to run multiple times to get an average and all that… But this is just an article giving you a first glimpse and not a technical one.

In addition to this, you will have a new generated file called yarn.lock , it contains information about your installed packages and you project in general. So anyone forking your project will get the same thing inside the node_modules (wasn’t possible using npm).

Installing a complex package

Now let’s install a complex package: React native

Using npm: 334s

Using yarn: 265.93s

Note:Looks like yarn automatically detected that I don’t have a dependency (react) and downloaded it automatically, so the time can be less if it was already there.

In fact, React Native has a lot of dependencies! And the difference is just mind blowing…

That was the first time, if you ever want to install React Native from now on, all you need is:

Using yarn (2nd time): 77.18s

OK, that’s a lot of time saved.

I think I’ll use it from now on.

Thank you for reading:)

本文数据库(综合)相关术语:系统安全软件

分页:12
转载请注明
本文标题:Testing yarn, a fast npm for JavaScript
本站链接:http://www.codesec.net/view/482547.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 数据库(综合) | 评论(0) | 阅读(44)