From 36b228f4b83c491b0287fbaa39a5d1c29d68610b Mon Sep 17 00:00:00 2001 From: Pascal Garber Date: Mon, 22 Jun 2026 18:53:42 +0200 Subject: [PATCH] fix: make pnpm config work in clean CI environments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Package Managers workflow's pnpm leg failed with ERR_PNPM_FETCH_404 on @learn6502/learn even though it passed locally: pnpm 10 does NOT reliably read link-workspace-packages from a project .npmrc (it's the modern pnpm-workspace.yaml that's authoritative), so in a clean environment (CI, no global config) pnpm ignored the .npmrc, didn't link the local workspaces, and tried the registry. Move all pnpm settings from .npmrc into pnpm-workspace.yaml (delete .npmrc): - linkWorkspacePackages: true — link local workspaces for the plain ^ranges. - nodeLinker: hoisted — flat layout the gjsify bundler needs. - minimumReleaseAge: 0 — disable pnpm's new-version quarantine, which otherwise blocks freshly-published @gjsify/* right after a gjsify release (the other PMs have no such gate). Verified in a clean HOME (mimicking CI): pnpm install links packages/app-gnome/node_modules/@learn6502/learn -> ../../../learn. Dropping the .npmrc also removes the cosmetic "Unknown project config" warnings npm printed. --- .npmrc | 13 ------------- README.md | 2 +- pnpm-workspace.yaml | 21 ++++++++++++++++++--- 3 files changed, 19 insertions(+), 17 deletions(-) delete mode 100644 .npmrc diff --git a/.npmrc b/.npmrc deleted file mode 100644 index b68c7b1b..00000000 --- a/.npmrc +++ /dev/null @@ -1,13 +0,0 @@ -# pnpm-specific settings. npm/yarn/gjsify ignore these keys (npm may print a -# cosmetic "unknown config" for node-linker — install still works). -# -# link-workspace-packages: the internal deps use plain `^x.y.z` ranges (not the -# `workspace:` protocol). pnpm 10 defaults this to false, so without it pnpm -# fetches @learn6502/* from the registry (404) instead of linking the local -# workspace. true makes pnpm resolve a workspace-named dep to the local package. -link-workspace-packages=true -# node-linker: flat node_modules (like npm/yarn/gjsify). pnpm's default strict -# symlinked layout hides the gjsify bundler's node-builtin polyfills -# (@gjsify/node-globals etc.) → `--globals auto` fails the build with -# "Unsupported URI scheme for importing: node". -node-linker=hoisted diff --git a/README.md b/README.md index 250dd950..158137fb 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ npm run build && npm run start:gnome # or the yarn / pnpm equivalent Notes: - **gjsify is the canonical path** — the committed `gjsify-lock.json` and the offline Flatpak build use it. npm/yarn/pnpm generate their own lockfiles (gitignored); they're fine for local dev, please don't commit them. -- **pnpm** relies on the committed `pnpm-workspace.yaml` (pnpm doesn't read the `workspaces` field) plus `.npmrc` — `link-workspace-packages=true` (so plain `^` ranges link the local workspaces) and `node-linker=hoisted` (flat layout the gjsify bundler needs). +- **pnpm** relies on the committed `pnpm-workspace.yaml` (pnpm reads its workspace members + settings there, not the `workspaces` field or a project `.npmrc`) — `linkWorkspacePackages: true` (so plain `^` ranges link the local workspaces) + `nodeLinker: hoisted` (flat layout the gjsify bundler needs). - The internal packages use plain `^x.y.z` ranges (not the `workspace:` protocol), which is why every manager — including npm and classic yarn — can resolve them. - A manual **Package Managers** CI workflow verifies all four managers install + resolve the workspaces; trigger it from the Actions tab if you touch the dependency wiring. diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 74c6580c..fcceb62d 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,5 +1,20 @@ -# pnpm reads workspace members from this file (it does NOT read the package.json -# "workspaces" field). Install behaviour (link-workspace-packages, node-linker) -# lives in .npmrc. +# pnpm config lives here (pnpm 10 reads settings from pnpm-workspace.yaml, NOT +# the package.json "workspaces" field, and — unlike npm — not reliably from a +# project .npmrc). +# +# - linkWorkspacePackages: the internal deps use plain `^x.y.z` ranges (not the +# `workspace:` protocol). pnpm 10 defaults this to false, so without it pnpm +# fetches @learn6502/* from the registry (404, unpublished) instead of linking +# the local workspace. +# - nodeLinker: flat node_modules (like npm/yarn/gjsify). pnpm's default strict +# symlinked layout hides the gjsify bundler's node-builtin polyfills +# (@gjsify/node-globals etc.) → `--globals auto` fails the build with +# "Unsupported URI scheme for importing: node". +# - minimumReleaseAge: 0 disables pnpm's new-version quarantine. The other PMs +# (npm/yarn/gjsify) have no such gate, so this keeps pnpm consistent and stops +# it blocking freshly-published @gjsify/* right after a gjsify release. packages: - "packages/*" +linkWorkspacePackages: true +nodeLinker: hoisted +minimumReleaseAge: 0