How do I omit a package from being included in my yarn.lock file?

故事扮演 提交于 2021-02-05 09:12:47

问题


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.

Basically, given this:

"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"
},

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

Is this possible?


回答1:


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

Given my package.json has this :

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

My after_install.sh now has this :

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



来源:https://stackoverflow.com/questions/43903978/how-do-i-omit-a-package-from-being-included-in-my-yarn-lock-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!