Keep the docs deploy on pnpm so npm never runs - #2
Merged
Conversation
The deploy-docs run on the merge to main died in wrangler-action, not in wrangler: [command] npx --no-install wrangler --version npm error npx canceled due to missing packages [command] npm i wrangler@4 npm error code EUNSUPPORTEDPROTOCOL npm error Unsupported URL Type "workspace:": workspace:* The action picks a package manager by looking for a lockfile, but it looks in workingDirectory, not the repo root. apps/docs has no lockfile of its own, so detection returns null and the action falls back to npm. It then probes with `npx --no-install wrangler --version`, finds nothing (wrangler was not a dependency of anything), and shells out to `npm i wrangler@4` inside apps/docs, where npm meets "dowel": "workspace:*" and gives up. Two changes, either of which fixes it on its own. Together they mean npm is never reached even if one regresses. 1. packageManager: pnpm on the action. The input exists in v3 and is the supported way to override the lockfile sniff. It switches the probe to `pnpm exec wrangler --version`, the run command to `pnpm exec wrangler deploy`, and the fallback install to `pnpm add`, which understands the workspace protocol. 2. wrangler ^4.120.0 as a devDependency of apps/docs. pnpm install already runs before the deploy step, so the probe now finds a real wrangler, the version satisfies the pinned "4", and the action skips its install step entirely. This also pins the deploy tool in the lockfile instead of floating on whatever npm resolved that morning, and makes a local `pnpm exec wrangler deploy --dry-run` match CI. workerd joins allowBuilds because it arrives with wrangler and pnpm 11 exits 1 on an install that silently skipped a build script. Its install script links the platform binary. Verified by running the action's own bundle (cloudflare/wrangler-action@v3 dist/index.mjs) against this checkout with a bogus API token: the probe reports "Using Wrangler 4.120.0", no install step runs, no npm process is spawned, and the run reaches the Cloudflare API before failing on the fake credential. Separately, `pnpm exec wrangler deploy --dry-run` in apps/docs reads all 46 files from dist/. The real deploy stays unproven until this merges, since it needs the org token. Behaviour is otherwise unchanged: the job still skips rather than fails without CLOUDFLARE_API_TOKEN, dowel still builds before @dowel/docs, mise still supplies the toolchain, and wrangler.jsonc is untouched. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
deploy-docsfailed on the merge of #1. The failure is incloudflare/wrangler-action@v3, not in wrangler (run 31318765703):Why
The action sniffs for a package manager by looking for a lockfile, but it looks in
workingDirectory, not the repo root:apps/docshas no lockfile of its own (ours is at the repo root), so detection returnsnulland it falls back to npm. It probes withnpx --no-install wrangler --version, finds nothing because wrangler was not a dependency of anything, then runsnpm i wrangler@4insideapps/docs, where npm hits"dowel": "workspace:*"and refuses.karnstack/fluedoes not hit this only because itssite/has no workspace dependency for npm to choke on. It is still silently running npm inside a pnpm repo.Fix
Two changes. Either one is sufficient on its own; together npm is never reached even if one regresses.
packageManager: pnpmon the action step. A documented v3 input, and the supported override for the lockfile sniff. It switches the probe topnpm exec wrangler --version, the run topnpm exec wrangler deploy, and the fallback install topnpm add, which understandsworkspace:.wrangler^4.120.0as a devDependency ofapps/docs.pnpm install --frozen-lockfilealready runs before the deploy step, so the probe now finds a real wrangler,4.120.0satisfies the pinned"4", and the action skips its install step entirely. It also pins the deploy tool in the lockfile rather than floating on whatever npm resolves that morning, and makes a localpnpm exec wrangler deploy --dry-runreproduce CI exactly.workerdjoinsallowBuildsinpnpm-workspace.yaml: it arrives as a wrangler dependency, its install script links the platform binary, and pnpm 11 exits 1 on an install that silently skipped a build script.Verification
The load-bearing check: the action's own bundle (
cloudflare/wrangler-action@v3dist/index.mjs) run against this checkout with the same inputs as the workflow and a bogus API token.No install step, no npm process, and it reaches the Cloudflare API before failing on the fake credential. That is the whole action path end to end.
Also green:
npx --no-install wrangler --versionfromapps/docsnow prints4.120.0too, so the fix holds even without thepackageManagerinput.pnpm install --frozen-lockfilesucceeds. The lockfile change is wrangler plusesbuildentering vite's peer resolution set.pnpm exec wrangler deploy --dry-runinapps/docsreads all 46 files fromdist/.pnpm --filter dowel build && pnpm --filter @dowel/docs build, 11 pages prerendered.pnpm format:check,pnpm typecheck,pnpm build,pnpm test(81 tests, 10 files).What stays unproven
The real deploy. It needs the org
CLOUDFLARE_API_TOKEN, which is not available to a PR, so the only untested segment is what happens after authentication succeeds: asset upload and thedowel.shcustom-domain route binding. Everything up to and including the API call is verified above. This will not be known good until it merges anddeploy-docsruns on main.No repo-level secret was created, so the org secret keeps its visibility.
Unchanged
The job still skips rather than fails when the token is absent,
dowelstill builds before@dowel/docs, the toolchain still comes frommise.tomlviajdx/mise-action@v4, andapps/docs/wrangler.jsoncis untouched.🤖 Generated with Claude Code