hayd / deno-udd

Update Deno Dependencies - update dependency urls to their latest published versions
MIT License
329 stars 18 forks source link

Update Deno Dependencies

Run this script to update your dependency urls to their latest published versions. Optionally run --test(s) to ensure that each dependency update is non-breaking.

deno-udd

ci-status

Note: udd is fundamentally different from something like npm or yarn. Other tools do a "distributed update" i.e. every user updates independently (and potentially to untested versions/configurations of dependencies). With udd precisely one person updates (a maintainer), and they can ensure that the new dependencies pass the test suite before commiting/releasing a new version. With udd every user has a fixed version of the dependencies.

Semantic versioning fragments are purely a convenience for the maintainer, and do not affect users.

Installation

Use deno install to install or update udd:

deno install -rf --allow-read=. --allow-write=. --allow-net https://deno.land/x/udd/main.ts

You may need to include the deno bin directory in your PATH.

Usage

For example, to update url imports inside deps.ts run:

udd deps.ts

To update all the ts files in your directory:

udd *.ts

To ensure that deno test is successful when updating each dependency:

udd deps.ts --test="deno test"

Scheduled github action

You might like to use a github action to execute udd each day, check whether there are dependency updates, and - if there are - create a pull request to your repository.

As an example see the .github/workflows/udd.yml file in the udd repository.

Thanks to Eliaz Bobadilla for the initial action implementation.

Semantic versioning

If you append a fragment #${token}${version} to your urls you can manage their update behavior:

Token Name udd updates to the latest version such that
^ Compatible major version is the same (if major=0 then same minor version)
~ Approximately major and minor version are the same (or both major=0)
< Less than less than the provided version
= Equal it's exactly this version

The version argument is optional for ^, ~ and = (the version passed is the version in the url).

Examples

-export { Application } from "https://deno.land/x/oak@v2.4.0/mod.ts#^";
+export { Application } from "https://deno.land/x/oak@v2.10.0/mod.ts#^";  // 3.x.y is not chosen

-export { decode } from "https://deno.land/std@v0.34.0/strings/decode.ts#=";
+export { decode } from "https://deno.land/std@v0.34.0/strings/decode.ts#=";  // no change

-export { Application } from "https://deno.land/x/abc@v0.1.10/mod.ts#<0.2.0";
+export { Application } from "https://deno.land/x/abc@v0.1.11/mod.ts#<0.2.0";  // 0.2.x is not chosen

-export { encode } from "https://deno.land/std@v0.34.0/strings/encode.ts#~";
+export { encode } from "https://deno.land/std@v0.36.0/strings/encode.ts#~";  // update to latest compatible

udd-in-action

Supported domains

udd supports the following registry domains:

Create an issue to request additional registries.


Logo by Drake Sauer.