Migrate project runtime from Node 18 to Node 24

This commit is contained in:
Kili 2026-02-23 10:07:36 +01:00
parent 67180d90a5
commit 37c65ee4be
18 changed files with 28 additions and 25 deletions

View File

@ -44,7 +44,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: 24
cache: 'npm'
- name: Install dependencies

View File

@ -18,7 +18,7 @@ jobs:
- name: Set node version
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 24
registry-url: "https://registry.npmjs.org"
- name: Install

View File

@ -17,7 +17,7 @@ jobs:
- name: Set node version
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 24
registry-url: "https://registry.npmjs.org"
- name: Install

View File

@ -24,7 +24,7 @@ jobs:
- name: Set node version
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 24
registry-url: "https://registry.npmjs.org"
- name: Install
@ -104,7 +104,7 @@ jobs:
- name: Set node version
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 24
registry-url: "https://registry.npmjs.org"
- name: Install
@ -116,7 +116,7 @@ jobs:
- name: Reset node version ready for publish
uses: actions/setup-node@v4
with:
node-version: 24.5
node-version: 24
registry-url: "https://registry.npmjs.org"
- name: Publish to NPM

View File

@ -44,7 +44,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: 24
cache: 'npm'
- name: Cache node modules

View File

@ -193,16 +193,16 @@
"start": "npx grunt dev",
"build": "npx grunt prod",
"node": "npx grunt node",
"repl": "node --experimental-modules --experimental-json-modules --experimental-specifier-resolution=node --no-experimental-fetch --no-warnings src/node/repl.mjs",
"test": "npx grunt configTests && node --experimental-modules --experimental-json-modules --no-warnings --no-deprecation --openssl-legacy-provider --no-experimental-fetch tests/node/index.mjs && node --experimental-modules --experimental-json-modules --no-warnings --no-deprecation --openssl-legacy-provider --no-experimental-fetch --trace-uncaught tests/operations/index.mjs",
"repl": "node --no-experimental-fetch --no-warnings src/node/repl.mjs",
"test": "npx grunt configTests && node --no-warnings --no-deprecation --openssl-legacy-provider --no-experimental-fetch tests/node/index.mjs && node --no-warnings --no-deprecation --openssl-legacy-provider --no-experimental-fetch --trace-uncaught tests/operations/index.mjs",
"testnodeconsumer": "npx grunt testnodeconsumer",
"testui": "npx grunt testui",
"testuidev": "npx nightwatch --env=dev",
"lint": "npx grunt lint",
"lint:grammar": "cspell ./src",
"postinstall": "npx grunt exec:fixCryptoApiImports && npx grunt exec:fixSnackbarMarkup && npx grunt exec:fixJimpModule",
"newop": "node --experimental-modules --experimental-json-modules src/core/config/scripts/newOperation.mjs",
"minor": "node --experimental-modules --experimental-json-modules src/core/config/scripts/newMinorVersion.mjs",
"newop": "node src/core/config/scripts/newOperation.mjs",
"minor": "node src/core/config/scripts/newMinorVersion.mjs",
"getheapsize": "node -e 'console.log(`node heap limit = ${require(\"v8\").getHeapStatistics().heap_size_limit / (1024 * 1024)} Mb`)'",
"setheapsize": "export NODE_OPTIONS=--max_old_space_size=2048",
"security:audit": "npm audit",
@ -211,5 +211,8 @@
"security:triage": "node scripts/vulnerability-triage.js",
"security:triage:json": "node scripts/vulnerability-triage.js --json",
"security:check": "npm run security:triage && npm run lint"
},
"engines": {
"node": ">=24"
}
}

View File

@ -7,7 +7,7 @@
*/
import Chef from "./Chef.mjs";
import OperationConfig from "./config/OperationConfig.json" assert {type: "json"};
import OperationConfig from "./config/OperationConfig.json" with { type: "json" };
import OpModules from "./config/modules/OpModules.mjs";
import loglevelMessagePrefix from "loglevel-message-prefix";

View File

@ -4,7 +4,7 @@
* @license Apache-2.0
*/
import OperationConfig from "./config/OperationConfig.json" assert {type: "json"};
import OperationConfig from "./config/OperationConfig.json" with { type: "json" };
import OperationError from "./errors/OperationError.mjs";
import Operation from "./Operation.mjs";
import DishError from "./errors/DishError.mjs";

View File

@ -20,7 +20,7 @@ const dir = path.join(process.cwd() + "/src/core/config/");
if (!fs.existsSync(dir)) {
console.log("\nCWD: " + process.cwd());
console.log("Error: generateConfig.mjs should be run from the project root");
console.log("Example> node --experimental-modules src/core/config/scripts/generateConfig.mjs");
console.log("Example> node src/core/config/scripts/generateConfig.mjs");
process.exit(1);
}

View File

@ -17,7 +17,7 @@ const dir = path.join(process.cwd() + "/src/core/config/");
if (!fs.existsSync(dir)) {
console.log("\nCWD: " + process.cwd());
console.log("Error: generateOpsIndex.mjs should be run from the project root");
console.log("Example> node --experimental-modules src/core/config/scripts/generateOpsIndex.mjs");
console.log("Example> node src/core/config/scripts/generateOpsIndex.mjs");
process.exit(1);
}

View File

@ -18,7 +18,7 @@ const dir = path.join(process.cwd() + "/src/core/config/");
if (!fs.existsSync(dir)) {
console.log("\nCWD: " + process.cwd());
console.log("Error: newMinorVersion.mjs should be run from the project root");
console.log("Example> node --experimental-modules src/core/config/scripts/newMinorVersion.mjs");
console.log("Example> node src/core/config/scripts/newMinorVersion.mjs");
process.exit(1);
}

View File

@ -20,7 +20,7 @@ const dir = path.join(process.cwd() + "/src/core/operations/");
if (!fs.existsSync(dir)) {
console.log("\nCWD: " + process.cwd());
console.log("Error: newOperation.mjs should be run from the project root");
console.log("Example> node --experimental-modules src/core/config/scripts/newOperation.mjs");
console.log("Example> node src/core/config/scripts/newOperation.mjs");
process.exit(1);
}

View File

@ -1,4 +1,4 @@
import OperationConfig from "../config/OperationConfig.json" assert {type: "json"};
import OperationConfig from "../config/OperationConfig.json" with { type: "json" };
import Utils, { isWorkerEnvironment } from "../Utils.mjs";
import Recipe from "../Recipe.mjs";
import Dish from "../Dish.mjs";

View File

@ -10,7 +10,7 @@
import NodeDish from "./NodeDish.mjs";
import NodeRecipe from "./NodeRecipe.mjs";
import OperationConfig from "../core/config/OperationConfig.json" assert {type: "json"};
import OperationConfig from "../core/config/OperationConfig.json" with { type: "json" };
import { sanitise, removeSubheadingsFromArray, sentenceToCamelCase } from "./apiUtils.mjs";
import ExcludedOperationError from "../core/errors/ExcludedOperationError.mjs";

View File

@ -23,7 +23,7 @@ const dir = path.join(`${process.cwd()}/src/node`);
if (!fs.existsSync(dir)) {
console.log("\nCWD: " + process.cwd());
console.log("Error: generateNodeIndex.mjs should be run from the project root");
console.log("Example> node --experimental-modules src/node/config/scripts/generateNodeIndex.mjs");
console.log("Example> node src/node/config/scripts/generateNodeIndex.mjs");
process.exit(1);
}

View File

@ -17,8 +17,8 @@ import * as CanvasComponents from "../core/lib/CanvasComponents.mjs";
// CyberChef
import App from "./App.mjs";
import Categories from "../core/config/Categories.json" assert {type: "json"};
import OperationConfig from "../core/config/OperationConfig.json" assert {type: "json"};
import Categories from "../core/config/Categories.json" with { type: "json" };
import OperationConfig from "../core/config/OperationConfig.json" with { type: "json" };
/**

View File

@ -1,5 +1,5 @@
import sm from "sitemap";
import OperationConfig from "../../core/config/OperationConfig.json" assert {type: "json"};
import OperationConfig from "../../core/config/OperationConfig.json" with { type: "json" };
/**

View File

@ -1,6 +1,6 @@
import TestRegister from "../../lib/TestRegister.mjs";
import Categories from "../../../src/core/config/Categories.json" assert {type: "json"};
import OperationConfig from "../../../src/core/config/OperationConfig.json" assert {type: "json"};
import Categories from "../../../src/core/config/Categories.json" with { type: "json" };
import OperationConfig from "../../../src/core/config/OperationConfig.json" with { type: "json" };
import it from "../assertionHandler.mjs";
import assert from "assert";