Skip to content

Commit

Permalink
add --filter and package pattern arguments to bun outdated (#13557)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylan-conway authored Aug 27, 2024
1 parent 36c621b commit ba2ea6f
Show file tree
Hide file tree
Showing 8 changed files with 632 additions and 208 deletions.
38 changes: 36 additions & 2 deletions docs/cli/outdated.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Use `bun outdated` to display a table of outdated dependencies with their latest versions:
Use `bun outdated` to display a table of outdated dependencies with their latest versions for the current workspace:

```sh
$ bun outdated

|--------------------------------------------------------------------|
| Packages | Current | Update | Latest |
| Package | Current | Update | Latest |
|----------------------------------------|---------|--------|--------|
| @types/bun (dev) | 1.1.6 | 1.1.7 | 1.1.7 |
|----------------------------------------|---------|--------|--------|
Expand All @@ -25,3 +25,37 @@ $ bun outdated
The `Update` column shows the version that would be installed if you ran `bun update [package]`. This version is the latest version that satisfies the version range specified in your `package.json`.

The `Latest` column shows the latest version available from the registry. `bun update --latest [package]` will update to this version.

Dependency names can be provided to filter the output (pattern matching is supported):

```sh
$ bun outdated "@types/*"

|------------------------------------------------|
| Package | Current | Update | Latest |
|--------------------|---------|--------|--------|
| @types/bun (dev) | 1.1.6 | 1.1.8 | 1.1.8 |
|--------------------|---------|--------|--------|
| @types/react (dev) | 18.3.3 | 18.3.4 | 18.3.4 |
|------------------------------------------------|
```

## `--filter`

The `--filter` flag can be used to select workspaces to include in the output. Workspace names or paths can be used as patterns.

```sh
$ bun outdated --filter <pattern>
```

For example, to only show outdated dependencies for workspaces in the `./apps` directory:

```sh
$ bun outdated --filter './apps/*'
```

If you want to do the same, but exclude the `./apps/api` workspace:

```sh
$ bun outdated --filter './apps/*' --filter '!./apps/api'
```
3 changes: 3 additions & 0 deletions docs/nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ export default {
page("cli/update", "`bun update`", {
description: "Update your project's dependencies.",
}),
page("cli/outdated", "`bun outdated`", {
description: "Check for outdated dependencies.",
}),
page("cli/link", "`bun link`", {
description: "Install local packages as dependencies in your project.",
}),
Expand Down
2 changes: 1 addition & 1 deletion src/bun.js/api/glob.zig
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ pub fn match(this: *Glob, globalThis: *JSGlobalObject, callframe: *JSC.CallFrame
break :codepoints codepoints.items[0..codepoints.items.len];
};

return JSC.JSValue.jsBoolean(globImpl.matchImpl(codepoints, str.slice()));
return if (globImpl.matchImpl(codepoints, str.slice())) .true else .false;
}

pub fn convertUtf8(codepoints: *std.ArrayList(u32), pattern: []const u8) !void {
Expand Down
Loading

0 comments on commit ba2ea6f

Please sign in to comment.