mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-10-05 17:02:30 +00:00
build: generate compatibility types after production build
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
"prettyCheck": "npm run prettyNoWrite -- --check",
|
"prettyCheck": "npm run prettyNoWrite -- --check",
|
||||||
"prettyNoWrite": "prettier --config ./.prettierrc.mjs \"**/*.js\" \"**/*.ts\" \"**/*.json\" ",
|
"prettyNoWrite": "prettier --config ./.prettierrc.mjs \"**/*.js\" \"**/*.ts\" \"**/*.json\" ",
|
||||||
"postinstall": "npm run generate:type-resolution-compat",
|
"postinstall": "npm run generate:type-resolution-compat",
|
||||||
|
"postbuild": "npm run generate:type-resolution-compat",
|
||||||
"precheck:compatibility": "npm run build",
|
"precheck:compatibility": "npm run build",
|
||||||
"check:compatibility": "node utils/check-compatibility.js --file main.js --ios 15",
|
"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",
|
"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 () => {
|
Deno.test("generator covers the installed package export maps deterministically", async () => {
|
||||||
const repositoryRoot = await Deno.realPath(new URL("../../", import.meta.url));
|
const repositoryRoot = await Deno.realPath(new URL("../../", import.meta.url));
|
||||||
const temporaryDirectory = await Deno.makeTempDir({ prefix: "livesync-type-generator-" });
|
const temporaryDirectory = await Deno.makeTempDir({ prefix: "livesync-type-generator-" });
|
||||||
|
|||||||
Reference in New Issue
Block a user