3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-20 23:25:43 +01:00

Publish the bundle size in the README and fail the gate when it drifts a tenth

This commit is contained in:
2026-11-15 13:37:58 +01:00
committed by Lillem4n
parent 0a6522aa62
commit 6b7a8e691b
14 changed files with 698 additions and 36 deletions
+6
View File
@@ -19,6 +19,7 @@ import * as marklassian from "marklassian";
import * as mdAdf from "md-adf";
import mdToAdf from "md-to-adf";
import { toMarkdown as mdastToMarkdown } from "mdast-util-to-markdown";
import { minifiedGzippedBytes } from "./figures.mjs";
import { readFileSync } from "node:fs";
const { defaultSchema } = createRequire(import.meta.url)("@atlaskit/adf-schema/schema-default");
@@ -116,6 +117,11 @@ for (const [name, { toAdf, toMarkdown }] of Object.entries(converters)) {
const manifest = JSON.parse(readFileSync(`node_modules/${name}/package.json`, "utf8"));
console.log(`\n## ${name} ${manifest.version}`);
console.log("direct runtime dependencies:", Object.keys(manifest.dependencies ?? {}).length);
try {
console.log("minified and gzipped bytes:", await minifiedGzippedBytes(process.cwd(), name));
} catch (error) {
console.log("minified and gzipped bytes failed:", error.message.split("\n")[0]);
}
const written = toMarkdown && show("ADF to markdown", () => toMarkdown(roundTripDoc));
if (written !== undefined && toAdf) {
const readBack = show("read back", () => toAdf(written));