Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .changeset/upgrade-nodejs-22.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@api3/airnode-admin": minor
"@api3/airnode-deployer": minor
"@api3/airnode-node": minor
"@api3/airnode-adapter": minor
"@api3/airnode-utilities": minor
"@api3/airnode-validator": minor
"@api3/airnode-abi": minor
"@api3/airnode-protocol": minor
"@api3/airnode-operation": minor
"@api3/airnode-examples": minor
---

Upgrade Node.js from version 20 to version 22
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

env:
DOCKER_BUILDKIT: 1
TARGET_NODE_VERSION: '20.17.0'
TARGET_NODE_VERSION: '22.18.0'

jobs:
documentation:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ on:
push:
branches:
- master
types: [opened, synchronize, reopened]
pull_request:
# The branches below must be a subset of the branches above
branches:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/protocol-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

env:
DOCKER_BUILDKIT: 1
TARGET_NODE_VERSION: '20.17.0'
TARGET_NODE_VERSION: '22.18.0'

jobs:
pre-build:
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20.17.0-alpine3.20 AS environment
FROM node:22.18.0-alpine3.21 AS environment

ENV appDir="/app" \
buildDir="/build" \
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0",
"private": true,
"engines": {
"node": "^20.17.0"
"node": "^22.18.0"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -110,7 +110,7 @@
"@changesets/cli": "^2.27.1",
"@octokit/core": "^5.2.0",
"@types/libsodium-wrappers": "^0.7.14",
"@types/node": "^20.17.0",
"@types/node": "^22.10.0",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"@vercel/ncc": "^0.38.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-admin/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20.17.0-alpine3.20
FROM node:22.18.0-alpine3.21

ARG npmRegistryUrl=https://registry.npmjs.org/
ARG npmTag=latest
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"devDependencies": {
"@types/lodash": "^4.17.0",
"@types/node": "^20.17.0",
"@types/node": "^22.10.0",
"@types/yargs": "^17.0.32",
"jest": "^29.7.0",
"rimraf": "^6.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-deployer/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20.17.0-alpine3.20
FROM node:22.18.0-alpine3.21

ARG npmRegistryUrl=https://registry.npmjs.org/
ARG npmTag=latest
Expand Down
4 changes: 2 additions & 2 deletions packages/airnode-deployer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
},
"devDependencies": {
"@aws-sdk/util-stream-node": "^3.374.0",
"@google-cloud/functions-framework": "^3.4.0",
"@google-cloud/functions-framework": "^4.0.0",
"@types/adm-zip": "^0.5.7",
"@types/aws-lambda": "^8.10.137",
"@types/lodash": "^4.17.0",
"@types/node": "^20.17.0",
"@types/node": "^22.10.0",
"@types/yargs": "^17.0.32",
"aws-sdk-client-mock": "^4.0.0",
"aws-sdk-client-mock-jest": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-deployer/src/infrastructure/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ describe('removeAirnode', () => {

beforeEach(() => {
mutableDirectoryStructure = cloneDeep(mockBucketDirectoryStructure);
exec.mockImplementation(() => ({}));
exec.mockImplementation(() => ({ stdout: '' }));
awsGetAirnodeBucketSpy = jest.spyOn(aws, 'getAirnodeBucket').mockResolvedValue(bucket);
awsGetBucketDirectoryStructureSpy = jest
.spyOn(aws, 'getBucketDirectoryStructure')
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-deployer/src/infrastructure/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export async function runCommand(command: string, options: CommandOptions) {
}

commandSpinner.succeed(`Finished command '${command}' with options ${stringifiedOptions}`);
return goExec.data.stdout;
return goExec.data.stdout.toString();
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor node.js 22 update as the data.stdout type is stdout: string | NonSharedBuffer

}

export type CommandArg = string | [string, string] | [string, string, string];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ resource "aws_lambda_function" "lambda" {
function_name = var.name
handler = var.handler
memory_size = var.memory_size
runtime = "nodejs20.x"
runtime = "nodejs22.x"
role = aws_iam_role.lambda_role.arn
timeout = var.timeout
reserved_concurrent_executions = var.reserved_concurrent_executions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ resource "google_storage_bucket_object" "function_zip" {

resource "google_cloudfunctions_function" "function" {
name = var.name
runtime = "nodejs20"
runtime = "nodejs22"

available_memory_mb = var.memory_size
source_archive_bucket = google_storage_bucket_object.function_zip.bucket
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-waffle": "^2.0.6",
"@types/jest": "^29.5.12",
"@types/node": "^20.17.0",
"@types/node": "^22.10.0",
"@types/prompts": "^2.4.9",
"chalk": "^4.1.2",
"dotenv": "^16.4.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-node/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20.17.0-alpine3.20
FROM node:22.18.0-alpine3.21

ARG npmRegistryUrl=https://registry.npmjs.org/
ARG npmTag=latest
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@types/express": "^4.17.21",
"@types/jest": "^29.5.12",
"@types/lodash": "^4.17.0",
"@types/node": "^20.17.0",
"@types/node": "^22.10.0",
"@types/yargs": "^17.0.32",
"aws-sdk-client-mock": "^4.0.0",
"aws-sdk-client-mock-jest": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@types/jest": "^29.5.12",
"@types/node": "^20.17.0",
"@types/node": "^22.10.0",
"hardhat": "^2.22.18",
"jest": "^29.7.0",
"rimraf": "^6.0.1",
Expand Down
28 changes: 17 additions & 11 deletions packages/airnode-utilities/src/caching/index.test.ts
Copy link
Contributor

Choose a reason for hiding this comment

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

Dirent caused issues in the 20 -> 22 conversion, and I simultaneously wanted to see if copilot, when forced, could get the typing figured out without the use of as unknown or any and seems like it has.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fs, { Dirent, PathLike, Stats } from 'fs';
import fs, { PathLike, Stats } from 'fs';
import { caching, CACHE_BASE_PATH } from './index';

describe('caching utils', () => {
Expand Down Expand Up @@ -36,14 +36,17 @@ describe('caching utils', () => {
const filesStatData = files.map((file) => ({ file, mtimeMs: 1 }));

const readdirSyncSpy = jest.spyOn(fs, 'readdirSync');
readdirSyncSpy.mockReturnValueOnce(files as unknown as Dirent[]);
readdirSyncSpy.mockImplementation(
((_path: fs.PathLike, _options?: BufferEncoding | fs.ObjectEncodingOptions | null) =>
files) as typeof fs.readdirSync
);

const statSyncSpy = jest.spyOn(fs, 'statSync');

statSyncSpy.mockImplementation(
(file: PathLike) =>
filesStatData.find((statData) => file.toString().indexOf(statData.file) > -1)! as unknown as Stats
);
statSyncSpy.mockImplementation((file: PathLike) => {
const fileData = filesStatData.find((statData) => file.toString().indexOf(statData.file) > -1)!;
return { mtimeMs: fileData.mtimeMs } as Stats;
});

const rmSyncSpy = jest.spyOn(fs, 'rmSync');
rmSyncSpy.mockImplementation(() => {});
Expand All @@ -60,14 +63,17 @@ describe('caching utils', () => {
const filesStatData = files.map((file) => ({ file, mtimeMs: Date.now() }));

const readdirSyncSpy = jest.spyOn(fs, 'readdirSync');
readdirSyncSpy.mockReturnValueOnce(files as unknown as Dirent[]);
readdirSyncSpy.mockImplementation(
((_path: fs.PathLike, _options?: BufferEncoding | fs.ObjectEncodingOptions | null) =>
files) as typeof fs.readdirSync
);

const statSyncSpy = jest.spyOn(fs, 'statSync');

statSyncSpy.mockImplementation(
(file: PathLike) =>
filesStatData.find((statData) => file.toString().indexOf(statData.file) > -1)! as unknown as Stats
);
statSyncSpy.mockImplementation((file: PathLike) => {
const fileData = filesStatData.find((statData) => file.toString().indexOf(statData.file) > -1)!;
return { mtimeMs: fileData.mtimeMs } as Stats;
});

const rmSyncSpy = jest.spyOn(fs, 'rmSync');
rmSyncSpy.mockImplementation(() => {});
Expand Down
Loading