build: generate compatibility types after production build

This commit is contained in:
vorotamoroz
2026-07-30 12:18:01 +00:00
parent 725b5eb9a0
commit 31445a35bb
2 changed files with 12 additions and 0 deletions
+1
View File
@@ -23,6 +23,7 @@
"prettyCheck": "npm run prettyNoWrite -- --check",
"prettyNoWrite": "prettier --config ./.prettierrc.mjs \"**/*.js\" \"**/*.ts\" \"**/*.json\" ",
"postinstall": "npm run generate:type-resolution-compat",
"postbuild": "npm run generate:type-resolution-compat",
"precheck:compatibility": "npm run build",
"check:compatibility": "node utils/check-compatibility.js --file main.js --ios 15",
"check": "npm run tsc-check && npm run tsc-check:apps && npm run lint && npm run lint:community -- --quiet && npm run lint:community:tools && npm run svelte-check && npm run check:compatibility",
@@ -122,6 +122,17 @@ function validSyntheticExports(): Record<string, unknown> {
};
}
Deno.test("root postbuild generates the type-resolution compatibility mirror", async () => {
const repositoryRoot = await Deno.realPath(new URL("../../", import.meta.url));
const packageJson = JSON.parse(await Deno.readTextFile(`${repositoryRoot}/package.json`)) as {
scripts?: Record<string, string>;
};
assert(
packageJson.scripts?.postbuild === "npm run generate:type-resolution-compat",
"root postbuild does not invoke the compatibility generator"
);
});
Deno.test("generator covers the installed package export maps deterministically", async () => {
const repositoryRoot = await Deno.realPath(new URL("../../", import.meta.url));
const temporaryDirectory = await Deno.makeTempDir({ prefix: "livesync-type-generator-" });