Skip to content

chore: switch to pnpm and fix CJS export types - #96

Merged
dillonstreator merged 1 commit into
mainfrom
chore/pnpm-and-cjs-exports
Nov 5, 2026
Merged

dillonstreator merged 1 commit into
mainfrom
chore/pnpm-and-cjs-exports

Conversation

@dillonstreator

Copy link
Copy Markdown
Member

Summary

Switch from yarn to pnpm 12.16.1

  • pnpm-lock.yaml is generated from yarn.lock with pnpm import, so resolved versions carry over. Both yarn.lock files are removed.
  • pnpm-workspace.yaml: pnpm 12 doesn't read the package.json pnpm field, so settings live here.
    • Yarn resolutions become version-range overrides, since pnpm has no a/**/b globs. The locked versions match the old pins: picomatch 2.3.2, cross-spawn 6.0.6, minimatch 3.1.5, brace-expansion 1.1.21, diff 4.0.4, esbuild 0.25.12.
    • allowBuilds lets esbuild, prisma and @prisma/engines run their install scripts. pnpm blocks them by default.
    • examples/pg becomes a workspace package, so the repo has one lockfile.
  • CI (coverage and release) uses pnpm/action-setup@v4, setup-node with cache: pnpm, and pnpm install --frozen-lockfile. The README and test comments say pnpm.

Fix CJS consumers

  • Each export's require condition now points at its own dist/cjs/*.d.ts, instead of one shared types that gave CJS consumers the ESM declarations.
  • Removes copy:files/copyfiles. It copied a "type": "module" package.json into dist/, which npm doesn't need because it publishes from the package root.
  • engines.node goes from >=20.3 to ^20.19.0 || >=22.12.0, the versions where CJS consumers can require() the ESM-only p-limit/p-queue.
  • Adds a patch changeset.

Test plan

  • pnpm build: require('txob'), require('txob/pg') and ESM import all load
  • pnpm typecheck; pnpm test --run (64 passed, store tests skipped locally because no databases are running)
  • publint: no errors. attw: every entry point is green for node16 CJS, node16 ESM and bundler. The only red cells are node10 subpaths, which the engines range excludes.
  • CI store tests pass with the pnpm install
  • First release run: confirm changeset publish works with npm trusted publishing (OIDC) now that it publishes through pnpm

- Switch from yarn to pnpm 12: import yarn.lock into pnpm-lock.yaml, move resolutions to pnpm-workspace.yaml overrides, allow esbuild/prisma build scripts, make examples/pg a workspace package, and use pnpm in CI and docs.
- Give each export's require condition its own dist/cjs .d.ts and drop the copy:files step (npm publishes from the package root).
- Declare engines.node ^20.19.0 || >=22.12.0, the versions where CJS consumers can require() the ESM-only p-limit/p-queue.
@codecov

codecov Bot commented Nov 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.04%. Comparing base (b88589e) to head (1bd84f8).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #96      +/-   ##
==========================================
+ Coverage   95.88%   96.04%   +0.16%     
==========================================
  Files          32       33       +1     
  Lines        2163     2253      +90     
  Branches      416      455      +39     
==========================================
+ Hits         2074     2164      +90     
  Misses         72       72              
  Partials       17       17              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dillonstreator
dillonstreator merged commit 6e4e10a into main Nov 5, 2026
3 of 4 checks passed
@dillonstreator
dillonstreator deleted the chore/pnpm-and-cjs-exports branch November 5, 2026 02:05
@github-actions github-actions Bot mentioned this pull request Nov 5, 2026
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