新增 Git 相依
Bun 支援直接將 GitHub 儲存庫新增為專案的相依。
terminal
bun add github:lodash/lodash
這會將以下內容新增到你的 package.json 中:
package.json
{
"dependencies": {
"lodash": "github:lodash/lodash"
}
}
Bun 支援多種指定 Git 相依的協議。
terminal
bun add git+https://github.com/lodash/lodash.git
bun add git+ssh://github.com/lodash/lodash.git#4.17.21
bun add git@github.com:lodash/lodash.git
bun add github:lodash/lodash#4.17.21
在可能的情況下,Bun 會將 GitHub 相依作為 HTTP tarball 下載,速度更快。
參見 bun install。