1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-30 02:59:11 -05:00
denoland-deno/tests/specs/update/mixed_workspace/__test__.jsonc
Nathan Whitaker 56f31628f7
feat: subcommand to view and update outdated dependencies (#26942)
Closes #20487

Currently spelled

```
deno outdated
```
and
```
deno outdated --update
```

Works across package.json and deno.json, and in workspaces.

There's a bit of duplicated code, I'll refactor to reduce this in follow
ups

## Currently supported:
### Printing outdated deps (current output below which basically mimics
pnpm, but requesting feedback / suggestions)

```
deno outdated
```
![Screenshot 2024-11-19 at 2 01
56 PM](https://github.com/user-attachments/assets/51fea83a-181a-4082-b388-163313ce15e7)

### Updating deps

semver compatible:
```
deno outdated --update
```
latest:
```
deno outdated --latest
```
current output is basic, again would love suggestions
![Screenshot 2024-11-19 at 2 13
46 PM](https://github.com/user-attachments/assets/e4c4db87-cd67-4b74-9ea7-4bd80106d5e9)

#### Filters
```
deno outdated --update "@std/*"
deno outdated --update --latest "@std/* "!@std/fmt"
```
#### Update to specific versions
```
deno outdated --update @std/fmt@1.0.2 @std/cli@^1.0.3
```

### Include all workspace members
```
deno outdated --recursive
deno outdated --update --recursive
```

## Future work
- interactive update
- update deps in js/ts files
- better support for transitive deps

Known issues (to be fixed in follow ups):
- If no top level dependencies have changed, we won't update transitive
deps (even if they could be updated)
- Can't filter transitive deps, or update them to specific versions

## TODO (in this PR):
- ~~spec tests for filters~~
- ~~spec test for mixed workspace (have tested manually)~~
- tweak output
- suggestion when you try `deno update`

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-20 15:22:15 -08:00

153 lines
3.9 KiB
Text

{
"tempDir": true,
"tests": {
// just to make sure install doesn't change the lockfile
"sanity_lockfile_up_to_date": {
"steps": [
{
"args": "install",
"output": "[WILDCARD]"
},
{
"args": [
"eval",
"const now = Deno.readTextFileSync('./deno.lock'); console.log(now.trim());"
],
"output": "deno.lock.orig.out"
}
]
},
"print_outdated_root": {
"steps": [
{
"args": "install",
"output": "[WILDCARD]"
},
{
"args": "outdated",
"output": "print_outdated/root.out"
}
]
},
"print_outdated_recursive": {
"steps": [
{
"args": "install",
"output": "[WILDCARD]"
},
{
"args": "outdated --recursive",
"output": "print_outdated/recursive.out"
}
]
},
"print_outdated_subdir": {
"steps": [
{
"args": "install",
"output": "[WILDCARD]"
},
{
"cwd": "member-a",
"args": "outdated",
"output": "print_outdated/member_a.out"
},
{
"cwd": "member-b",
"args": "outdated",
"output": "print_outdated/member_b.out"
}
]
},
"update_latest_root": {
"steps": [
{
"args": "install",
"output": "[WILDCARD]"
},
{
"args": "outdated --update --latest",
"output": "update_latest/root/update.out"
},
{
"args": "-A print_file.ts ./deno.json",
"output": "./update_latest/root/deno.json.out"
}
]
},
"update_latest_subdir": {
"steps": [
{
"args": "install",
"output": "[WILDCARD]"
},
{
"cwd": "member-a",
"args": "outdated --update --latest",
"output": "update_latest/subdir/member_a.out"
},
{
"args": "-A print_file.ts ./member-a/deno.json",
"output": "update_latest/subdir/member_a_deno.json.out"
},
{
"cwd": "member-b",
"args": "outdated --update --latest",
"output": "update_latest/subdir/member_b.out"
},
{
"args": "-A print_file.ts ./member-b/package.json",
"output": "update_latest/subdir/member_b_package.json.out"
}
]
},
"update_latest_recursive": {
"steps": [
{
"args": "install",
"output": "[WILDCARD]"
},
{
"args": "outdated --update --latest --recursive",
"output": "update_latest/recursive/update.out"
},
{
"args": "-A print_file.ts ./deno.json",
"output": "update_latest/root/deno.json.out"
},
{
"args": "-A print_file.ts ./member-a/deno.json",
"output": "update_latest/subdir/member_a_deno.json.out"
},
{
"args": "-A print_file.ts ./member-b/package.json",
"output": "update_latest/subdir/member_b_package.json.out"
}
]
},
"update_filtered": {
"steps": [
{
"args": "install",
"output": "[WILDCARD]"
},
{
"args": "outdated --update --latest --recursive @denotest/add @denotest/sub* !@denotest/breaking* aliased @denotest/with-subpath@0.5.0",
"output": "filtered/update.out"
},
{
"args": "-A print_file.ts ./deno.json",
"output": "./update_latest/root/deno.json.out"
},
{
"args": "-A print_file.ts ./member-a/deno.json",
"output": "./filtered/member_a_deno.json.out"
},
{
"args": "-A print_file.ts ./member-b/package.json",
"output": "./filtered/member_b_package.json.out"
}
]
}
}
}