如何省略包含在我的 yarn.lock 文件中的包? [英] How do I omit a package from being included in my yarn.lock file?

查看:267
本文介绍了如何省略包含在我的 yarn.lock 文件中的包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,在我的 package.json 中,我有一堆 npm 库,还有一个从 git ssh url 拉入的私有存储库,它需要始终是最新版本.yarn.lock 添加了 git sha 和 yarn upgrade 等不会获取最新的.

So in my package.json I have a bunch of npm libs, and one private repo being pulled in from a git ssh url which needs to always be the latest build. The yarn.lock adds the git sha and yarn upgrade etc won't grab the newest one.

基本上,鉴于此:

"dependencies": {
  "some-package"        : "^0.x.x",
  "some-other-package"  : "*",
  "my-private-git-repo" : "git+ssh://git@bitbucket.org/me/myrepo.git",
  "lastlibrary"         : "^4.0.3"
},

我希望 yarn.lock 或 npm shrinkwrap 忽略 my-private-git-repo

I want yarn.lock or npm shrinkwrap to ignore my-private-git-repo

这可能吗?

推荐答案

好吧,我设法通过使用 Perl 从文件本身中删除缓存条目来解决这个问题.

Well I managed to pull this off by using Perl to remove the cache entry from the file itself.

鉴于我的 package.json 有这个:

Given my package.json has this :

"postinstall": "bash ./scripts/after_install.sh",

我的 after_install.sh 现在有这个:

perl -0777 -i -pe 's/(?s)"myrepo.*?\n\n//s' ./yarn.lock

这篇关于如何省略包含在我的 yarn.lock 文件中的包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆