How to install third-party JS packages in Frappe?

What is the right way to install third-party JS packages and import them to use them.

For example I want to use PDF.js. How can I use it and import it the correct way?