使用 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 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 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 中定义的目录依赖项
┌────────────────────┬─────────┬─────────┬─────────┬────────────────────────────────┐
│ 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 用法
Flags
Scope & Filtering
从安装中排除 'dev'、'optional' 或 'peer' 依赖项
Lockfile & Save Management
写入 yarn.lock 文件 (yarn v1)
保存到 package.json(默认为 true)
Behavior & Performance
跳过项目 package.json 中的生命周期脚本(依赖项脚本永远不会运行)
添加到项目 package.json 中的 trustedDependencies 并安装包。
用于安装依赖项的特定于平台的优化。可能的值:“clonefile”(默认值)、“hardlink”、“symlink”、“copyfile”。
--concurrent-scripts=<val>
生命周期脚本的最大并发作业数(默认 5)
链接器策略(“isolated”或“hoisted”之一)
Network & Registry
默认使用特定的注册表,覆盖 .npmrc、bunfig.toml 和环境变量。
--network-concurrency=<val>
最大并发网络请求数(默认 48)
Platform Overrides
为可选依赖项覆盖 CPU 架构(例如,x64、arm64、* 表示所有)。
为可选依赖项覆盖操作系统(例如,linux、darwin、* 表示所有)。
Examples
显示当前工作区中的过时依赖项。
bun outdated
使用 --filter 来包含多个工作区。
bun outdated --filter="*"
bun outdated --filter="./app/*"
按名称模式过滤依赖项。
bun outdated jquery
bun outdated "is-*"
完整文档可在 https://bun.net.cn/docs/cli/outdated. 查看。