Files
presenton--presenton/scripts/package-metadata.test.mjs
WeHub Mirror fa90340b1a
Test All Applications / Test repository tooling (push) Has been cancelled
Test All Applications / Test FastAPI (push) Has been cancelled
Test All Applications / Test Next.js (push) Has been cancelled
WeHub snapshot of bed1fc6c31b94d844191893a1c212d8fbe0f6d0b
2026-08-07 16:57:15 +08:00

57 lines
1.8 KiB
JavaScript

import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import path from "node:path";
import test from "node:test";
import { fileURLToPath } from "node:url";
const repoRoot = path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
"..",
);
async function readJson(relativePath) {
return JSON.parse(await readFile(path.join(repoRoot, relativePath), "utf8"));
}
test("application versions stay aligned", async () => {
const [rootPackage, rootLock, electronPackage, electronLock] =
await Promise.all([
readJson("package.json"),
readJson("package-lock.json"),
readJson("electron/package.json"),
readJson("electron/package-lock.json"),
]);
assert.equal(rootPackage.version, "0.9.2-beta");
assert.equal(electronPackage.version, rootPackage.version);
assert.equal(rootLock.version, rootPackage.version);
assert.equal(rootLock.packages[""].version, rootPackage.version);
assert.equal(electronLock.version, electronPackage.version);
assert.equal(electronLock.packages[""].version, electronPackage.version);
});
test("Docker and Electron use the same pinned presentation export", async () => {
const [rootPackage, electronPackage, dockerfile, dockerfileDev] =
await Promise.all([
readJson("package.json"),
readJson("electron/package.json"),
readFile(path.join(repoRoot, "Dockerfile"), "utf8"),
readFile(path.join(repoRoot, "Dockerfile.dev"), "utf8"),
]);
assert.equal(
electronPackage.exportVersion,
rootPackage.presentationExportVersion,
);
assert.match(dockerfile, /COPY package\.json \/app\//);
assert.match(
dockerfile,
/sync-presentation-export\.cjs --force/,
);
assert.match(dockerfileDev, /COPY package\.json package-lock\.json \/app\//);
assert.match(
dockerfileDev,
/sync-presentation-export\.cjs --force/,
);
});