DEV Community

Cover image for Installing EmberJS v2 addons from GitHub forks using PNPM
Michal Bryxí
Michal Bryxí

Posted on

1

Installing EmberJS v2 addons from GitHub forks using PNPM

The problem

If you're using PNPM as a package manager for your EmberJS project and you find yourself in a need to install a v2 addon from git(hub) fork (because you have a branch with patched version), then you might find that GitHub URLs in package.json tricks don't work for you.

The analysis

Reason for this is because v2 addons are a monorepo and we're still in the phase where pretty much every tool out there lacks good support/DX for monorepos.

There are different possible solutions for different cases:

  • gitpkg.vercel.app - Using sub folders of a repo as yarn/npm dependencies made easy.
  • pnpm patch - Prepare a package for patching
  • patch-package - Lets app authors instantly make and keep fixes to npm dependencies.

But if you happen to use PNPM in your project you might get away with providing a customised git URL.

The solution

Let's assume I have a patch branch of ember-highcharts that has latest commit of SHA: 7995a3e7d2203ce174c39e186acc9257d883bf61. The web URL is:

https://github.com/MichalBryxi/ember-highcharts/tree/7995a3e7d2203ce174c39e186acc9257d883bf61
Enter fullscreen mode Exit fullscreen mode

I can add this patched fork to my project as follows:

pnpm add -D 'github:MichalBryxi/ember-highcharts#7995a3e7d2203ce174c39e186acc9257d883bf61&path:ember-highcharts'
Enter fullscreen mode Exit fullscreen mode

Where:

  • github: Shorthand for pnpm to know where the code is hosted
  • MichalBryxi - My github namespace
  • ember-highcharts - Name of the repo (my fork)
  • 7995a3e7d2203ce174c39e186acc9257d883bf61 - respective commit that contains the patch I'm interested in
  • path:ember-highcharts - In this v2 addon the ember-highcharts subdirectory contains the code for the addon

Conclusion

With PNPM it is possible to install EmberJS v2 addons, or any other packages living in monorepos, from GitHub forks.

Neon image

Serverless Postgres in 300ms (!)

10 free databases with autoscaling, scale-to-zero, and read replicas. Start building without infrastructure headaches. No credit card needed.

Try for Free →

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Dive into this insightful write-up, celebrated within the collaborative DEV Community. Developers at any stage are invited to contribute and elevate our shared skills.

A simple "thank you" can boost someone’s spirits—leave your kudos in the comments!

On DEV, exchanging ideas fuels progress and deepens our connections. If this post helped you, a brief note of thanks goes a long way.

Okay