|
| 1 | +--- |
| 2 | +title: "deno update" |
| 3 | +command: update |
| 4 | +openGraphLayout: "/open_graph/cli-commands.jsx" |
| 5 | +openGraphTitle: "deno update" |
| 6 | +description: "Update outdated dependencies with an interactive CLI" |
| 7 | +--- |
| 8 | + |
| 9 | +## Updating dependencies |
| 10 | + |
| 11 | +By default, the `update` subcommand will only update dependencies to |
| 12 | +semver-compatible versions (i.e. it won't update to a breaking version). |
| 13 | + |
| 14 | +```bash |
| 15 | +$ deno update |
| 16 | +Updated 1 dependency: |
| 17 | + - jsr:@std/fmt 1.0.0 -> 1.0.3 |
| 18 | +``` |
| 19 | + |
| 20 | +To update to the latest versions (regardless of whether it's semver compatible), |
| 21 | +pass the `--latest` flag. |
| 22 | + |
| 23 | +```bash |
| 24 | +$ deno update --latest |
| 25 | +Updated 3 dependencies: |
| 26 | + - jsr:@std/async 1.0.1 -> 1.0.8 |
| 27 | + - jsr:@std/fmt 1.0.0 -> 1.0.3 |
| 28 | + - npm:chalk 4.1.2 -> 5.3.0 |
| 29 | +``` |
| 30 | + |
| 31 | +## Selecting packages |
| 32 | + |
| 33 | +The `update` subcommand also supports selecting which packages to operate on. |
| 34 | + |
| 35 | +```bash |
| 36 | +$ deno update --latest chalk |
| 37 | +Updated 1 dependency: |
| 38 | + - npm:chalk 4.1.2 -> 5.3.0 |
| 39 | +``` |
| 40 | + |
| 41 | +Multiple selectors can be passed, and wildcards (`*`) or exclusions (`!`) are |
| 42 | +also supported. |
| 43 | + |
| 44 | +For instance, to update all packages with the `@std` scope, except for |
| 45 | +`@std/fmt`: |
| 46 | + |
| 47 | +```bash |
| 48 | +$ deno update --latest "@std/*" "!@std/fmt" |
| 49 | +Updated 1 dependency: |
| 50 | + - jsr:@std/async 1.0.1 -> 1.0.8 |
| 51 | +``` |
| 52 | + |
| 53 | +Note that if you use wildcards, you will probably need to surround the argument |
| 54 | +in quotes to prevent the shell from trying to expand them. |
| 55 | + |
| 56 | +### Updating to specific versions |
| 57 | + |
| 58 | +In addition to selecting packages to update, the `--update` flag also supports |
| 59 | +selecting the new _version_ specifying the version after `@`. |
| 60 | + |
| 61 | +```bash |
| 62 | + |
| 63 | +Updated 2 dependencies: |
| 64 | + - jsr:@std/async 1.0.1 -> 1.0.6 |
| 65 | + - npm:chalk 4.1.2 -> 5.2.0 |
| 66 | +``` |
| 67 | + |
| 68 | +## Workspaces |
| 69 | + |
| 70 | +In a workspace setting, by default `update` will only operate on the _current_ |
| 71 | +workspace member. |
| 72 | + |
| 73 | +For instance, given a workspace: |
| 74 | + |
| 75 | +```json |
| 76 | +{ |
| 77 | + "workspace": ["./member-a", "./member-b"] |
| 78 | +} |
| 79 | +``` |
| 80 | + |
| 81 | +Running |
| 82 | + |
| 83 | +```bash |
| 84 | +deno update |
| 85 | +``` |
| 86 | + |
| 87 | +from the `./member-a` directory will only update dependencies listed in |
| 88 | +`./member-a/deno.json` or `./member-a/package.json`. |
| 89 | + |
| 90 | +To include all workspace members, pass the `--recursive` flag (the `-r` |
| 91 | +shorthand is also accepted) |
| 92 | + |
| 93 | +```bash |
| 94 | +deno update --recursive |
| 95 | +deno update --latest -r |
| 96 | +``` |
0 commit comments