Skip to content

build: migrate from yarn to pnpm - #69

Open
AliceR wants to merge 3 commits into
chore/update-depsfrom
chore/migrate-pnpm
Open

AliceR wants to merge 3 commits into
chore/update-depsfrom
chore/migrate-pnpm

Conversation

@AliceR

@AliceR AliceR commented Oct 1, 2026

Copy link
Copy Markdown
Member

Stacked on #68 (dependency updates). Merge that first; GitHub will then retarget this PR to main.

Migrates the library and the example app from Yarn 4 to pnpm 12.

Changes

  • Lockfiles: yarn.lock → pnpm-lock.yaml via pnpm import, so resolved versions are unchanged. Done for both the root and example/.
  • packageManager: pnpm@12.8.1. .yarnrc.yml removed.
  • Install scripts: pnpm blocks dependency build scripts by default. Explicitly denied in pnpm-workspace.yaml (allowBuilds):
    • @parcel/watcher, unrs-resolver (via Jest): their scripts are only fallbacks; the prebuilt binaries arrive as optional deps
    • core-js, core-js-pure (example): postinstall banner only
  • Example app: has its own pnpm-workspace.yaml, so it stays a standalone project. The link: setup for react, react-dom and @tanstack/react-query is unchanged; verified that the app and the library resolve a single copy of each.
  • CI: uses pnpm/action-setup (v6.1.0, SHA-pinned) with its pnpm-store cache keyed on pnpm-lock.yaml. This replaces corepack and the node_modules cache keyed on package.json. Corepack cannot run pnpm 12 (it expects bin/pnpm.cjs, but pnpm 12 ships native binaries), and Node 25+ no longer bundles corepack.
  • CI fix: the build job was running yarn test instead of the build. It now runs pnpm build.
  • Docs: README install instructions add pnpm; dev commands now use pnpm.

Fixes surfaced by pnpm's strict node_modules

  • fix: published types referenced @tanstack/query-core, which is not a dependency of this package. dist/src/context/index.d.ts contained import('@tanstack/query-core').QueryClient, which fails type checking for consumers whose package manager doesn't hoist query-core (e.g. pnpm without skipLibCheck). Now references @tanstack/react-query, which re-exports it.
  • queryKeys.test.ts imported the undeclared @jest/globals; it now uses the Jest globals like the other suites.

Local setup

Install pnpm 12 (https://pnpm.io/installation), for example npm i -g pnpm, then run pnpm install. Note that corepack enable won't work with pnpm 12.

Verification

From a clean state: pnpm install --frozen-lockfile, pnpm lint, pnpm test (94/94) and pnpm build all pass. pnpm pack --dry-run contents match the previous build. The example app installs and pnpm build compiles.

Not in this PR

  • StacApiProvider.test.d.ts is published because the dts exclude only matches *.test.ts. This predates the migration.
  • Dependabot only tracks GitHub Actions; an npm ecosystem entry (works for pnpm) could be added.

🤖 Generated with Claude Code

AliceR and others added 3 commits October 1, 2026 12:56
The Window global was typed via @tanstack/query-core, which is not a
dependency of this package. The import ended up in the published
declaration files, failing type checks for consumers whose package
manager does not hoist query-core (e.g. pnpm).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jest/globals is not a declared dependency.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Replace yarn.lock with pnpm-lock.yaml (imported from yarn.lock, so
  resolved versions are unchanged) for the library and the example app
- Set packageManager to pnpm@12.8.1
- Deny install scripts that are not needed (@parcel/watcher,
  unrs-resolver, core-js); prebuilt binaries come via optional deps
- Give example/ its own pnpm-workspace.yaml so it stays a separate project
- CI: install pnpm with pnpm/action-setup instead of corepack (corepack
  cannot run pnpm 12) and cache the pnpm store keyed on the lockfile
- CI: the build job now runs the build instead of the tests
- Update READMEs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant