Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

build: raise engines.node to 22.19

Yudhi Armyndharis7c5d274b569e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d39310fa2..8ba656e25 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- The Italian (`it`) dashboard translates the session proxy Save button, the webhook chat-kind filter label and the warning shown when a backup export leaves out media ([#1583](https://github.com/rmyndharis/OpenWA/pull/1583)). Thanks @albanobattistella.
+- From-source minimum Node.js rises from 22.13 to **22.19**, the floor of the bundled `undici`.
### Fixed
diff --git a/package-lock.json b/package-lock.json
index 001c01400..d787cac11 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -83,7 +83,7 @@
"typescript-eslint": "^8.70.0"
},
"engines": {
- "node": ">=22.13"
+ "node": ">=22.19"
}
},
"node_modules/@angular-devkit/core": {
diff --git a/package.json b/package.json
index 2f0c36959..8931da433 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"private": true,
"license": "MIT",
"engines": {
- "node": ">=22.13"
+ "node": ">=22.19"
},
"scarfSettings": {
"enabled": false
diff --git a/src/common/node-engine-floor.spec.ts b/src/common/node-engine-floor.spec.ts
new file mode 100644
index 000000000..13fbd048a
--- /dev/null
+++ b/src/common/node-engine-floor.spec.ts
@@ -0,0 +1,66 @@
+import { readFileSync } from 'node:fs';
+import { join } from 'node:path';
+
+/**
+ * `engines.node` is the only minimum a from-source install is told about, so it must not sit below
+ * the floor of a package the lockfile installs: on such a Node, `npm ci` warns (or fails under
+ * engine-strict) and the dependency may use an API the runtime lacks. The check reads only plain
+ * `>=X.Y.Z` floors, the shape that actually raises the minimum; a `||` range already admits several
+ * majors and is left to npm. Optional platform binaries are skipped, as npm skips them.
+ */
+describe('package.json engines.node covers every installed package floor', () => {
+ const repo = join(__dirname, '..', '..');
+ const readJson = <T>(file: string): T => JSON.parse(readFileSync(join(repo, file), 'utf8')) as T;
+
+ type Version = [number, number, number];
+ const parse = (text: string): Version => {
+ const [major = 0, minor = 0, patch = 0] = text.split('.').map(part => Number.parseInt(part, 10) || 0);
+ return [major, minor, patch];
+ };
+ const below = (a: Version, b: Version): boolean => {
+ for (let i = 0; i < 3; i++) if (a[i] !== b[i]) return a[i] < b[i];
+ return false;
+ };
+ const floorOf = (range: string): Version | null => {
+ const match = /^\s*>=\s*v?(\d+(?:\.\d+){0,2})\s*$/.exec(range);
+ return match ? parse(match[1]) : null;
+ };
+
+ const unmetFloors = (declared: string, packages: Record<string, { optional?: boolean; engines?: unknown }>) => {
+ const own = floorOf(declared);
+ if (!own) throw new Error(`engines.node must be a plain >= floor, got "${declared}"`);
+ const unmet: string[] = [];
+ for (const [path, meta] of Object.entries(packages)) {
+ if (!path || meta.optional) continue;
+ const range = (meta.engines as { node?: string } | undefined)?.node;
+ const floor = typeof range === 'string' ? floorOf(range) : null;
+ if (floor && below(own, floor)) unmet.push(`${path.replace(/^.*node_modules\//, '')} ${range}`);
+ }
+ return unmet.sort();
+ };
+
+ it('is not below any non-optional package in package-lock.json', () => {
+ const pkg = readJson<{ engines: { node: string } }>('package.json');
+ const lock = readJson<{ packages: Record<string, { optional?: boolean; engines?: unknown }> }>('package-lock.json');
+
+ // Guard the scan: a lockfile read that found no floors would pass vacuously.
+ const floors = Object.values(lock.packages).filter(
+ meta => typeof (meta.engines as { node?: unknown } | undefined)?.node === 'string',
+ );
+ expect(floors.length).toBeGreaterThan(50);
+ expect(lock.packages[''].engines).toEqual(pkg.engines);
+
+ expect(unmetFloors(pkg.engines.node, lock.packages)).toEqual([]);
+ });
+
+ it('names a package whose floor is above the declared one', () => {
+ const packages = {
+ '': {},
+ 'node_modules/high': { engines: { node: '>=22.19.0' } },
+ 'node_modules/multi': { engines: { node: '^20.19.0 || >=24' } },
+ 'node_modules/bin': { optional: true, engines: { node: '>=99' } },
+ };
+ expect(unmetFloors('>=22.13', packages)).toEqual(['high >=22.19.0']);
+ expect(unmetFloors('>=22.19', packages)).toEqual([]);
+ });
+});