Skip to content

chore(deps): upgrade core to zod 4 + drop uuid (requires TypeScript 6)#569

Merged
Justkant merged 3 commits into
mainfrom
chore/deps-core-zod4
May 30, 2026
Merged

chore(deps): upgrade core to zod 4 + drop uuid (requires TypeScript 6)#569
Justkant merged 3 commits into
mainfrom
chore/deps-core-zod4

Conversation

@Justkant
Copy link
Copy Markdown
Collaborator

Summary

Upgrades @ledgerhq/wallet-api-core to zod 4 and removes the uuid dependency. zod 4 turned out to require a TypeScript bump that cascades to core's consumers, so this PR also moves the library packages to TypeScript 6.

zod 3 → 4

  • packages/core zod ^3.22.4^4.0.0.
  • The repo's existing pnpm-workspace.yaml override zod@>=4.4.0 → 4.3.6 (a z.custom() regression breaks nextra-theme-docs in apps/docs) caps the resolved version at 4.3.6, so core now shares the single zod 4.3.6 instance already used by wallet-api-tools (no more dual zod 3/4 install).
  • Core's zod usage was already v4-compatible (two-arg z.record, .flatten()/instanceof z.ZodError); no source changes were needed.

Why TypeScript 6

zod 4's .d.ts use NoInfer (TypeScript ≥ 5.4), and since core re-exports zod schemas in its public API, every package that type-checks against core (skipLibCheck: false) must move too. Per maintainer direction we align on TS 6:

  • typescript ^5.3.3^6.0.3 in core, client, client-react, server, simulator, manifest-validator, manifest-validator-cli.
  • Each library tsconfig.json gains ignoreDeprecations: "6.0" (keeps Node10 resolution + baseUrl from tsconfig.base.json working through TS 6 — safest for the dual CJS/ESM builds) and an explicit rootDir.
  • prod.tsconfig.json / prod-esm.tsconfig.json set rootDir: "./src" (TS 6 no longer infers it when outDir is set).
  • tsconfig.base.json is intentionally not changed, so client-nextjs/eslint-config-custom (still on TS 5.3) are unaffected and this PR stays independent of chore(deps): upgrade client-nextjs example to Next 16 + TS 6 + Tailwind 4 #566.

uuid removal

RpcNode used uuid.v4() once → replaced with native crypto.randomUUID(), dropping uuid + @types/uuid. uuid v14 is ESM-only and incompatible with core's CommonJS build.

A changeset (patch for the 7 published packages) is included.

Verification

  • pnpm build ✅ 10/10
  • pnpm test ✅ 26/26 (core 131 passed, simulator 48, etc.)
  • pnpm typecheck ✅ 7/7
  • pnpm lint ✅ 10/10, pnpm format:check ✅ 7/7
  • node -e "require('packages/core/lib/index.js')" loads (confirms no ESM uuid require in the CJS build)
  • Single zod@4.3.6 resolves in the lockfile.

Note

The repo override means the literal zod@4.4.3 target from the dependency checker isn't usable yet; 4.3.6 is the latest zod 4 that doesn't break docs.

🤖 Generated with Claude Code

@Justkant Justkant requested review from a team and ComradeAERGO as code owners May 30, 2026 14:24
@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
wallet-api-wallet-api-tools Ready Ready Preview, Comment May 30, 2026 3:38pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 30, 2026

🦋 Changeset detected

Latest commit: 6f0ee31

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@ledgerhq/wallet-api-core Patch
@ledgerhq/wallet-api-client Patch
@ledgerhq/wallet-api-client-react Patch
@ledgerhq/wallet-api-server Patch
@ledgerhq/wallet-api-simulator Patch
@ledgerhq/wallet-api-manifest-validator Patch
@ledgerhq/wallet-api-manifest-validator-cli Patch
@ledgerhq/wallet-api-tools Patch
@ledgerhq/client-nextjs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Upgrades @ledgerhq/wallet-api-core from zod 3 to zod 4 (resolved to 4.3.6 via the existing workspace override), replaces the single uuid.v4() usage in RpcNode with the native crypto.randomUUID(), and bumps every library package from TypeScript ^5.3.3 to ^6.0.3 (because zod 4's d.ts use NoInfer, and core re-exports zod schemas through its public API). Each library tsconfig.json gains ignoreDeprecations: "6.0" plus an explicit rootDir so the dual CJS/ESM builds keep working under TS 6.

Changes:

  • Bump zod to ^4.0.0 in packages/core and remove the uuid / @types/uuid deps.
  • Bump typescript to ^6.0.3 in the 7 published library packages, and add ignoreDeprecations: "6.0" + rootDir to their tsconfigs.
  • Add a patch changeset covering all 7 packages.

Reviewed changes

Copilot reviewed 29 out of 30 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
.changeset/core-zod4-drop-uuid.md Patch changeset describing the zod 4 + TS 6 + uuid-removal bump.
packages/core/package.json Adds zod ^4.0.0, drops uuid / @types/uuid, bumps TS to ^6.0.3.
packages/core/src/JSONRPC/RpcNode.ts Replaces uuidv4() with crypto.randomUUID().
packages/core/tsconfig.json Adds ignoreDeprecations: "6.0" and rootDir: ".".
packages/core/prod.tsconfig.json, prod-esm.tsconfig.json Add explicit rootDir: "./src" for TS 6.
packages/client/{package.json,tsconfig.json,prod*.tsconfig.json} TS 6 bump + ignoreDeprecations + rootDir.
packages/client-react/{package.json,tsconfig.json,prod*.tsconfig.json} TS 6 bump + ignoreDeprecations + rootDir.
packages/server/{package.json,tsconfig.json,prod*.tsconfig.json} TS 6 bump + ignoreDeprecations + rootDir.
packages/simulator/{package.json,tsconfig.json,prod*.tsconfig.json} TS 6 bump + ignoreDeprecations + rootDir.
packages/manifest-validator/{package.json,tsconfig.json,prod*.tsconfig.json} TS 6 bump + ignoreDeprecations + rootDir.
packages/manifest-validator-cli/{package.json,tsconfig.json,prod.tsconfig.json} TS 6 bump + ignoreDeprecations + rootDir.
pnpm-lock.yaml Lockfile regeneration: TS 6.0.3 resolutions, zod 4.3.6, uuid/@types/uuid removed.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .changeset/core-zod4-drop-uuid.md Outdated
Comment thread packages/core/src/JSONRPC/RpcNode.ts
Upgrades `zod` in @ledgerhq/wallet-api-core from ^3.22.4 to ^4.0.0. The repo
override `zod@>=4.4.0 -> 4.3.6` (a z.custom() regression breaks
nextra-theme-docs) caps the resolved version at 4.3.6, so core now shares the
single zod 4.3.6 instance already used by wallet-api-tools.

zod 4's type definitions require TypeScript >= 5.4 (NoInfer), and because core
re-exports zod schemas as part of its public API, every package that type-checks
against core must move too. TypeScript is bumped ^5.3.3 -> ^6.0.3 in core,
client, client-react, server, simulator, manifest-validator and
manifest-validator-cli.

TS 6 migration for the library builds:
- each package tsconfig.json gets `ignoreDeprecations: "6.0"` (keeps Node10
  module resolution / baseUrl from tsconfig.base.json working through TS 6) and
  an explicit `rootDir` (TS 6 no longer infers it when outDir is set).
- the prod.tsconfig.json / prod-esm.tsconfig.json build configs set
  `rootDir: "./src"`.

Also replaces the single uuid v4 usage in RpcNode with the native
`crypto.randomUUID()`, dropping the `uuid` and `@types/uuid` dependencies
(uuid v14 is ESM-only and incompatible with core's CommonJS build).
…g zod

Removes the repo-wide zod@>=4.4.0 -> 4.3.6 override and replaces it with a
pnpm patch on nextra-theme-docs that fixes the two schema bugs zod 4.4.x
surfaced (4.3.6 happened to mask them):

  - attributeSchema (z.custom) called .startsWith on a non-string when the
    `attribute` config was passed as an array -> TypeError.
  - LayoutPropsSchema declared `children: reactNode` as required, but <Layout>
    strips children before validating, so zod 4.4.x rejected the absent key.

With these fixed, core and wallet-api-tools move to zod ^4.4.3 and the whole
monorepo dedupes to a single zod 4.4.3 (only the external @ledgerhq/cryptoassets
keeps its own hard-pinned 4.3.6).

Verified: build 10/10, test 26/26, typecheck 7/7, lint 10/10, docs prerender
(exercises the patched nextra schema), and core CJS require smoke test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…gle TS)

eslint-config-custom was the last workspace on typescript ^5.3.3, forcing a
second TypeScript (5.3.3) into the tree alongside the 6.0.3 every other package
uses. typescript-eslint@8's peer range (>=4.8.4 <6.1.0) supports 6.0.3, so this
dedupes the repo to a single typescript 6.0.3.

Note: @types/node was intentionally left at ^24.10.0 for the published library
packages. Bumping them to 25 breaks `tsc` under skipLibCheck:false because
@ledgerhq/hw-transport's Transport.d.ts is incompatible with @types/node 25's
stricter EventMap generics. The apps stay on 25 since Next sets skipLibCheck:true.

Verified: build 10/10, test 26/26, typecheck 7/7, lint 10/10.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 33 out of 34 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

@Justkant Justkant merged commit 24131d2 into main May 30, 2026
13 checks passed
@Justkant Justkant deleted the chore/deps-core-zod4 branch May 30, 2026 15:40
@github-actions github-actions Bot mentioned this pull request May 30, 2026
Justkant added a commit that referenced this pull request May 30, 2026
…ompat (#572)

Bumps @types/node from ^24.10.0 to ^25.9.1 in the 7 published library packages,
aligning them with the apps (which were already on 25).

@types/node 25 made EventEmitter generic over an EventMap constraint, which
exposed a latent bug in @ledgerhq/hw-transport@6.35.2: its Transport.d.ts leaks
an internal `_events: EventEmitter<[never]>` field, and the bogus `[never]`
tuple doesn't satisfy EventMap. Under skipLibCheck:false this fails `tsc`
declaration emit for the libraries that depend on hw-transport (client,
simulator). A pnpm patch retypes the field to a plain `EventEmitter`.

hw-transport's only consumers here are client and simulator, and Transport.d.ts
is the sole @types/node 25 incompatibility across the libs. Upstream still ships
the bad line (latest stable + nightly build against @types/node 24), so the
patch must be re-verified on every hw-transport bump.

Stacked on #569 (zod 4 / TS 6): @types/node 25 has only been validated against
TypeScript 6. devDependency + local-only patch, so no published runtime change
and no changeset.

Verified: build 10/10, test 26/26, typecheck 7/7, lint 10/10.

Co-authored-by: Claude Opus 4.8 (1M context) <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.

2 participants