简体   繁体   中英

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

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM