Skip to content

chore!: require Node.js 22 or later - #189

Open
MLawlz wants to merge 1 commit into
mainfrom
mlawler/require-node-22
Open

MLawlz wants to merge 1 commit into
mainfrom
mlawler/require-node-22

Conversation

@MLawlz

@MLawlz MLawlz commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Raises the minimum Node.js version from 18 to 22 and bumps the SDK to 5.0.0. Node.js 18 reached end of life in April 2025 and Node.js 20 in April 2026, so 22 is the oldest release line still getting security fixes. There are no SDK code changes; this release only changes which Node versions are supported and tested.

Changes

  • package.json: engines.node >=18 → >=22, version 4.41.4 → 5.0.0
  • CHANGELOG.md: [5.0.0] entry, marked Breaking
  • test.yml: matrix 18, 20 → 22, 24
  • publish.yml, api-reference.yml, version-bump.yml: Node 20 → 24. This is required for the first two: pnpm refuses to install a project whose own engines doesn't match the running Node, so releases would fail on 20.
  • docs/compat.md, CLAUDE.md: now say 22+; compat.md points Node 18/20 users to v4
  • src/utils/live.ts: a comment no longer says Node 18 "is still supported"
  • tests/unit/utils.test.ts: three user-agent assertions, explained below

Why the user-agent tests changed

They would have failed on the new matrix. Node 21 added a global navigator.userAgent ("Node.js/22"). buildUserAgent uses it as the User-Agent prefix and deliberately skips runtime_env=Node/<version> when that string already names Node. CI only ever ran 18 and 20, so the tests expected runtime_env. They now assert the Node.js/<major> prefix. SDK behavior is unchanged.

Worth knowing: requests from Node 21+ already send only the Node major version and no runtime_env, so anything that reads runtime_env from the User-Agent for analytics is missing those users today.

Why a major version

Yarn 1 enforces dependency engines by default, as do npm and pnpm with engine-strict. Released as 4.x, this would break installs for anyone on Node 18/20 with a ^4 range.

Testing

  • Unit tests: 349/349 pass on Node 22.23.3, 24.21.0 and 26.10.0. These ran locally with ts-jest type-checking off, because the local node_modules had drifted from the lockfile (TypeScript 5.9 vs 5.4). CI covers type-checking.
  • Build, eslint, tsc and publint pass; prettier is clean on the changed files.
  • Integration tests weren't run.

Notes

🤖 Generated with Claude Code

Node.js 18 and 20 have reached end of life, so raise engines.node to
>=22, test on 22 and 24, and bump to 5.0.0. The publish and API
reference workflows move to Node 24 as well, since pnpm refuses to
install a project whose own engines field doesn't match the running
Node.

The user-agent tests expected runtime_env=Node/<version>, which the SDK
only adds when navigator.userAgent doesn't already name Node. Node 21+
defines navigator.userAgent ("Node.js/22"), so the tests now assert
that prefix instead. SDK behavior is unchanged.

BREAKING CHANGE: Node.js 18 and 20 are no longer supported.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
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