+1

Brand new NPM CI feature. Fastest dependencies installation.

With 5.7.0 release NPM introduced new npm ci command which allows to increase dependencies installation time significantly.

In order to achieve that, command ignores package.json contents and runs installation only for versions locked in package-lock.json file. In case those 2 files conflict with each other, it will throw an error.

In addition, it ignores contents of node_modules and removes directory if it exists.

All of that allows to use the command on environments which require fastest execution: CI systems.

Let’s run some tests:

Usage

npm install -g npm@5.7.1
npm ci

Note that NPM 5.7.0 contains a serious error and must not be used.

Performance

In order to run the tests let's use the following configuration:

Node v8.9.4
NPM v5.7.1
Yarn v1.3.2
npm install yarn install npm ci
No cache 12.62s 19.96s 8.425s
Cached 9.466s 3.89s 3.994s

As you can see, npm ci gives the best performance on dry-run and almost same performance as yarn on cached run.

Conclusion

The release of NPM 5.7.1 is still marked as Pre-release, however it gives very promising results and is definitely worth trying if you experience serious delays with your CI systems.


All rights reserved

Viblo
Hãy đăng ký một tài khoản Viblo để nhận được nhiều bài viết thú vị hơn.
Đăng kí