From dbff9314418d30df203c32fe83f2a1b56653d0a6 Mon Sep 17 00:00:00 2001
From: Romain Beaumont <romain.rom1@gmail.com>
Date: Sun, 26 Jan 2025 22:30:30 +0100
Subject: [PATCH] Use node 22 (#3570)

Node 22 is now LTS, switch to that in CI and supported node version.
---
 .github/workflows/ci.yml          | 12 ++++++------
 .github/workflows/npm-publish.yml |  2 +-
 index.js                          |  2 +-
 package.json                      |  2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e307beace..54a142971 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -12,10 +12,10 @@ jobs:
 
     steps:
     - uses: actions/checkout@v2
-    - name: Use Node.js 18.x
+    - name: Use Node.js 22.x
       uses: actions/setup-node@v1.4.4
       with:
-        node-version: 18.x
+        node-version: 22.x
     - run: npm i && npm run lint
   
   PrepareSupportedVersions:
@@ -25,10 +25,10 @@ jobs:
 
     steps:
     - uses: actions/checkout@v2
-    - name: Use Node.js 18.x
+    - name: Use Node.js 22.x
       uses: actions/setup-node@v1.4.4
       with:
-        node-version: 18.x
+        node-version: 22.x
     - id: set-matrix
       run: |
         node -e "
@@ -45,10 +45,10 @@ jobs:
 
     steps:
       - uses: actions/checkout@v2
-      - name: Use Node.js 18.x
+      - name: Use Node.js 22.x
         uses: actions/setup-node@v1.4.4
         with:
-          node-version: 18.x
+          node-version: 22.x
       - name: Setup Java JDK
         uses: actions/setup-java@v1.4.3
         with:
diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml
index dad495633..95e11fb82 100644
--- a/.github/workflows/npm-publish.yml
+++ b/.github/workflows/npm-publish.yml
@@ -13,7 +13,7 @@ jobs:
     - name: Set up Node.js
       uses: actions/setup-node@master
       with:
-        node-version: 18.0.0
+        node-version: 22.0.0
     - id: publish
       uses: JS-DevTools/npm-publish@v1
       with:
diff --git a/index.js b/index.js
index 1b29c8376..cb4f1ca62 100644
--- a/index.js
+++ b/index.js
@@ -1,6 +1,6 @@
 if (typeof process !== 'undefined' && !process.browser && process.platform !== 'browser' && parseInt(process.versions.node.split('.')[0]) < 18) {
   console.error('Your node version is currently', process.versions.node)
-  console.error('Please update it to a version >= 18.x.x from https://nodejs.org/')
+  console.error('Please update it to a version >= 22.x.x from https://nodejs.org/')
   process.exit(1)
 }
 
diff --git a/package.json b/package.json
index 897d8193e..42861bb6d 100644
--- a/package.json
+++ b/package.json
@@ -17,7 +17,7 @@
     "url": "git://github.com/PrismarineJS/mineflayer.git"
   },
   "engines": {
-    "node": ">=18"
+    "node": ">=22"
   },
   "license": "MIT",
   "dependencies": {