2. Pruning an Offline Mirror

2. Pruning an Offline Mirror

After you configure your offline mirror, Yarn will automatically add new package tarballs to the mirror. However, it does not automatically remove tarballs that are no longer referenced in yarn.lock. For example, if you $ yarn remove a dependency, the tarball will remain in the mirror, even if no other dependencies have it as a sub-dependency. This behavior can be desirable in a setting where many projects share the same mirror, but when that is not the case, you may want to have Yarn remove unnecessary tarballs.

To turn on automating pruning, set yarn-offline-mirror-pruning to true in your .yarnrc:

$ yarn config set yarn-offline-mirror-pruning true

Now, tarballs will be removed when appropriate. The end result is that package.json, node_modules, yarn.lock, and the offline mirror should all remain perfectly in sync whenever you change your project’s dependencies.

© 2016–2017 Yarn Contributors
Licensed under the BSD License.
https://yarnpkg.com/en/docs/prune-offline-mirror

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部