Skip to content

fix: move lefthook build approval to pnpm-workspace.yaml - #2378

Merged
thorwolpert merged 1 commit into
bcgov:mainfrom
panish16:fix/lefthook-build-approval
Oct 1, 2026
Merged

thorwolpert merged 1 commit into
bcgov:mainfrom
panish16:fix/lefthook-build-approval

Conversation

@panish16

Copy link
Copy Markdown
Contributor

Follow-up to #2364 / #2377, part of the Git Hooks RFC rollout (bcgov/entity#34619).

Problem

pnpm v11 no longer reads the pnpm field in package.json, so the root onlyBuiltDependencies: [lefthook] is ignored. For anyone on pnpm's default build-script approval, a root pnpm install ends with:

[WARN] The "pnpm" field in package.json is no longer read by pnpm...
[ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: lefthook@1.13.6

and exits 1. The hook still gets installed (via prepare), but the install reports failure. Confirmed on a fresh clone of main.

Fix

  • Drop the ignored pnpm field from package.json
  • Add root pnpm-workspace.yaml with allowBuilds: lefthook: false - lefthook's own postinstall doesn't need to run since prepare already installs the hook

ppr-ui has its own pnpm-workspace.yaml, so it keeps resolving its own settings and isn't affected by the new root one (checked: pnpm config get allowBuilds in ppr-ui still returns its own list).

Tested

Windows, pnpm 11.9.0, default build-script approval:

  • root pnpm install --frozen-lockfile exits 0, hook installed, lockfile unchanged
  • fake GitHub token at root and in ppr-api/ → commit blocked

pnpm v11 no longer reads the package.json `pnpm` field, so
onlyBuiltDependencies was ignored and a root `pnpm install` failed with
ERR_PNPM_IGNORED_BUILDS for anyone on default build-script approval.
Disable lefthook's own postinstall via allowBuilds instead (prepare
already installs the hook). ppr-ui has its own pnpm-workspace.yaml so
it is unaffected by the new root one.
@thorwolpert thorwolpert self-assigned this Oct 1, 2026
@thorwolpert
thorwolpert merged commit 29696bf into bcgov:main Oct 1, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants