Skip to content

Find outdated dependencies in your deno project

License

Notifications You must be signed in to change notification settings

LeoDog896/deno-outdated

Repository files navigation

deno-outdated

Pins your dependencies to the latest version & updates existing ones.

deno install --allow-read=./ --allow-net --allow-write=./ -f -n=deno-outdated https://deno.land/x/deno_outdated/cli.ts

Or, add it to your deno.json's (or deno.jsonc) tasks:

"update": "deno run --allow-read=./ --allow-net --allow-write=./ https://deno.land/x/deno_outdated/cli.ts",

You can even add a github action: https://github.com/LeoDog896/deno-outdated/blob/main/.github/workflows/update.yml

Do note that if you're running an application, remove the run action that removes deno.lock rm deno.lock, as that is only for libraries

Flags

  • -q, --quiet: Silence CLI output
  • -d, --debug: Add extra information to see scanning
  • -i, --ignore [files...]: Ignore certain files for formatting
  • -c, --check: Check files for outdated dependencies without updating them

Ignore

You can ignore updating for a line with i-deno-outdated, for example:

import { assert } from "https://deno.land/[email protected]/testing/asserts.ts" // i-deno-outdated

const source = `
const x = 'https://deno.land/[email protected]/testing/asserts.ts'; ${"i-deno-outdated" && ""} 
const x = 'https://deno.land/[email protected]/testing/asserts.ts' // i-deno-outdated ";
`;

Currently works with:

(Want to add more? Contribute to regex.ts)

What's the difference between this and UDD?

This tool aims to be similar to deno native tools such as deno fmt and deno lint, or aka shellable

Internal layout

Updating works by finding URLs in a source file, removing their version specifier, and redirecting it to the latest one.

This is split into different stacking modules:

Layer 1:

  • Redirect (redirect.ts) finds any simple redirects in that URL.
  • Removal (removal.ts) removes the version part of a URL. This is dependent on the vendor (deno.land/x, esm.sh).

Layer 2: (update.ts)

This updates a URL to its latest known version, if any.

Layer 3 (change.ts)

This is the API for the CLI app, and it allows you to scan files for outdated dependencies and update them.

Layer 4 (cli.ts)

This wraps everything around with cliffy for a nice CLI app.