博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
npm 查看npm安装地址_慢速测量以测量NPM安装时间
阅读量:2513 次
发布时间:2019-05-11

本文共 4697 字,大约阅读时间需要 15 分钟。

npm 查看npm安装地址

The ability to quickly add dependencies to an npm project is a gift a curse -- the curse being you oftentimes have no control over those dependencies being available (i.e. the left-pad situation) and the have the potential to bloat your application or even increase project download time.  The truth is we should really be careful about what we depend on.

快速将依赖项添加到npm项目的能力是一种诅咒-诅咒是您通常无法控制那些可用的依赖项(即,左手的情况),并且有可能使您的应用程序膨胀甚至增加项目下载时间。 事实是,我们应该对所依赖的东西非常小心。

I recently found an awesome utility for measuring dependency download time and dependencies to dependencies:  .  Start by installing slow-deps:

我最近发现了一个很棒的实用程序,用于测量依赖项下载时间和对依赖项的依赖项: 。 首先安装慢速下降:

npm install -g slow-deps

After installed, navigate to the directory which hosts package.json and run slow-deps; the result will look something like this:

安装后,导航到托管package.json的目录并运行slow-deps ; 结果将如下所示:

# Test Repo:  aframe$ slow-depsAnalyzing 45 dependencies...[====================] 100% 0.0s---------------------------------------------------------------| Dependency                    | Time     | Size    | # Deps |---------------------------------------------------------------| semistandard                  | 1m 14.4s | 24 MB   | 242    || tween.js                      | 1m 10.7s | 22 MB   | 250    || budo                          | 1m 1.4s  | 14 MB   | 275    || mozilla-download              | 49.3s    | 26 MB   | 194    || karma                         | 39.8s    | 16 MB   | 153    || snazzy                        | 36.2s    | 9.7 MB  | 146    || karma-coverage                | 26.7s    | 8.0 MB  | 99     || browserify                    | 23s      | 6.4 MB  | 118    || codecov                       | 17.8s    | 3.9 MB  | 73     || istanbul                      | 12.1s    | 6.5 MB  | 55     || minifyify                     | 11.4s    | 4.8 MB  | 48     || browserify-css                | 10.7s    | 4.0 MB  | 29     || document-register-element     | 9.7s     | 62 KB   | 0      || browserify-derequire          | 9.5s     | 1.7 MB  | 42     || mocha                         | 7.2s     | 1.3 MB  | 34     || gh-pages                      | 6.2s     | 3.7 MB  | 22     || three                         | 5.5s     | 10.0 MB | 0      || sinon                         | 5.3s     | 1.0 MB  | 5      || karma-browserify              | 5.2s     | 1.0 MB  | 9      || webvr-polyfill                | 4.2s     | 898 KB  | 2      || karma-mocha-reporter          | 4s       | 104 KB  | 7      || uglifyjs                      | 3.9s     | 752 KB  | 6      || rimraf                        | 3.6s     | 157 KB  | 11     || karma-sinon-chai              | 3.2s     | 146 KB  | 1      || replace                       | 3s       | 341 KB  | 7      || chai                          | 2.8s     | 438 KB  | 3      || karma-mocha                   | 2.8s     | 18 KB   | 0      || karma-chrome-launcher         | 2.6s     | 56 KB   | 5      || browserify-istanbul           | 2.5s     | 84 KB   | 5      || exorcist                      | 2.5s     | 143 KB  | 6      || lolex                         | 2.3s     | 122 KB  | 0      || karma-env-preprocessor        | 2.2s     | 5.8 KB  | 0      || mkdirp                        | 2s       | 47 KB   | 2      || chai-shallow-deep-equal       | 2s       | 17 KB   | 0      || husky                         | 2s       | 14 KB   | 1      || karma-firefox-launcher        | 1.9s     | 13 KB   | 0      || deep-assign                   | 1.9s     | 11 KB   | 1      || sinon-chai                    | 1.9s     | 18 KB   | 0      || debug                         | 1.5s     | 37 KB   | 1      || object-assign                 | 1.3s     | 7.4 KB  | 0      || open                          | 1.3s     | 26 KB   | 0      || karma-chai-shallow-deep-equal | 1.2s     | 6.8 KB  | 0      || present                       | 1.1s     | 12 KB   | 0      || promise-polyfill              | 1.1s     | 17 KB   | 0      || style-attr                    | 1s       | 6.5 KB  | 0      |---------------------------------------------------------------Total time (non-deduped): 9m 2sTotal size (non-deduped): 167 MB

You can see that there are a few dependencies which really slow down the install process due to a massive amount of its own dependencies.  Yikes!

您会看到有一些依赖关系,由于其自​​身的大量依赖关系,这确实减慢了安装过程。 kes!

So what can you do?  You can look for alternative packages which perform the same function but possible more dependencies.  If you aren't running npm install often (i.e. not deploying often), maybe this install time isn't a big deal; if you are, however, it's good to know the bottlenecks!

所以,你可以做什么? 您可以寻找执行相同功能但可能有更多依赖性的替代软件包。 如果您不经常运行npm install (即不经常部署),那么此安装时间可能并不重要; 但是,如果您知道瓶颈,那就太好了!

翻译自:

npm 查看npm安装地址

转载地址:http://xfvwd.baihongyu.com/

你可能感兴趣的文章
【PDF】HTML中嵌入pdf的简单方法
查看>>
java集合系列——Map介绍(七)
查看>>
js导出表格
查看>>
Luogu P1550 [USACO08OCT]打井Watering Hole
查看>>
第7章 插件的使用和写法
查看>>
3283
查看>>
嘉为科技获得腾讯投资,拓展企业级IT运营管理市场
查看>>
java得到日期相减的天数
查看>>
安装denyhosts3.1版本报错如下
查看>>
12.1.2: How to Modify and Enable The Configurable Home Page Delivered Via 12.1.2 (Doc ID 1061482.1)
查看>>
Understanding Item Import and Debugging Problems with Item Import (Doc ID 268968.1)
查看>>
Alpha版总结会议
查看>>
Java--面试通关要点
查看>>
iOS 消息推送原理
查看>>
随笔1
查看>>
Codeforces 731 C.Socks-并查集+STL(vector+map)
查看>>
洛谷 P3383 【模板】线性筛素数-线性筛素数(欧拉筛素数)O(n)基础题贴个板子备忘...
查看>>
C语言中的正负数及其输出以及小数
查看>>
Android Fragments 详细使用
查看>>
【转】MySQL-Utilities,mysql工具包
查看>>