1
0
mirror of https://github.com/louislam/uptime-kuma.git synced 2025-10-30 23:58:13 +02:00

[Docker] Bump to Node.js 22 (#6222)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Louis Lam
2025-10-27 23:58:27 +08:00
committed by GitHub
parent f6a47f351c
commit 8f3cb770eb
6 changed files with 27 additions and 13 deletions

View File

@@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-22.04, windows-latest, ARM64]
node: [ 18, 20 ]
node: [ 20, 24 ]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
@@ -30,7 +30,7 @@ jobs:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
- run: npm install
@@ -49,7 +49,7 @@ jobs:
strategy:
matrix:
os: [ ARMv7 ]
node: [ 18, 20 ]
node: [ 20, 22 ]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
@@ -57,7 +57,7 @@ jobs:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
- run: npm ci --production
@@ -70,7 +70,7 @@ jobs:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: 20
- run: npm install
@@ -84,7 +84,7 @@ jobs:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: 20
- run: npm install

View File

@@ -11,13 +11,13 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node-version: [18]
node-version: [20]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

View File

@@ -32,7 +32,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: 20

View File

@@ -1,5 +1,5 @@
# Download Apprise deb package
FROM node:20-bookworm-slim AS download-apprise
FROM node:22-bookworm-slim AS download-apprise
WORKDIR /app
COPY ./extra/download-apprise.mjs ./download-apprise.mjs
RUN apt update && \
@@ -9,7 +9,7 @@ RUN apt update && \
# Base Image (Slim)
# If the image changed, the second stage image should be changed too
FROM node:20-bookworm-slim AS base2-slim
FROM node:22-bookworm-slim AS base2-slim
ARG TARGETPLATFORM
# Specify --no-install-recommends to skip unused dependencies, make the base much smaller!

View File

@@ -7,7 +7,7 @@
"url": "https://github.com/louislam/uptime-kuma.git"
},
"engines": {
"node": "18 || >= 20.4.0"
"node": ">= 20.4.0"
},
"scripts": {
"lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .",
@@ -27,7 +27,9 @@
"build": "vite build --config ./config/vite.config.js",
"test": "npm run test-backend && npm run test-e2e",
"test-with-build": "npm run build && npm test",
"test-backend": "cross-env TEST_BACKEND=1 node --test test/backend-test",
"test-backend": "node test/test-backend.mjs",
"test-backend-22": "cross-env TEST_BACKEND=1 node --test \"test/backend-test/**/*.js\"",
"test-backend-20": "cross-env TEST_BACKEND=1 node --test test/backend-test",
"test-e2e": "playwright test --config ./config/playwright.config.js",
"test-e2e-ui": "playwright test --config ./config/playwright.config.js --ui --ui-port=51063",
"playwright-codegen": "playwright codegen localhost:3000 --save-storage=./private/e2e-auth.json",

12
test/test-backend.mjs Normal file
View File

@@ -0,0 +1,12 @@
import * as childProcess from "child_process";
const version = parseInt(process.version.slice(1).split(".")[0]);
/**
* Since Node.js 22 introduced a different "node --test" command with glob, we need to run different test commands based on the Node.js version.
*/
if (version < 22) {
childProcess.execSync("npm run test-backend-20", { stdio: "inherit" });
} else {
childProcess.execSync("npm run test-backend-22", { stdio: "inherit" });
}