42 lines
1.4 KiB
Plaintext
42 lines
1.4 KiB
Plaintext
# 指定下載來源
|
|
registry=https://registry.npmjs.org/
|
|
|
|
# 自動儲存精確版本號 (不帶 ^ 或 ~),避免版本漂移
|
|
# save-exact=true
|
|
|
|
# 安全防禦:禁止安裝發布未滿 4 天的套件 (預防供應鏈攻擊)
|
|
# npm v11.10+
|
|
min-release-age=4
|
|
# pnpm
|
|
minimum-release-age=5760
|
|
|
|
# 嚴格版本檢查:若 Node 或 pnpm 版本不符 package.json 定義則報錯
|
|
# engine-strict=true
|
|
|
|
# 讓 pnpm 自動安裝缺失的 peer dependencies,減少手動維護的負擔
|
|
auto-install-peers=true
|
|
|
|
# 效能優化:讓 pnpm 盡可能解析出唯一的依賴版本
|
|
resolution-mode=highest
|
|
|
|
# ==========================================
|
|
# 團隊協作規範
|
|
# ==========================================
|
|
# 當 Lockfile 有變動但未對應安裝時,在 CI 環境直接報錯
|
|
# frozen-lockfile=true
|
|
|
|
# ==========================================
|
|
# Monorepo 結構與依賴管理
|
|
# ==========================================
|
|
# 強制使用 workspace: 協議,確保子專案互相引用時是指向原始碼而非 npm 上的版本
|
|
# save-workspace-protocol=true
|
|
|
|
# 禁止子專案之間出現循環依賴,避免構建時陷入死循環
|
|
# disallow-workspace-cycles=true
|
|
|
|
# 從根目錄解析 peerDependencies,確保全專案的 peer 依賴版本統一,減少重複打包
|
|
# resolve-peers-from-workspace-root=true
|
|
|
|
# 執行遞迴指令 (pnpm -r) 時包含根目錄 (適用於根目錄有腳本或工具時)
|
|
# include-workspace-root=true
|