,

So you wanna yarn add a dependency from a git repo?

I’m posting this because, even if really basic stuff, I’ve bumped my head with this wall way too many times before successfully managing to accomplish the task: Use yarn add to pull a dependency while using a git repo as the source.

It is, in fact, really simple (though I feel is way to verbose (? ):

yarn add git+ssh://[email protected]:organization/project

You can even specify use a branch or particular commit by adding it at the end, like this:

# To point to a branch:
yarn add git+ssh://[email protected]:organization/project#dev
# To point to a commit we just use the hash (short one is this case):
yarn add git+ssh://[email protected]:organization/project#c8023772

It’s also listed in the official docs: https://yarnpkg.com/lang/en/docs/cli/add/

So, have you ever had to do this? Do you find it useful?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Comments (

)