bun pm
命令群組提供了一組用於操作 Bun 套件管理器的工具。
pack
建立目前工作區的 tarball
bun pm pack
pack
命令的選項
--dry-run
:執行所有任務,但不將 tarball 寫入磁碟。--destination
:指定儲存 tarball 的目錄。--filename
:指定要儲存 tarball 的確切檔案名稱。--ignore-scripts
:跳過執行 pre/postpack 和 prepare 指令碼。--gzip-level
:設定 gzip 的自訂壓縮等級,範圍從 0 到 9(預設為 9)。
注意:--filename
和 --destination
不能同時使用
bin
印出本機專案 bin
目錄的路徑
bun pm bin
/path/to/current/project/node_modules/.bin
印出全域 bin
目錄的路徑
bun pm bin -g
<$HOME>/.bun/bin
ls
印出目前專案中已安裝的依賴項及其已解析的版本列表,排除它們的依賴項。
bun pm ls
/path/to/project node_modules (135)
├── eslint@8.38.0
├── react@18.2.0
├── react-dom@18.2.0
├── typescript@5.0.4
└── zod@3.21.4
印出所有已安裝的依賴項,包含第 n 階依賴項。
bun pm ls --all
/path/to/project node_modules (135)
├── @eslint-community/eslint-utils@4.4.0
├── @eslint-community/regexpp@4.5.0
├── @eslint/eslintrc@2.0.2
├── @eslint/js@8.38.0
├── @nodelib/fs.scandir@2.1.5
├── @nodelib/fs.stat@2.0.5
├── @nodelib/fs.walk@1.2.8
├── acorn@8.8.2
├── acorn-jsx@5.3.2
├── ajv@6.12.6
├── ansi-regex@5.0.1
├── ...
whoami
印出您的 npm 使用者名稱。需要您使用 bunfig.toml
或 .npmrc
中的憑證登入 (`bunx npm login`)。
bun pm whoami
hash
產生並印出目前 lockfile 的雜湊值
bun pm hash
印出用於雜湊 lockfile 的字串
bun pm hash-string
印出儲存在目前 lockfile 中的雜湊值
bun pm hash-print
cache
印出 Bun 全域模組快取的路徑
bun pm cache
清除 Bun 全域模組快取
bun pm cache rm
migrate
遷移另一個套件管理器的 lockfile,而不安裝任何東西
bun pm migrate
untrusted
印出目前具有指令碼的未信任依賴項
bun pm untrusted
./node_modules/@biomejs/biome @1.8.3
» [postinstall]: node scripts/postinstall.js
These dependencies had their lifecycle scripts blocked during install.
trust
為未信任的依賴項執行指令碼,並新增至 trustedDependencies
bun pm trust <names>
trust
命令的選項
--all
:信任所有未信任的依賴項。
default-trusted
印出預設信任的依賴項列表
bun pm default-trusted
請參閱 GitHub 上的目前列表 這裡