How to add the yarn package from GitHub?

Short tips for using yarn

In my current project, I use yarn for managing JavaScript packages. A few days ago, I needed to add a very specific version of a package from the GitHub repository. To keep it in mind, how to add a package from GitHub repository using yarn, I prepared this short note. I hope you will find it useful.

To add yarn package from GitHub, you need to use this command:

yarn add <GitHub user name>/<GitHub repository name>

If you are interested in a specific branch or commit, you need to run the command:

yarn add <GitHub user name>/<GitHub repository name>#<branch/commit/tag>

And if you need very specific version of the package, you will use:

yarn add <package name>@<package version> --exact

Need help?

If you're looking for a Ruby developer with over a decade of experience, don't hesitate to contact me.

I have experience in a variety of domains, with a focus on short user feedback loops and teamwork. I can help you build a great product.