原文地址:https://blog.csdn.net/mangoyiy/article/details/79972759
Yarn是一個快速可靠安全的依賴管理工具。
主要的三個特點:
極其快速,Yarn會緩存它下載的每個包,所以無需重復下載。它還能並行化操作以最大化資源利用率。
特別安全,Yarn會在每個安裝包被執行前校驗其完整性
超級可靠, Yarn使用格式詳盡而又簡潔的lockfile文件和確定性算法來安裝依賴,能夠保證在一個系統上的運行的安裝過程也會以同樣的方式運行在其他系統上
關於yarn.lock文件,官網的解釋如下:
Managed by Yarn
Your yarn.lock file is auto-generated and should be handled entirely by Yarn. As you add/upgrade/remove dependencies with the Yarn CLI, it will automatically update your yarn.lock file. Do not edit this file directly as it is easy to break something.
Current package only
During install Yarn will only use the top-level yarn.lock file and will ignore any yarn.lock files that exist within dependencies. The top-level yarn.lock file includes everything Yarn needs to lock the versions of all packages in the entire dependency tree.
yarn.lock的具體的作用是什么?它能給項目帶來什么作用?
Yarn使用確定性算法,在將文件放置到需要的位置之前構建整個依賴關系樹。安裝過程中重要信息存儲到yarn.lock文件中,以便可以在安裝依賴關系的每個系統之間共享!此文件包含有關已安裝的每個依賴項的確切版本的信息以及代碼的校驗和以確保代碼完全相同。
此文件會鎖定你安裝的每個依賴項的版本,這可以確保你不會意外獲得不良依賴;
並且會避免由於開發人員意外更改或則更新版本,而導致糟糕的情況!
