執行 bun install
會建立一個名為 bun.lock
的 lockfile。
應該提交到 git 嗎?
是
在不安裝的情況下產生 lockfile?
若要在不安裝到 node_modules
的情況下產生 lockfile,您可以使用 --lockfile-only
標記。即使 lockfile 與您專案的 package.json
(s) 是最新的,lockfile 也會始終儲存到磁碟。
bun install --lockfile-only
注意 - 使用 --lockfile-only
仍然會使用 registry metadata 和 git/tarball 依賴項填充全域安裝快取。
我可以選擇退出嗎?
在不安裝 lockfile 的情況下安裝
bun install --no-save
除了 bun.lock
之外,另外 安裝 Yarn lockfile。
bun install --yarn
[install.lockfile]
# whether to save a non-Bun lockfile alongside bun.lock
# only "yarn" is supported
print = "yarn"
文字型 lockfile
Bun v1.2 將預設 lockfile 格式更改為文字型 bun.lock
。現有的二進制 bun.lockb
lockfile 可以通過執行 bun install --save-text-lockfile --frozen-lockfile --lockfile-only
並刪除 bun.lockb
來遷移到新格式。
有關新 lockfile 格式的更多資訊,請參閱我們的部落格文章。