Skip to content

root: Replace (npm + Corepack) with pnpm - #22830

Merged
GirlBossRush merged 2 commits into
mainfrom
issue-22826-replace-npm-corepack-with-pnpm
Jul 1, 2026
Merged

GirlBossRush merged 2 commits into
mainfrom
issue-22826-replace-npm-corepack-with-pnpm

Conversation

@GirlBossRush

@GirlBossRush GirlBossRush commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Details

This PR is a follow up to #20400, where we pinned the npm version.

Across dev machines, CI runners, and Docker builds, and the mechanism we landed for it (scripts/node/setup-corepack.mjs, plus corepack npm threaded through every workflow, action, Dockerfile, and Makefile target) exists for one job: keeping a single npm version pinned to disk. Since pnpm 10, the standalone binary reads the packageManager field and self-installs the pinned version. pnpm also adds a lot of other desirable security features that we've had to on to npm too.

The work

  • package-lock.json → pnpm-lock.yaml at the root, web/, and website/. Expect resolution drift on the first clean install; the lockfile is regenerated from scratch rather than imported 1:1.
  • packageManager → [email protected] (sha512 integrity) at the root, web/, website/, and packages/client-ts/. engines.npm drops out of the publishable packages so downstream consumers can install them with any package manager.
  • New pnpm-workspace.yaml at each project root carries overrides, onlyBuiltDependencies, and the allowBuilds approval map. pnpm 11 stopped reading the pnpm block in package.json, so config lives there now.
  • onlyBuiltDependencies takes over from the .npmrc ignore-scripts=true plus the manual npm rebuild --foreground-scripts <pkg> dance. Same deny-by-default posture for install scripts, with the curated allow-list in version control instead of a Makefile comment. Right now that's just esbuild.
  • .github/actions/setup-node uses pnpm/action-setup@v4 (pinned by SHA) and reads the version from packageManager. The six workflows (ci-web, ci-main, ci-docs, ci-api-docs, ci-outpost, packages-npm-publish) call pnpm directly; cache keys now hash pnpm-lock.yaml.
  • lifecycle/container/Dockerfile, proxy.Dockerfile, and website/Dockerfile bootstrap pnpm with npm install -g pnpm@<pinned> and let the packageManager field do the rest. The Node base image already ships npm, so this avoids touching the base image surface area in the same PR.
  • lint-lockfile.mjs is gone. pnpm install --frozen-lockfile already fails on lockfile drift, which was the only thing the linter checked.
  • Deleted: scripts/node/setup-corepack.mjs, scripts/node/utils/corepack.mjs, scripts/node/lint-lockfile.mjs, the .corepack/ cache dir, and the per-package package-lock.json files.

One thing worth a close look

nodeLinker: hoisted on web/ and website/. pnpm's default isolated linker only exposes declared dependencies, and the web bundle leans on a few phantom deps that npm's flat hoisting masked (ol, mdast-util-to-string, lit-html internals on web; @docusaurus/utils on website). Folding those into explicit dependencies and dropping the hoisted opt-out is left as a follow-up so this stays a clean package-manager swap. Happy to pull that into this PR instead if you'd rather not carry the opt-out.

Verified locally

pnpm install, web lint, web build, website build, and tsc on web/ all pass against this branch.

Disclosure

Triaged and authored end-to-end by an automated agent operating under my account and supervision. I reviewed the full diff and confirmed the local build, lint, and type-checks before opening.

Closes #22826

@GirlBossRush
GirlBossRush requested review from a team as code owners June 3, 2026 18:19
@GirlBossRush GirlBossRush added the area:frontend Features or issues related to the browser, TypeScript, Node.js, etc label Jun 3, 2026
@semgrep-app

semgrep-app Bot commented Jun 3, 2026

Copy link
Copy Markdown

Semgrep found 1 ssc-ace67ff4-0843-40f4-a8d3-13e050943589 finding:

Risk: Affected versions of js-yaml are vulnerable to Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'). js-yaml is vulnerable to prototype pollution through its YAML merge key (<<) handling. When parsing untrusted YAML with load, loadAll, safeLoad, or safeLoadAll, a crafted document containing a __proto__ key inside a merged mapping can modify the prototype of the resulting object, leading to integrity violations in the application.

Manual Review Advice: A vulnerability from this advisory is reachable if you are using js-yaml on the CLI

Fix: Upgrade this library to at least version 4.1.1 at authentik/website/pnpm-lock.yaml:7920.

Reference(s): GHSA-mh29-5h37-fv8m, CVE-2025-64718

@codecov

codecov Bot commented Jun 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.22%. Comparing base (28841fc) to head (36c722d).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #22830      +/-   ##
==========================================
+ Coverage   93.20%   93.22%   +0.01%     
==========================================
  Files        1039     1039              
  Lines       60801    60801              
  Branches      424      424              
==========================================
+ Hits        56670    56682      +12     
+ Misses       4131     4119      -12     
Flag Coverage Δ
conformance 36.31% <ø> (+<0.01%) ⬆️
e2e 41.50% <ø> (+<0.01%) ⬆️
integration 32.75% <ø> (+<0.01%) ⬆️
rust 0.00% <ø> (ø)
unit 92.29% <ø> (+<0.01%) ⬆️
unit-migrate 92.32% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@netlify

netlify Bot commented Jun 3, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit d3b259a
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6a4562a399adb2000a523297
😎 Deploy Preview https://deploy-preview-22830--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@GirlBossRush
GirlBossRush force-pushed the issue-22826-replace-npm-corepack-with-pnpm branch from c0164c7 to 94ac9c9 Compare June 4, 2026 18:41
@netlify

netlify Bot commented Jun 4, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit d3b259a
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6a4562a3cc330d00085b6c00
😎 Deploy Preview https://deploy-preview-22830--authentik-integrations.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jun 4, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 36c722d
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6a4563293008c600088b513a
😎 Deploy Preview https://deploy-preview-22830--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread package.json Resolved
Comment thread package.json Resolved
Comment thread .prettierignore Resolved
Comment thread .npmrc
ignore-scripts=true

# Fail fast if the active Node/npm doesn't match the "engines" field.
# Fail fast if the active Node/pnpm doesn't match the "engines" field.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need a npmrc if we're using pnpm?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because plenty of environment scripts default to npm despite our efforts. Better to keep them safe.

postman-code-generators: false

minimumReleaseAgeExclude:
- [email protected]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why these 4 specifically?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because they're outstanding warnings that only pnpm and yarn are capable of patching without it being a nightmare

Comment thread website/pnpm-workspace.yaml Resolved
Comment thread website/pnpm-workspace.yaml Resolved
Comment thread website/pnpm-workspace.yaml Resolved
Comment thread website/package.json
},
"uuid": "^14.0.0"
}
"packageManager": "[email protected]+sha512.93f7b57422ea7068257235b4c16eb60762eb68e1dc23723199cc739043ea9be2c4143274a399d8c6defa2b1176226d9ca1c4b63482d6200c1a8fbaa78c1d1485",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whats the utility of enforcing a package manager version here if there isn't corepack to actually enforce it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this field is checked by most non-npm package managers, giving a clue as to if you accidentally use one over a preferred other

Comment thread website/Dockerfile Resolved
@github-actions

github-actions Bot commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-36c722d62ccd62ec8f19065bd62d64f2b650d7ae
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
    image:
        repository: ghcr.io/goauthentik/dev-server
        tag: gh-36c722d62ccd62ec8f19065bd62d64f2b650d7ae

Afterwards, run the upgrade commands from the latest release notes.

Comment thread website/docs/package.json Resolved
Comment thread website/integrations/package.json Resolved
Comment thread website/api/package.json Resolved
Comment thread web/pnpm-workspace.yaml Resolved
Comment thread web/.prettierignore Resolved
Comment thread packages/tsconfig/package.json Resolved

@dominic-r dominic-r left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few questions, please

@GirlBossRush GirlBossRush changed the title Replace npm + Corepack with pnpm core Replace npm + Corepack with pnpm Jun 4, 2026
@GirlBossRush
GirlBossRush force-pushed the issue-22826-replace-npm-corepack-with-pnpm branch 4 times, most recently from 074d8f1 to 2fae346 Compare June 5, 2026 01:50
@GirlBossRush GirlBossRush changed the title core Replace npm + Corepack with pnpm core Replace (npm + Corepack) with pnpm Jun 5, 2026
@GirlBossRush
GirlBossRush requested a review from BeryJu June 5, 2026 02:28
@GirlBossRush
GirlBossRush dismissed dominic-r’s stale review June 5, 2026 13:00

Wrapped in Slack

@GirlBossRush
GirlBossRush force-pushed the issue-22826-replace-npm-corepack-with-pnpm branch 2 times, most recently from 305d53b to 6fb4bb5 Compare June 11, 2026 14:17
@GirlBossRush
GirlBossRush force-pushed the issue-22826-replace-npm-corepack-with-pnpm branch 3 times, most recently from e14d0f9 to 1a771f6 Compare July 1, 2026 15:22

@BeryJu BeryJu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rissson rissson changed the title core Replace (npm + Corepack) with pnpm root: Replace (npm + Corepack) with pnpm Jul 1, 2026

@rissson rissson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok for CI and dockerfiles

@kensternberg-authentik kensternberg-authentik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The daily drivers work just fine; the CI looks right, but I rarely write CI code. Go for it and "Let's see what happens."

Comment thread web/package.json
"@openlayers-elements/maps": "^0.4.0",
"@patternfly/elements": "^4.4.0",
"@patternfly/patternfly": "^4.224.2",
"@patternfly/patternfly": "^4.224.5",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tsk, tsk, doing upgrades during a changeover.

Migrate package management from npm + Corepack to pnpm across the root,
web, and website workspaces:

- Swap npm/Corepack tooling for pnpm: drop package-lock.json files and the
  bespoke Corepack bootstrap scripts (setup-corepack.mjs, utils/corepack.mjs,
  lint-lockfile.mjs); add pnpm-lock.yaml + pnpm-workspace.yaml per workspace.
- CI uses the official pnpm/action-setup + actions/setup-node; pin the pnpm
  store dir via PNPM_HOME so setup-node's `cache: pnpm` post-step succeeds.
- Docker sources pnpm from the official ghcr.io/pnpm/pnpm image via a
  ${BUILDPLATFORM}-pinned stage; the website docs build does a hoisted root
  install so @goauthentik/docusaurus-config resolves its own deps.
- Gate the web install on the `node` dep so runtime-only jobs don't invoke
  pnpm; scope the from-stable env setup so the new tooling doesn't run against
  the stable checkout's npm packageManager field.
- Resolve @goauthentik/api (client-ts) from its TypeScript source instead of a
  tsc-built dist, so it no longer depends on an install-time prepare having run
  (the storybook build's environment never built it); sfe's rollup gains .ts
  resolution to match.
- Netlify builds with pnpm; encode pnpm's supply-chain controls
  (onlyBuiltDependencies/allowBuilds, minimumReleaseAge) in the workspace.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

Remove custom node action.
@GirlBossRush
GirlBossRush force-pushed the issue-22826-replace-npm-corepack-with-pnpm branch from 1a771f6 to d3b259a Compare July 1, 2026 18:55
@GirlBossRush
GirlBossRush enabled auto-merge (squash) July 1, 2026 18:57
@GirlBossRush
GirlBossRush merged commit 928eefe into main Jul 1, 2026
105 of 109 checks passed
@GirlBossRush
GirlBossRush deleted the issue-22826-replace-npm-corepack-with-pnpm branch July 1, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:frontend Features or issues related to the browser, TypeScript, Node.js, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace npm + Corepack with pnpm

5 participants