mirror of
https://github.com/mvschwarz/openrig.git
synced 2026-11-08 17:31:56 -10:00
fix(cli): let node guard handle odd releases
This commit is contained in:
1 parent
d2243da13b
commit
e8d6a4e92b
2 files changed
+18
-7
No files matched your search
@@ -61,6 +61,6 @@
|
||||
"vitest": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20 || ^22 || ^24"
|
||||
"node": ">=20"
|
||||
}
|
||||
}
|
||||
@@ -2,23 +2,34 @@ import { readFileSync } from "node:fs";
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
const EXPECTED_ENGINE = "^20 || ^22 || ^24";
|
||||
const LTS_ENGINE = "^20 || ^22 || ^24";
|
||||
const CLI_ENGINE = ">=20";
|
||||
|
||||
const PACKAGE_PATHS = [
|
||||
const LTS_PACKAGE_PATHS = [
|
||||
"package.json",
|
||||
"packages/cli/package.json",
|
||||
"packages/daemon/package.json",
|
||||
];
|
||||
|
||||
for (const pkgPath of PACKAGE_PATHS) {
|
||||
for (const pkgPath of LTS_PACKAGE_PATHS) {
|
||||
test(`${pkgPath} has engines.node set to LTS-only constraint`, () => {
|
||||
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
||||
assert.ok(pkg.engines, `${pkgPath} is missing an "engines" field`);
|
||||
assert.ok(pkg.engines.node, `${pkgPath} is missing "engines.node"`);
|
||||
assert.equal(
|
||||
pkg.engines.node,
|
||||
EXPECTED_ENGINE,
|
||||
`${pkgPath} engines.node should be "${EXPECTED_ENGINE}" (even-numbered LTS only) but got "${pkg.engines.node}"`
|
||||
LTS_ENGINE,
|
||||
`${pkgPath} engines.node should be "${LTS_ENGINE}" (even-numbered LTS only) but got "${pkg.engines.node}"`
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
test("published CLI allows odd Node majors to reach the postinstall ABI guard", () => {
|
||||
const pkgPath = "packages/cli/package.json";
|
||||
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
||||
assert.ok(pkg.engines, `${pkgPath} is missing an "engines" field`);
|
||||
assert.equal(
|
||||
pkg.engines.node,
|
||||
CLI_ENGINE,
|
||||
`${pkgPath} engines.node should be "${CLI_ENGINE}" so npm selects the latest package and check-abi.mjs prints the supported-Node fix`
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user