pnpm cache path
添加于:v11.22.0
打印 pnpm 用于元数据缓存的目录,与 pnpm store path 对应。输出的路径是绝对路径且经过了词法清理,因此使用相对路径配置 cacheDir 也能生成可供其他工具使用的路径。
pnpm cache path
pnpm 根据平台和 cacheDir 设置来确定该目录,因此,想要缓存该目录的 CI 配置无需再手动复刻这一解析逻辑:
.github/workflows/ci.yaml
- name: 获取缓存目录
run: echo "PNPM_CACHE_DIR=$(pnpm cache path)" >> $GITHUB_ENV
Besides registry metadata and the pnpm dlx cache, that directory holds the lockfile verification log: the record of which lockfile passed which supply-chain policies. Restoring it lets a job skip re-verifying a lockfile the log already covers under the policies currently configured. That check is the dominant cost of an install in CI once the store is warm. 从 v11.22.0 开始,pnpm store prune 不再删除该日志。
important
仅在受信任作业可写入的位置缓存此目录。有关详细信息,请参阅 cacheDir 设置。