Skip to main content

upgrade

API

  1. Check for changes.

    import { difference } from "https://deno.land/x/upgrade@v1.0.1/difference.ts";
    
    const changes = await difference({
      directory: Deno.cwd(),
      extensions: ["js", "jsx", "ts", "tsx", "json"],
      allowBreaking: false,
      allowUnstable: false,
    });
  2. Submit changes.

    import { upgrade } from "https://deno.land/x/upgrade@v1.0.1/upgrade.ts";
    
    await upgrade(changes);

CLI

Setup

deno.json

{
  "tasks": {
    "upgrade": "https://deno.land/x/upgrade@v1.0.1/mod.ts"
  }
}

Usage

deno task upgrade
Command Description Default
-d, --directory The parent directory of the files to check. Current Working Directory
-e, --extensions Which file extensions to include. js,jsx,ts,tsx,json
-b, --breaking Allow breaking upgrades (major releases). false
-u, --unstable Allow unstable upgrades (prereleases). false
-q, --quick Disable interactive experience. false

Examples

  • Pin a dependency to a specific version by appending #pin at the end of the url.

    import * as semver from "https://deno.land/std@0.192.0/semver/mod.ts#pin";
  • Allow unstable upgrades.

    deno task upgrade -u
  • Set the parent directory to src.

    deno task upgrade -d src
  • Allow only .js and .ts files.

    deno task upgrade -e js,ts