How to publish Deno modules

craigmorten

Craig Morten

Posted on August 4, 2020

How to publish Deno modules

So you've just written your first Deno module and now you want to make it available to the community. Here's how you can publish your module to the two most popular Deno registries:

Deno Land Registry

The main and likely most popular Deno registry is the official Deno Land registry itself. Here's how to add a GitHub repo to the registry:

  1. Navigate to the repository you want to add.

  2. Go to the Settings tab.

    GitHub repository home page with highlighted settings tab

  3. Click on the Webhooks tab.

    GitHub settings page with highlighted webhooks menu option

  4. Click on the Add webhook button.

    GitHub webhooks page with highlighted add webhook button

  5. Enter the URL https://api.deno.land/webhook/gh/<moduleName> in the Payload URL field, making sure to replace the <moduleName> part with the name of your module.

    New webhook page with filled in Payload URL textbox

  6. Select application/json as the content type.

    New webhook page with JSON content type selected

  7. Select the Let me select individual events radio button.

    New webhook page with individual events option selected

  8. Select only the Branch or tag creation checkbox.

    New webhook page with branch or tag creation option selected

  9. Click on the Add webhook button.

    New webhook page with add webhook button highlighted

  10. Confirm that your webhook has been added on the Webhook screen.

    GitHub webhooks page with newly created webhook highlighted in list

Once these steps have been completed, all that is left is to create a release / tag in you GitHub repo. Here's one way you can create a release in GitHub:

  1. Navigate to the repository you want to create a release for.

  2. Click on the Releases link on the right hand side menu.

    Alt Text

  3. Click on the Draft a new release button.

    Alt Text

  4. Fill out the Tag version field, Release title field and Describe this release textbox.

    Alt Text

  5. Click on the Publish release button.

    Alt Text

You should now be able to navigate to https://deno.land/x/ and search for your module, or navigate directly to your hosted module via https://deno.land/x/<moduleName>, again replacing <moduleName> with the name of your module. If it doesn't appear at first, try refreshing a couple of times - the registration and upload of a new module and tag can take a few seconds some times.

If after some time your module is still not appearing in the Deno registry some good things to try are:

  1. Navigate to your repo's Releases page and check that you successfully created the release.
  2. Navigate to your Webhooks settings page and check that you created the webhook exactly as described - clicking Edit or on the webhook link will take you to a page where you can edit your webhook.
  3. On the webhook edit page, navigate to the Recent Deliveries section at the bottom and click on the last on the delivery ids to expand out detailed information on the recent webhook requests and responses which can be useful for debugging.
  4. If all else fails, reach out to the Deno maintainers either by opening an issue on the deno_registry2 repository or by messaging on the #help channel of the Deno Discord.

For more information about the Deno registry, head over to it's landing page at https://deno.land/x/ (which also has usage guides) and check out this blog post on the v2 registry.

nest.land Registry

Another popular registry is the nest.land registry, a Deno registry on the blockchain. This registry has several nice features around security, immutability and being independent of any source code management system, i.e. it doesn't require you to be using git or GitHub.

Here's how you can upload to the nest.land registry:

  1. Navigate to the https://nest.land/ page in a browser.

  2. Click on the Get Started link.

    nest.land homepage with get started link highlighted

  3. Click on the No account? Sign up link.

    nest.land page with sign up link highlighted

  4. Fill out the Username field with a new, unique username for your account and enter a secret password into the Password and Confirm Password fields.

    nest.land page with username and password fields highlighted

  5. Click on the Create Account and Generate an API Key button.

    nest.land with the generate api key button highlighted

  6. You will be provided with your own unique API key. Note this and keep it secret and safe.

    nest.land page displaying new API key

  7. In an IDE / terminal of your choice, navigate to the root directory of the code you wish to publish as a module.

  8. Install the nest.land eggs CLI by executing deno install -A -f --unstable -n eggs https://x.nest.land/eggs@0.2.1/mod.ts in your terminal. Further details are available on the nest.land installation docs page.

  9. In your terminal execute eggs link <key>, making sure to replace <key> with the nest.land API key you generated earlier. This will save your API key on your local machine meaning you will be able to publish modules to nest.land without having to log in ever again. Further details are available in the nest.land docs.

  10. Initialize your module (similar to npm init) to configure it for nest.land by executing eggs init. This will prompt you to enter a series of information regarding the module such as the name, description, version etc. The outcome will be a newly created egg.json in the root directory of your project which is very similar to a package.json. See the nest.land docs for more information on initializing a module and details on the egg.json configuration.

  11. Publish your module by executing eggs publish. See the nest.land publish docs for further information.

  12. Confirm your module published successfully by navigating to the nest.land gallery and searching for your module.

  13. Clicking on your module should open a dedicated page including your module's readme and information on how to import your module from nest.land.

    SuperDeno module page in nest.land

If you have any issues, the nest.land docs are a good place to start. Alternatively you can reach out to the community and maintainers via the nest.land GitHub discussions or by raising an issue on the nest.land GitHub.


That's all folks! 🎉

Please drop any questions, queries and comments below. If your using a registry not mentioned in this article I would love to hear about it as well!

Till next time! 🚀

💖 💪 🙅 🚩
craigmorten
Craig Morten

Posted on August 4, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related