mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
bun outdated docs (#13497)
Co-authored-by: Zack Radisic <zack@theradisic.com>
This commit is contained in:
@@ -82,7 +82,7 @@ _bun_completions() {
|
||||
declare -A PACKAGE_OPTIONS;
|
||||
declare -A PM_OPTIONS;
|
||||
|
||||
local SUBCOMMANDS="dev bun create run install add remove upgrade completions discord help init pm x test repl update link unlink build";
|
||||
local SUBCOMMANDS="dev bun create run install add remove upgrade completions discord help init pm x test repl update outdated link unlink build";
|
||||
|
||||
GLOBAL_OPTIONS[LONG_OPTIONS]="--use --cwd --bunfile --server-bunfile --config --disable-react-fast-refresh --disable-hmr --env-file --extension-order --jsx-factory --jsx-fragment --extension-order --jsx-factory --jsx-fragment --jsx-import-source --jsx-production --jsx-runtime --main-fields --no-summary --version --platform --public-dir --tsconfig-override --define --external --help --inject --loader --origin --port --dump-environment-variables --dump-limits --disable-bun-js";
|
||||
GLOBAL_OPTIONS[SHORT_OPTIONS]="-c -v -d -e -h -i -l -u -p";
|
||||
|
||||
@@ -179,6 +179,7 @@ complete -c bun -n "__fish_use_subcommand" -a "remove" -d "Remove a dependency f
|
||||
complete -c bun -n "__fish_use_subcommand" -a "add" -d "Add a dependency to package.json" -f
|
||||
complete -c bun -n "__fish_use_subcommand" -a "init" -d "Initialize a Bun project in this directory" -f
|
||||
complete -c bun -n "__fish_use_subcommand" -a "link" -d "Register or link a local npm package" -f
|
||||
complete -c bun -n "__fish_use_subcommand" -a "link" -d "Unregister a local npm package" -f
|
||||
complete -c bun -n "__fish_use_subcommand" -a "unlink" -d "Unregister a local npm package" -f
|
||||
complete -c bun -n "__fish_use_subcommand" -a "pm" -d "Additional package management utilities" -f
|
||||
complete -c bun -n "__fish_use_subcommand" -a "x" -d "Execute a package binary, installing if needed" -f
|
||||
complete -c bun -n "__fish_use_subcommand" -a "outdated" -d "Display the latest versions of outdated dependencies" -f
|
||||
|
||||
@@ -563,6 +563,22 @@ _bun_update_completion() {
|
||||
esac
|
||||
}
|
||||
|
||||
_bun_outdated_completion() {
|
||||
_arguments -s -C \
|
||||
'--cwd[Set a specific cwd]:cwd' \
|
||||
'--verbose[Excessively verbose logging]' \
|
||||
'--no-progress[Disable the progress bar]' \
|
||||
'--help[Print this help menu]' &&
|
||||
ret=0
|
||||
|
||||
case $state in
|
||||
config)
|
||||
_bun_list_bunfig_toml
|
||||
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_bun_test_completion() {
|
||||
_arguments -s -C \
|
||||
'1: :->cmd1' \
|
||||
@@ -669,6 +685,7 @@ _bun() {
|
||||
'add\:"Add a dependency to package.json (bun a)" '
|
||||
'remove\:"Remove a dependency from package.json (bun rm)" '
|
||||
'update\:"Update outdated dependencies & save to package.json" '
|
||||
'outdated\:"Display the latest versions of outdated dependencies" '
|
||||
'link\:"Link an npm package globally" '
|
||||
'unlink\:"Globally unlink an npm package" '
|
||||
'pm\:"More commands for managing packages" '
|
||||
@@ -740,6 +757,10 @@ _bun() {
|
||||
update)
|
||||
_bun_update_completion
|
||||
|
||||
;;
|
||||
outdated)
|
||||
_bun_outdated_completion
|
||||
|
||||
;;
|
||||
'test')
|
||||
_bun_test_completion
|
||||
@@ -819,6 +840,10 @@ _bun() {
|
||||
update)
|
||||
_bun_update_completion
|
||||
|
||||
;;
|
||||
outdated)
|
||||
_bun_outdated_completion
|
||||
|
||||
;;
|
||||
'test')
|
||||
_bun_test_completion
|
||||
|
||||
27
docs/cli/outdated.md
Normal file
27
docs/cli/outdated.md
Normal file
@@ -0,0 +1,27 @@
|
||||
Use `bun outdated` to display a table of outdated dependencies with their latest versions:
|
||||
|
||||
```sh
|
||||
$ bun outdated
|
||||
|
||||
|--------------------------------------------------------------------|
|
||||
| Packages | Current | Update | Latest |
|
||||
|----------------------------------------|---------|--------|--------|
|
||||
| @types/bun (dev) | 1.1.6 | 1.1.7 | 1.1.7 |
|
||||
|----------------------------------------|---------|--------|--------|
|
||||
| @types/react (dev) | 18.3.3 | 18.3.4 | 18.3.4 |
|
||||
|----------------------------------------|---------|--------|--------|
|
||||
| @typescript-eslint/eslint-plugin (dev) | 7.16.1 | 7.18.0 | 8.2.0 |
|
||||
|----------------------------------------|---------|--------|--------|
|
||||
| @typescript-eslint/parser (dev) | 7.16.1 | 7.18.0 | 8.2.0 |
|
||||
|----------------------------------------|---------|--------|--------|
|
||||
| esbuild (dev) | 0.21.5 | 0.21.5 | 0.23.1 |
|
||||
|----------------------------------------|---------|--------|--------|
|
||||
| eslint (dev) | 9.7.0 | 9.9.1 | 9.9.1 |
|
||||
|----------------------------------------|---------|--------|--------|
|
||||
| typescript (dev) | 5.5.3 | 5.5.4 | 5.5.4 |
|
||||
|--------------------------------------------------------------------|
|
||||
```
|
||||
|
||||
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.
|
||||
@@ -1083,6 +1083,7 @@ pub const HelpCommand = struct {
|
||||
\\ <b><blue>add<r> <d>{s:<16}<r> Add a dependency to package.json <d>(bun a)<r>
|
||||
\\ <b><blue>remove<r> <d>{s:<16}<r> Remove a dependency from package.json <d>(bun rm)<r>
|
||||
\\ <b><blue>update<r> <d>{s:<16}<r> Update outdated dependencies
|
||||
\\ <b><blue>outdated<r> Display latest versions of outdated dependencies
|
||||
\\ <b><blue>link<r> <d>[\<package\>]<r> Register or link a local npm package
|
||||
\\ <b><blue>unlink<r> Unregister a local npm package
|
||||
\\ <b><blue>patch <d>\<pkg\><r> Prepare a package for patching
|
||||
|
||||
@@ -111,6 +111,9 @@ fn Table(
|
||||
|
||||
pub const OutdatedCommand = struct {
|
||||
pub fn exec(ctx: Command.Context) !void {
|
||||
Output.prettyErrorln("<r><b>bun outdated <r><d>v" ++ Global.package_json_version_with_sha ++ "<r>", .{});
|
||||
Output.flush();
|
||||
|
||||
const cli = try PackageManager.CommandLineArguments.parse(ctx.allocator, .outdated);
|
||||
|
||||
const manager = PackageManager.init(ctx, cli, .outdated) catch |err| {
|
||||
@@ -183,9 +186,6 @@ pub const OutdatedCommand = struct {
|
||||
if (root_pkg_id == invalid_package_id) return;
|
||||
const root_pkg_deps = lockfile.packages.items(.dependencies)[root_pkg_id];
|
||||
|
||||
Output.prettyErrorln("<r><b>bun outdated <r><d>v" ++ Global.package_json_version_with_sha ++ "<r>", .{});
|
||||
Output.flush();
|
||||
|
||||
try updateManifestsIfNecessary(manager, log_level, root_pkg_deps);
|
||||
|
||||
try switch (Output.enable_ansi_colors) {
|
||||
|
||||
@@ -668,7 +668,7 @@ pub const Version = extern struct {
|
||||
const diff = this.version.whichVersionIsDifferent(this.other, this.buf, this.other_buf) orelse .none;
|
||||
|
||||
switch (diff) {
|
||||
.major => try writer.print(Output.prettyFmt("<b><red>{d}.{d}.{d}", true), .{
|
||||
.major => try writer.print(Output.prettyFmt("<r><b><red>{d}.{d}.{d}", true), .{
|
||||
this.version.major, this.version.minor, this.version.patch,
|
||||
}),
|
||||
.minor => {
|
||||
@@ -677,7 +677,7 @@ pub const Version = extern struct {
|
||||
this.version.major, this.version.minor, this.version.patch,
|
||||
});
|
||||
} else {
|
||||
try writer.print(Output.prettyFmt("<d>{d}.<r><yellow>{d}.{d}", true), .{
|
||||
try writer.print(Output.prettyFmt("<d>{d}.<r><b><yellow>{d}.{d}", true), .{
|
||||
this.version.major, this.version.minor, this.version.patch,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -46,20 +46,11 @@ what-bin@1.0.0:
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`outdated NO_COLOR works 1`] = `
|
||||
"|--------------------------------------|
|
||||
| Packages | Current | Update | Latest |
|
||||
|----------|---------|--------|--------|
|
||||
| a-dep | 1.0.1 | 1.0.1 | 1.0.10 |
|
||||
|--------------------------------------|
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`outdated normal dep, smaller than column title 1`] = `
|
||||
"┌──────────┬─────────┬────────┬────────┐
|
||||
│ [1m[34mPackages[0m │ [1m[34mCurrent[0m │ [1m[34mUpdate[0m │ [1m[34mLatest[0m │
|
||||
├──────────┼─────────┼────────┼────────┤
|
||||
│ no-deps[2m[0m │ 1.0.0 │ [2m1.0.0[0m │ [1m[31m2.0.0[0m │
|
||||
│ no-deps[2m[0m │ 1.0.0 │ [2m1.0.0[0m │ [0m[1m[31m2.0.0[0m │
|
||||
└──────────┴─────────┴────────┴────────┘
|
||||
"
|
||||
`;
|
||||
@@ -77,7 +68,7 @@ exports[`outdated dev dep, smaller than column title 1`] = `
|
||||
"┌───────────────┬─────────┬────────┬────────┐
|
||||
│ [1m[34mPackages[0m │ [1m[34mCurrent[0m │ [1m[34mUpdate[0m │ [1m[34mLatest[0m │
|
||||
├───────────────┼─────────┼────────┼────────┤
|
||||
│ no-deps[2m (dev)[0m │ 1.0.0 │ [2m1.0.0[0m │ [1m[31m2.0.0[0m │
|
||||
│ no-deps[2m (dev)[0m │ 1.0.0 │ [2m1.0.0[0m │ [0m[1m[31m2.0.0[0m │
|
||||
└───────────────┴─────────┴────────┴────────┘
|
||||
"
|
||||
`;
|
||||
@@ -95,7 +86,7 @@ exports[`outdated peer dep, smaller than column title 1`] = `
|
||||
"┌────────────────┬─────────┬────────┬────────┐
|
||||
│ [1m[34mPackages[0m │ [1m[34mCurrent[0m │ [1m[34mUpdate[0m │ [1m[34mLatest[0m │
|
||||
├────────────────┼─────────┼────────┼────────┤
|
||||
│ no-deps[2m (peer)[0m │ 1.0.0 │ [2m1.0.0[0m │ [1m[31m2.0.0[0m │
|
||||
│ no-deps[2m (peer)[0m │ 1.0.0 │ [2m1.0.0[0m │ [0m[1m[31m2.0.0[0m │
|
||||
└────────────────┴─────────┴────────┴────────┘
|
||||
"
|
||||
`;
|
||||
@@ -113,7 +104,7 @@ exports[`outdated optional dep, smaller than column title 1`] = `
|
||||
"┌────────────────────┬─────────┬────────┬────────┐
|
||||
│ [1m[34mPackages[0m │ [1m[34mCurrent[0m │ [1m[34mUpdate[0m │ [1m[34mLatest[0m │
|
||||
├────────────────────┼─────────┼────────┼────────┤
|
||||
│ no-deps[2m (optional)[0m │ 1.0.0 │ [2m1.0.0[0m │ [1m[31m2.0.0[0m │
|
||||
│ no-deps[2m (optional)[0m │ 1.0.0 │ [2m1.0.0[0m │ [0m[1m[31m2.0.0[0m │
|
||||
└────────────────────┴─────────┴────────┴────────┘
|
||||
"
|
||||
`;
|
||||
@@ -126,3 +117,12 @@ exports[`outdated optional dep, larger than column title 1`] = `
|
||||
└──────────────────────────┴────────────────┴────────────────┴────────────────┘
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`outdated NO_COLOR works 1`] = `
|
||||
"|--------------------------------------|
|
||||
| Packages | Current | Update | Latest |
|
||||
|----------|---------|--------|--------|
|
||||
| a-dep | 1.0.1 | 1.0.1 | 1.0.10 |
|
||||
|--------------------------------------|
|
||||
"
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user