Skip to main content
On this page

Publishing packages

Any Deno program that defines an export can be published as a package for other developers to import. This page covers where to publish and how.

Choose a registry Jump to heading

  • JSR: the recommended registry for Deno-first packages. It accepts TypeScript directly (no build step), generates documentation from your JSDoc comments, and serves packages to Deno, Node.js, and other runtimes.
  • npm: publish here when your consumers are primarily on Node.js or need npm tooling. Use deno pack to build an npm-compatible tarball from a Deno project, or dnt for a more configurable build pipeline.
  • deno.land/x: the legacy registry for HTTPS imports. For new packages, prefer JSR.

Publish to JSR Jump to heading

Give your package a name, a version, and an entry point in deno.json:

deno.json
{
  "name": "@scope/my-package",
  "version": "1.0.0",
  "exports": "./mod.ts"
}

The name is always scoped (@scope/name). Create the scope on jsr.io the first time you publish.

Check what will be published, then publish:

>_
deno publish --dry-run   # verify the file list and metadata
deno publish             # opens jsr.io to authenticate, then publishes

deno publish type-checks your code and verifies that your exports don't rely on anything outside the package before uploading. See the deno publish reference for flags, and Publishing packages on jsr.io for scopes, versioning, provenance, and publishing from CI.

To bump the version field between releases, you can use deno bump-version.

Publish to npm Jump to heading

deno pack (Deno 2.8+) builds an npm-compatible tarball from a Deno-first project: it transpiles TypeScript, generates type declarations, and produces the package.json metadata npm expects.

>_
deno pack                # creates the tarball
npm publish ./package.tgz

For older setups or builds that need fine-grained control over the output (shims, multiple targets, test running during the build), use dnt, the Deno-to-npm build tool.

Workspaces Jump to heading

In a workspace, deno publish publishes every workspace member that has a name and version, in dependency order. See publishing workspace packages for the details.

Keep going Jump to heading

Did you find what you needed?

Edit this page
Privacy policy