Skip to content

fix(ci): generate route types before typechecking, and drop the impossible Node 20 leg - #7

Merged
kerwin2046 merged 2 commits into
mainfrom
fix/ci-generate-next-types
Sep 30, 2026
Merged

kerwin2046 merged 2 commits into
mainfrom
fix/ci-generate-next-types

Conversation

@kerwin2046

@kerwin2046 kerwin2046 commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

CI has been red on main for two independent reasons. This fixes both, and
aligns the declared Node floor with what the toolchain actually requires.

1. pnpm typecheck ran before the build generated its route types. Next 16
emits LayoutProps / PageProps as global route types during the build, so a
clean checkout failed:

src/app/layout.tsx(14,56): error TS2304: Cannot find name 'LayoutProps'.
src/app/page.tsx(8,58):   error TS2304: Cannot find name 'PageProps'.
src/app/page.tsx(13,54):  error TS2304: Cannot find name 'PageProps'.

Added a typegen script and run it before the typecheck step.

2. The Node 20 matrix leg could never run. The pinned pnpm@11.22.0
requires Node.js >= 22.13, so that leg died in setup-node before install:

warn: This version of pnpm requires at least Node.js v22.13
Error [ERR_UNKNOWN_BUILTIN_MODULE]: No such built-in module: node:sqlite
Node.js v20.20.2

.nvmrc already declares 22, while engines.node, both READMEs, and
CONTRIBUTING all advertised >= 20.9. Aligned everything to 22.13 and the
matrix now tests 22 alongside 24.

Type of change

  • Bug fix
  • New feature
  • Hardware / collector support
  • Refactor (no behaviour change)
  • Documentation
  • Build or CI

Testing

Simulated the CI job from a clean .next (Linux, pnpm 11.22.0 — Node v26.9.0
locally, which satisfies the new floor):

$ rm -rf .next && pnpm typecheck      # before the fix
… error TS2304: Cannot find name 'LayoutProps'.

$ pnpm typegen                        ✓ Types generated successfully
$ pnpm typecheck                      ✅ passed
$ pnpm lint                           ✅ 0 errors (1 pre-existing warning)
$ pnpm build                          ✅ passed

Also confirmed on CI itself: with only the first commit, the Node 22 leg
passed every step
(including the new typegen step) while Node 20 failed in
setup-node — which is what surfaced defect 2.

  • pnpm typecheck
  • pnpm lint
  • pnpm build
  • Verified in the browser

Checklist

  • New user-visible strings are added for both en and zh in src/i18n/ — n/a
  • New hardware fields are nullable and degrade gracefully on non-Linux platforms — n/a
  • No serial numbers, MAC addresses, IP addresses, or UUIDs are collected — n/a
  • Layer boundaries are respected — n/a
  • Documentation updated if behaviour or structure changed — README (en + zh) and CONTRIBUTING Node requirement

Note on the second change

Dropping the Node 20 leg is forced, not a policy preference: the pinned pnpm
cannot run there. If you would rather keep Node 20 support, the alternative
is pinning an older pnpm — say the word and I'll redo it that way instead.

I could not verify the new Node 24 leg locally (this machine runs 26), so
worth watching the first run. Switching it to 26 or dropping it to [22] is
a one-line change.

Related issues

Fixes the red CI on main (latest pre-PR failing run: 2026-09-29T14:18Z). No
tracking issue exists.

`pnpm typecheck` fails on a clean checkout. Next 16 emits `LayoutProps`
and `PageProps` as global route types during the build, but CI ran the
typecheck before the build step:

  src/app/layout.tsx(14,56): error TS2304: Cannot find name 'LayoutProps'.
  src/app/page.tsx(8,58):   error TS2304: Cannot find name 'PageProps'.
  src/app/page.tsx(13,54):  error TS2304: Cannot find name 'PageProps'.

Add a `typegen` script and run it before the typecheck step. Verified
from a clean `.next`: typecheck fails before typegen, passes after, and
lint/build are unaffected.

The script is also useful locally on its own (`pnpm typegen`).
The pinned pnpm 11.22.0 requires Node.js >= 22.13, so the Node 20 matrix
entry died in setup-node before install ever ran:

  warn: This version of pnpm requires at least Node.js v22.13
  Error [ERR_UNKNOWN_BUILTIN_MODULE]: No such built-in module: node:sqlite
  Node.js v20.20.2

`.nvmrc` already declares 22, so the matrix, `engines.node`, and the README
and CONTRIBUTING requirements were all stating a floor the toolchain cannot
honour. Align them all to 22.13 and test 22 alongside the current line.

Verified on this branch: `pnpm typegen && pnpm typecheck && pnpm build`
from a clean `.next`, and the Node 22 CI leg passes end to end.
@kerwin2046 kerwin2046 changed the title fix(ci): generate Next.js route types before typechecking fix(ci): generate route types before typechecking, and drop the impossible Node 20 leg Sep 30, 2026
@kerwin2046
kerwin2046 merged commit 0743c01 into main Sep 30, 2026
2 checks passed
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