npm + RunKit

by Ross Boucher
Share on facebook or twitter

We love npm. Having instant access to every package is one of the best parts of RunKit. That's why we're really excited about our latest update, which you might have already noticed:

A close up of the RunKit link on npm page.
Click the RunKit link on the right of the package page on npm

Every package page on npmjs.org now has a try it out link in the sidebar. These links bring you to a custom RunKit page that has a pre-filled example, so you can try the package with one click. Here's what one look likes:

A screenshot of a browser with RunKit's package page, show on the left the try it now section, and on the right the README and source viewer.
The RunKit package page allows you to try the package and navigate it's README and source.

By default, this will just require the package and show you what was exported. We've added a few custom examples, but more importantly, we've also made a simple way for package authors to provide their own example, which we'll use to create the page.

Here's how you do it: just add the property "runkitExample" to your package.json, with the text of your example. Or, if you prefer, you can set "runkitExampleFilename" to point to a file in your package and we'll read the example out of that file. Simple.

As always, let us know what you think!

What is RunKit?

  • RunKit is an interactive playground for running Node.js in the cloud.
  • RunKit offers serverless functions with zero deploy time — prototype code changes in real time!
  • RunKit can be embedded in your tutorials and docs to make them interactive as seen on lodash.com, expressjs.com, and stripe.com.
Follow RunKit Blog updates with the RSS Feed
Follow @runkitdev on Twitter for the latest updates from RunKit
© 2015–2018 Playground Theory, Inc.