Bun

bun outdated

使用 bun outdated 来检查项目中的过时依赖项。此命令会显示一个表格,列出有可用新版本的依赖项。

$bun outdated
bun outdated v1.3
Package
Current
Update
Latest
@sinclair/typebox
0.34.15
0.34.16
0.34.16
@types/bun (dev)
1.2.0
1.3.
1.3.
eslint (dev)
8.57.1
8.57.1
9.20.0
eslint-plugin-security (dev)
2.1.1
2.1.1
3.0.1
eslint-plugin-sonarjs (dev)
0.23.0
0.23.0
3.0.1
expect-type (dev)
0.16.0
0.16.0
1.1.0
prettier (dev)
3.4.2
3.5.0
3.5.0
tsup (dev)
8.3.5
8.3.6
8.3.6
typescript (dev)
5.7.2
5.7.3
5.7.3

版本信息

输出表格显示了三个版本列

  • Current: 当前安装的版本
  • Update: 满足你的 package.json 版本范围的最新版本
  • Latest: 发布到注册表中的最新版本

依赖项过滤器

bun outdated 支持通过包名和 glob 模式来搜索过时的依赖项。

要检查特定的依赖项是否过时,请将包名作为位置参数传递

$bun outdated eslint-plugin-security eslint-plugin-sonarjs
bun outdated v1.3
Package
Current
Update
Latest
eslint-plugin-security (dev)
2.1.1
2.1.1
3.0.1
eslint-plugin-sonarjs (dev)
0.23.0
0.23.0
3.0.1

你也可以传递 glob 模式来检查过时的包

$bun outdated 'eslint*'
bun outdated v1.3
Package
Current
Update
Latest
eslint (dev)
8.57.1
8.57.1
9.20.0
eslint-plugin-security (dev)
2.1.1
2.1.1
3.0.1
eslint-plugin-sonarjs (dev)
0.23.0
0.23.0
3.0.1

例如,要检查过时的 @types/*

$bun outdated '@types/*'
bun outdated v1.3
Package
Current
Update
Latest
@types/bun (dev)
1.2.0
1.3.
1.3.

或者排除所有 @types/*

$bun outdated '!@types/*'
bun outdated v1.3
Package
Current
Update
Latest
@sinclair/typebox
0.34.15
0.34.16
0.34.16
eslint (dev)
8.57.1
8.57.1
9.20.0
eslint-plugin-security (dev)
2.1.1
2.1.1
3.0.1
eslint-plugin-sonarjs (dev)
0.23.0
0.23.0
3.0.1
expect-type (dev)
0.16.0
0.16.0
1.1.0
prettier (dev)
3.4.2
3.5.0
3.5.0
tsup (dev)
8.3.5
8.3.6
8.3.6
typescript (dev)
5.7.2
5.7.3
5.7.3

工作区过滤器

使用 --filter 标志来检查不同工作区包中的过时依赖项

$bun outdated --filter='@monorepo/types'
bun outdated v1.3
Package
Current
Update
Latest
tsup (dev)
8.3.5
8.3.6
8.3.6
typescript (dev)
5.7.2
5.7.3
5.7.3

你可以传递多个 --filter 标志来检查多个工作区

$bun outdated --filter @monorepo/types --filter @monorepo/cli
bun outdated v1.3
Package
Current
Update
Latest
eslint (dev)
8.57.1
8.57.1
9.20.0
eslint-plugin-security (dev)
2.1.1
2.1.1
3.0.1
eslint-plugin-sonarjs (dev)
0.23.0
0.23.0
3.0.1
expect-type (dev)
0.16.0
0.16.0
1.1.0
tsup (dev)
8.3.5
8.3.6
8.3.6
typescript (dev)
5.7.2
5.7.3
5.7.3

你也可以传递 glob 模式来按工作区名称进行过滤

$bun outdated --filter='@monorepo/{types,cli}'
bun outdated v1.3
Package
Current
Update
Latest
eslint (dev)
8.57.1
8.57.1
9.20.0
eslint-plugin-security (dev)
2.1.1
2.1.1
3.0.1
eslint-plugin-sonarjs (dev)
0.23.0
0.23.0
3.0.1
expect-type (dev)
0.16.0
0.16.0
1.1.0
tsup (dev)
8.3.5
8.3.6
8.3.6
typescript (dev)
5.7.2
5.7.3
5.7.3

目录依赖项

bun outdated 支持检查 package.json 中定义的目录依赖项

bun outdated -r
┌────────────────────┬─────────┬─────────┬─────────┬────────────────────────────────┐
│ Package            │ Current │ Update  │ Latest  │ Workspace                      │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ body-parser        │ 1.19.0  │ 1.19.0  │ 2.2.0   │ @test/shared                   │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ cors               │ 2.8.0   │ 2.8.0   │ 2.8.5   │ @test/shared                   │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ chalk              │ 4.0.0   │ 4.0.0   │ 5.6.2   │ @test/utils                    │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ uuid               │ 8.0.0   │ 8.0.0   │ 13.0.0  │ @test/utils                    │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ axios              │ 0.21.0  │ 0.21.0  │ 1.12.2  │ catalog (@test/app)            │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ lodash             │ 4.17.15 │ 4.17.15 │ 4.17.21 │ catalog (@test/app, @test/app) │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ react              │ 17.0.0  │ 17.0.0  │ 19.1.1  │ catalog (@test/app)            │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ react-dom          │ 17.0.0  │ 17.0.0  │ 19.1.1  │ catalog (@test/app)            │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ express            │ 4.17.0  │ 4.17.0  │ 5.1.0   │ catalog (@test/shared)         │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ moment             │ 2.24.0  │ 2.24.0  │ 2.30.1  │ catalog (@test/utils)          │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ @types/node (dev)  │ 14.0.0  │ 14.0.0  │ 24.5.2  │ @test/shared                   │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ @types/react (dev) │ 17.0.0  │ 17.0.0  │ 19.1.15 │ catalog:testing (@test/app)    │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ eslint (dev)       │ 7.0.0   │ 7.0.0   │ 9.36.0  │ catalog:testing (@test/app)    │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ typescript (dev)   │ 4.9.5   │ 4.9.5   │ 5.9.2   │ catalog:build (@test/app)      │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ jest (dev)         │ 26.0.0  │ 26.0.0  │ 30.2.0  │ catalog:testing (@test/shared) │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ prettier (dev)     │ 2.0.0   │ 2.0.0   │ 3.6.2   │ catalog:build (@test/utils)    │
└────────────────────┴─────────┴─────────┴─────────┴────────────────────────────────┘

CLI 用法

$bun outdated filter

Flags

Scope & Filtering

-p,--production
不安装 devDependencies
-g,--global
全局安装
--omit=<val>
从安装中排除 'dev'、'optional' 或 'peer' 依赖项
-F,--filter=<val>
显示每个匹配工作区的过时依赖项
-r,--recursive
检查所有工作区中的过时包

Lockfile & Save Management

-y,--yarn
写入 yarn.lock 文件 (yarn v1)
--no-save
不更新 package.json 或保存锁定文件
--save
保存到 package.json(默认为 true)
--frozen-lockfile
不允许修改锁定文件
--save-text-lockfile
保存基于文本的锁定文件
--lockfile-only
生成锁定文件而不安装依赖项

Behavior & Performance

--dry-run
不安装任何东西
-f,--force
始终从注册表请求最新版本并重新安装所有依赖项
--no-verify
跳过验证新下载包的完整性
--ignore-scripts
跳过项目 package.json 中的生命周期脚本(依赖项脚本永远不会运行)
--trust
添加到项目 package.json 中的 trustedDependencies 并安装包。
--backend=<val>
用于安装依赖项的特定于平台的优化。可能的值:“clonefile”(默认值)、“hardlink”、“symlink”、“copyfile”。
--concurrent-scripts=<val>
生命周期脚本的最大并发作业数(默认 5)
--linker=<val>
链接器策略(“isolated”或“hoisted”之一)

Network & Registry

--ca=<val>
提供一个证书颁发机构签名证书。
--cafile=<val>
与 `--ca` 相同,但指向证书的文件路径。
--registry=<val>
默认使用特定的注册表,覆盖 .npmrc、bunfig.toml 和环境变量。
--network-concurrency=<val>
最大并发网络请求数(默认 48)

Output & Logging

--silent
不记录任何内容。
--quiet
打包时仅显示 tarball 名称。
--verbose
非常详细的日志记录。
--no-progress
禁用进度条。
--no-summary
不打印摘要。

Configuration & Context

-c,--config=<val>
指定配置文件路径 (bunfig.toml)
--cwd=<val>
设置特定的 cwd

Caching

--cache-dir=<val>
从特定目录路径存储和加载缓存数据。
--no-cache
完全忽略清单缓存。

Platform Overrides

--cpu=<val>
为可选依赖项覆盖 CPU 架构(例如,x64、arm64、* 表示所有)。
--os=<val>
为可选依赖项覆盖操作系统(例如,linux、darwin、* 表示所有)。

Help

-h,--help
打印此帮助菜单

Examples

显示当前工作区中的过时依赖项。
bun outdated
使用 --filter 来包含多个工作区。
bun outdated --filter="*"
bun outdated --filter="./app/*"
按名称模式过滤依赖项。
bun outdated jquery
bun outdated "is-*"
完整文档可在 https://bun.net.cn/docs/cli/outdated. 查看。