Where Can I find Deno Third Party Modules?
Nick Scialli
May 24, 2020
As we explore the Deno ecosystem, we need to know where we can locate third party modules.
Where to Go
If you’re looking for Deno third party modules, look no further than https://deno.land/x!
deno.land/x is self-described as follows:
deno.land/x is a URL rewriting service for Deno scripts. The basic format of code URLs is https://deno.land/x/MODULE_NAME@BRANCH/SCRIPT.ts. If you leave out the branch, it will default to the module’s default branch, usually master.
How to Find and Use a MySQL ORM Module
deno.land/x has a handy type-ahead search function that helps you find modules. For example, if I’m looking for a MySQL ORM:
Once you’ve found the module you want, you can just import the correct URL in the file you’re using it in.
import { Database } from 'https://deno.land/x/denodb/mod.ts';
Consider Specifying a Version!
If you recall from the quote above, we can optionally specify a branch name in our import statement (e.g., https://deno.land/x/MODULE_NAME@BRANCH/SCRIPT.ts
).
We should absolutely do this! If you’re familiar with nodejs development, it would seem like a really bad idea to not pin down the versions of our dependencies. Therefore, let’s amend our import to make sure we pin down the version of denodb
that we’re using.
import { Database } from 'https://deno.land/x/denodb@v1.0.0/mod.ts';
And there we have it! We now know how to find third party modules, importing them into our projects, and pinning down the correct version.
Nick Scialli is a senior UI engineer at Microsoft.