我如何保持纱线工作区依赖项同步 [英] How do I keep yarn workspaces dependencies in sync
本文介绍了我如何保持纱线工作区依赖项同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我的 yarn 工作区
中有多个包.
Let's say I have multiple packages in my yarn workspaces
.
@mycompany/utils
@mycompany/app
@mycompany/serv
假设每个包在 lodash
上都有一个 dependency
.我想确保它们都具有相同的 lodash
版本.
Let's say each of these packages has a dependency
on lodash
. I want to make sure that they all have the same lodash
version.
有没有办法在每个 package.json 中做到这一点?
Is there a way to do that in each of the package.json?
推荐答案
使用 syncpack
强制 monorepo 中的所有子包使用每个依赖项的相同版本.
Use syncpack
to force all sub-packages in a monorepo uses the same version of each dependency.
在根 package.json 中安装:
Install in the root package.json:
yarn add --dev -W syncpack
运行(推荐:使用 husky 在每次提交时运行):
Run (Recommnded: Run on every commit using husky):
syncpack list-mismatches
更多信息:https://github.com/JamieMason/syncpack
这篇关于我如何保持纱线工作区依赖项同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文