问题
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