DEV Community

Cover image for How to publish Deno modules
Craig Morten
Craig Morten

Posted on

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! 🚀

Top comments (2)

Collapse
 
robdwaller profile image
Rob Waller

Am I right in thinking then the Deno Land registry is no longer using that JSON config file?

Collapse
 
craigmorten profile image
Craig Morten • Edited

Hey Rob 👋

Yes you are correct - the Deno Land registry is now not using the old database.json file. In fact the file was deleted completely 3 days ago by the core team in this PR --> github.com/denoland/deno_website2/...

If you had a module previously on the registry using the database.json file then it should still be available provided it had a tagged version. I believe modules without tags / versions which were on the registry will be removed within the next 30 days if a new version is not published using the webhook approach - so it is advised you migrate modules to using the webhook asap! See below for an example warning message from the registry:

Deno registry warning for modules without tagged versions

The official (and afaik only) way to now upload modules to the Deno Land registry is via webhooks as per this article (and instructions also available on the deno.land/x page itself).