chore: migrate to Node v20 - #372
Conversation
There was a problem hiding this comment.
Pull request overview
Migrates the monorepo tooling and CI configuration toward Node.js v20, primarily by aligning TypeScript/ts-node settings with modern Node ESM semantics and updating build tooling (Rollup) accordingly.
Changes:
- Update TS configs (root + packages) to use
nodenextwhere appropriate and adjust ts-node module mode. - Migrate Rollup TypeScript integration from
rollup-plugin-typescript2to@rollup/plugin-typescript. - Update GitHub Actions workflows to run with Node 20 and adjust package/runtime scripts (e.g., phase2cli start).
Reviewed changes
Copilot reviewed 26 out of 28 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Switch root moduleResolution to nodenext; formatting updates. |
| packages/phase2cli/tsconfig.json | Move package TS module settings to nodenext. |
| packages/phase2cli/build.tsconfig.json | Align build TS moduleResolution to nodenext; formatting. |
| packages/phase2cli/rollup.config.ts | Swap to @rollup/plugin-typescript; tweak plugin options. |
| packages/phase2cli/package.json | Update start command to Node loader; add @rollup/plugin-typescript; remove old plugin. |
| packages/backend/tsconfig.json | Adjust TS module/moduleResolution for backend package. |
| packages/backend/build.tsconfig.json | Set module/moduleResolution for build output. |
| packages/backend/rollup.config.ts | Swap to @rollup/plugin-typescript; remove useTsconfigDeclarationDir. |
| packages/backend/package.json | Update Node engine to 20; adjust Rollup invocation; switch TS Rollup plugin dep. |
| packages/actions/tsconfig.json | Align Actions package TS module/moduleResolution to nodenext. |
| packages/actions/build.tsconfig.json | Change extends target and set build output options. |
| packages/actions/rollup.config.ts | Swap to @rollup/plugin-typescript; adjust export shape and plugin options. |
| packages/actions/package.json | Bump engines to Node >=20; adjust Rollup invocation; switch TS Rollup plugin dep. |
| packages/actions/README.md | Update stated Node prerequisite to 20+. |
| packages/actions/src/helpers/crypto.ts | Handle stream chunk typing differences (`string |
| packages/actions/src/helpers/utils.ts | Cast winston log.message to string for formatter typing. |
| packages/actions/test/utils/storage.ts | Use typed S3 canned ACL enum (ObjectCannedACL.public_read). |
| packages/actions/test/unit/verification.test.ts | Refactor proof inputs reuse; fix invalid-vkey test invocation. |
| .github/workflows/website.yaml | Set Node version to 20 for docs site workflow. |
| .github/workflows/test-firebase-emulator.yaml | Set Node version to 20 for emulator tests. |
| .github/workflows/publish-staging-packages.yaml | Set Node version to 20 for staging publish. |
| .github/workflows/publish-production-packages.yaml | Set Node version to 20 for production publish. |
| .github/workflows/publish-on-tag-push.yaml | Set Node version to 20 for tag-based publish. |
| .github/workflows/publish-dev-packages.yaml | Set Node version to 20 for dev publish. |
| .github/workflows/firebase-deploy-staging.yaml | Set Node version to 20 for staging deploy. |
| .github/workflows/firebase-deploy-production.yaml | Set Node version to 20 for production deploy. |
| .github/workflows/firebase-deploy-dev.yaml | Set Node version to 20 for dev deploy. |
Comments suppressed due to low confidence (1)
packages/actions/rollup.config.ts:21
@rollup/plugin-typescriptemits declarations based onbuild.tsconfig.json(which setsdeclarationDir). With declarations enabled, this plugin requires Rollup to useoutput.dir(notoutput.file), otherwise the build can fail with "Rollup 'dir' option must be used when Typescript compiler option 'declarationDir' is specified". Consider switching outputs todirand configuringentryFileNames/chunkFileNames(or generate.d.tsin a separatetscstep).
input: "src/index.ts",
output: [
{ file: pkg.exports.require, format: "cjs", banner, exports: "auto" },
{ file: pkg.exports.import, format: "es", banner }
],
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 16 | ||
| node-version: 20 | ||
|
|
There was a problem hiding this comment.
This workflow still uses Node16-based actions (actions/checkout@v3, actions/setup-node@v3, actions/setup-java@v3, actions/cache@v3, and aws-actions/configure-aws-credentials@v2). Node16 actions are no longer supported on GitHub-hosted runners, so these should be updated to their Node20 variants (e.g., checkout@v4, setup-node@v4, setup-java@v4, cache@v4, configure-aws-credentials@v4).
| - name: Use Node.js 20 | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 16 | ||
| node-version: 20 | ||
| registry-url: "https://registry.npmjs.org" | ||
| cache: yarn |
There was a problem hiding this comment.
This workflow still uses Node16-based actions (actions/checkout@v3 and actions/setup-node@v3). Please bump to Node20 variants (checkout@v4, setup-node@v4) to keep publishing working.
| - name: Use Node.js 20 | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 16 | ||
| node-version: 20 | ||
| registry-url: "https://registry.npmjs.org" | ||
|
|
There was a problem hiding this comment.
This workflow still uses Node16-based actions (actions/checkout@v3 and actions/setup-node@v3). Please bump to checkout@v4 and setup-node@v4 to avoid failures on current GitHub Actions runners.
| input: "src/index.ts", | ||
| output: [{ file: pkg.main, format: "es", banner }], | ||
| plugins: [ | ||
| autoExternal(), | ||
| (typescript as any)({ | ||
| tsconfig: "./build.tsconfig.json", | ||
| useTsconfigDeclarationDir: true | ||
| sourceMap: true | ||
| }), |
There was a problem hiding this comment.
@rollup/plugin-typescript + TypeScript declarations (build.tsconfig.json has declarationDir) typically requires Rollup to use output.dir instead of output.file; otherwise builds can fail with an error requiring the Rollup dir option when declarationDir is set. Consider switching to output.dir (and set entryFileNames if you need a specific filename like index.js) or generate declarations in a separate tsc step.
| "build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript", | ||
| "build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript", | ||
| "start": "ts-node --esm ./src/index.ts", | ||
| "start": "node --loader ts-node/esm ./src/index.ts", | ||
| "auth": "yarn start auth", |
There was a problem hiding this comment.
The package engines.node still allows Node >=16.14.0, but this PR migrates execution to Node 20 (and the start script now relies on the Node loader workflow). To avoid publishing misleading engine constraints (and mismatches with CI), bump engines.node here to a Node 20 range (e.g., >=20.0.0) to match the migration.
| - name: Use Node.js 20 | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 16 | ||
| node-version: 20 | ||
| registry-url: "https://registry.npmjs.org" | ||
| cache: yarn |
There was a problem hiding this comment.
This workflow still uses Node16-based actions (actions/checkout@v3 and actions/setup-node@v3). Node16 actions are no longer supported on GitHub-hosted runners, so please bump to checkout@v4 and setup-node@v4.
| - name: Use Node.js 20 | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 16 | ||
| node-version: 20 | ||
| registry-url: "https://registry.npmjs.org" | ||
|
|
There was a problem hiding this comment.
This workflow still references Node16-based actions (actions/checkout@v3 and actions/setup-node@v3). Since Node16 actions are no longer supported on GitHub-hosted runners, bump to checkout@v4 and setup-node@v4.
| - name: Use Node.js 20 | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 16 | ||
| node-version: 20 | ||
| registry-url: "https://registry.npmjs.org" | ||
|
|
There was a problem hiding this comment.
This workflow still uses Node16-based actions (actions/checkout@v3 and actions/setup-node@v3). Node16 actions are no longer supported on GitHub-hosted runners, so bump to checkout@v4 and setup-node@v4.
| autoExternal(), | ||
| (typescript as any)({ | ||
| tsconfig: "./build.tsconfig.json", | ||
| useTsconfigDeclarationDir: true | ||
| }), |
There was a problem hiding this comment.
@rollup/plugin-typescript emits declarations per build.tsconfig.json (declarationDir is set). With declarations enabled, this plugin requires using Rollup output.dir (not output.file), otherwise the build can fail with an error about needing the dir option when declarationDir is specified. Consider switching outputs to dir + entryFileNames/chunkFileNames, or generate .d.ts via a separate tsc step.
| - uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 16 | ||
| node-version: 20 | ||
| cache: yarn |
There was a problem hiding this comment.
This workflow still references multiple Node16-based actions (actions/checkout@v3, actions/configure-pages@v3, actions/setup-node@v3, actions/upload-pages-artifact@v1, actions/deploy-pages@v2). Since Node16 actions are no longer supported on GitHub-hosted runners, these should be bumped to their Node20 variants (e.g., checkout@v4, configure-pages@v4, setup-node@v4, upload-pages-artifact@v3, deploy-pages@v3).
No description provided.