Beginner
clideploy
Dependency Management
It is unwieldy to have to import the same remote module over and over again. Deno provides some conventions to make managing dependencies easier.
The Deno ecosystem has a convention to re-export all remote dependencies from a deps.ts file at the root of the repo. This keeps remote dependencies organized, and in a single place.
./deps.ts
!--frsh-copybutton:1-->
export * as http from "https://deno.land/std@0.175.0/http/mod.ts";
export * as path from "https://deno.land/std@0.175.0/path/mod.ts";
Other files can then import dependencies from the deps.ts file.
./main.ts
!--frsh-copybutton:3-->
import { path } from "./deps.ts";
Doing this makes package version upgrades really easy, as all external dependency specifiers live in the same file.
Run this example locally using the Deno CLI:
deno run https://byexample-wwv03xf36j0g.deno.dev/dependency-management/main.ts
Additional resources: