Bun

指南套件管理器

使用 bun install 為組織範圍配置私有 registry

可以使用 .npmrcbunfig.toml 配置私有 registry。 雖然兩者都支援,但我們建議使用 bunfig.toml 以獲得更強大的彈性和 Bun 專用選項。

為特定 npm 作用域配置 registry

bunfig.toml
[install.scopes]
# as a string
"@myorg1" = "https://username:password@registry.myorg.com/"

# as an object with username/password
# you can reference environment variables
"@myorg2" = {
  username = "myusername",
  password = "$npm_pass",
  url = "https://registry.myorg.com/"
}

# as an object with token
"@myorg3" = { token = "$npm_token", url = "https://registry.myorg.com/" }

您的 bunfig.toml 可以參考環境變數。 Bun 會自動從 .env.local.env.[NODE_ENV].env 載入環境變數。 有關更多資訊,請參閱 文件 > 環境變數

bunfig.toml
[install.scopes]
"@myorg3" = { token = "$npm_token", url = "https://registry.myorg.com/" }

有關 Bun 套件管理器的完整文件,請參閱 文件 > 套件管理器