How to publish notebook as /{package} instead of /{user}/{id}

How do I publish a notebook using the url that npmjs.org links to (in the form of “/{package}”) instead of “/{user}/{id}”?

For example, https://npm.runkit.com/lodash has example code using the lodash npm package. When I navigate to the same url but substittute lodash for one of my packages the only code there is importing the package (which looks to be the default).

I don’t see a way to publish as /{package name} I only see a way to publish as /{user name}/{notebook id}

1 Like

Hi stewie1570,

You actually publish packages like that through npm using their CLI tool. If you have npm on your local machine, you put the code in a folder and do npm publish from the command line.

We’re considering allowing you to publish notebooks to npm with a one-click button (as you mentioned, we might provide that option from the same publish panel). Sorry it doesn’t work that way today!

1 Like

@tolmasky

And how the authors of the packages published that notebook?

For my package (ethavatar), I only have module require in the notebook. Some other packages (for example lodash and meetup-api) also have some example in the notebook. How can I do this for my package?

Hi @filips123, If you want an example to show on the runkit package page you can use the runkitExample or runkitExampleFilename fields in your package.json. You can read more about that here: https://runkit.com/docs/resources