From f7fd73aa9db7599e4aa4b12bdd9bfe462910e62c Mon Sep 17 00:00:00 2001 From: Slate Rehm Date: Thu, 30 Jul 2026 21:49:08 -0500 Subject: [PATCH] build: pin pnpm so the Cloudflare build uses the right version The Cloudflare build image defaults to pnpm 10 and failed on `pnpm install --frozen-lockfile` with "packages field missing or empty". `pnpm-workspace.yaml` carries pnpm 11 keys (`allowBuilds`, `minimumReleaseAgeExclude`) and no `packages` field, because this repo is not a workspace and the file exists only to hold pnpm settings. `packageManager` fixes it at the source. pnpm 10 reads the field and switches to the pinned version before it installs, so the workspace file is parsed by the pnpm that understands it. Verified against a clean clone with the global pnpm config isolated: `pnpm@10.11.1 install --frozen-lockfile` reports "Done using pnpm v11.17.0" and succeeds. Adding a `packages` field would also have worked, but it would turn the repo into a single-package workspace to satisfy a version it should not be running. CI drops its hardcoded pnpm version and reads `packageManager` instead, so local, GitHub Actions, and Cloudflare all agree. --- .github/workflows/ci.yml | 4 ++-- package.json | 1 + pnpm-workspace.yaml | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d9cceb9..a59ffec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,9 @@ jobs: runs-on: blacksmith-4vcpu-ubuntu-2404 steps: - uses: actions/checkout@v4 + # No version here on purpose: it reads `packageManager` from + # package.json, so the pnpm version has one source of truth. - uses: pnpm/action-setup@v4 - with: - version: 11.17.0 - uses: actions/setup-node@v4 with: node-version: 24 diff --git a/package.json b/package.json index 15f506c..c108935 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.0.1", "type": "module", "private": true, + "packageManager": "pnpm@11.17.0", "engines": { "node": "24.x" }, diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 7daa764..cf041c9 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,3 +1,10 @@ +# This repo is not a workspace. The file exists only to hold pnpm settings. +# +# `allowBuilds` and `minimumReleaseAgeExclude` are pnpm 11 keys, and pnpm 10 +# rejects a workspace file that has no `packages` field. `package.json` pins +# `packageManager` to pnpm 11 so every environment agrees, including the +# Cloudflare build image, which defaults to pnpm 10. +# # Postinstall scripts pnpm is allowed to run. Without these, `pnpm