release: WRNexusJS 0.8.0
This commit is contained in:
@@ -6,6 +6,7 @@ import { fileURLToPath } from "node:url";
|
||||
import process from "node:process";
|
||||
|
||||
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const frameworkVersion = JSON.parse(readFileSync(join(root, "package.json"), "utf8")).version;
|
||||
const issues = [];
|
||||
const warnings = [];
|
||||
const checks = [];
|
||||
@@ -59,8 +60,8 @@ const manifests = trackedFiles
|
||||
.filter(({ value }) => value.name?.startsWith("@wrnexus/"));
|
||||
addCheck(
|
||||
"SEC-PACKAGE-VERSION",
|
||||
manifests.every(({ value }) => value.version === "0.7.0"),
|
||||
"Every @wrnexus package must use version 0.7.0.",
|
||||
manifests.every(({ value }) => value.version === frameworkVersion),
|
||||
`Every @wrnexus package must use version ${frameworkVersion}.`,
|
||||
);
|
||||
addCheck(
|
||||
"SEC-PRIVATE-PUBLISH",
|
||||
@@ -154,12 +155,19 @@ addCheck(
|
||||
dynamicCode.join(", ") || "No dynamic code execution in security foundation packages.",
|
||||
);
|
||||
|
||||
const runtimePath = join(root, "packages", "csr", "src", "reactive-runtime.ts");
|
||||
addCheck(
|
||||
"PERF-RUNTIME-SIZE",
|
||||
statSync(runtimePath).size < 250_000,
|
||||
`Reactive runtime source is ${statSync(runtimePath).size} bytes.`,
|
||||
);
|
||||
const runtimeBudgets = {
|
||||
"reactive-runtime.ts": 150_000,
|
||||
"nav-runtime.ts": 25_000,
|
||||
"realtime-runtime.ts": 15_000,
|
||||
};
|
||||
for (const [file, budget] of Object.entries(runtimeBudgets)) {
|
||||
const bytes = statSync(join(root, "packages", "csr", "src", file)).size;
|
||||
addCheck(
|
||||
`PERF-RUNTIME-SIZE-${file.replace(/-runtime\.ts$/, "").toUpperCase()}`,
|
||||
bytes <= budget,
|
||||
`${file} is ${bytes} bytes (budget ${budget}).`,
|
||||
);
|
||||
}
|
||||
addCheck(
|
||||
"PERF-ZERO-JS-ANALYSIS",
|
||||
existsSync(join(root, "packages", "compiler", "src", "analysis.ts")),
|
||||
@@ -185,19 +193,21 @@ addCheck(
|
||||
|
||||
const report = {
|
||||
schemaVersion: 2,
|
||||
frameworkVersion: "0.7.0",
|
||||
frameworkVersion,
|
||||
generatedAt: new Date().toISOString(),
|
||||
passed: issues.length === 0,
|
||||
checks,
|
||||
warnings,
|
||||
issues,
|
||||
};
|
||||
const reportDir = join(root, ".wrnexus", "reports");
|
||||
mkdirSync(reportDir, { recursive: true });
|
||||
writeFileSync(
|
||||
join(reportDir, "security-performance-0.7.0.json"),
|
||||
JSON.stringify(report, null, 2) + "\n",
|
||||
);
|
||||
if (process.argv.includes("--write")) {
|
||||
const reportDir = join(root, ".wrnexus", "reports");
|
||||
mkdirSync(reportDir, { recursive: true });
|
||||
writeFileSync(
|
||||
join(reportDir, `security-performance-${frameworkVersion}.json`),
|
||||
JSON.stringify(report, null, 2) + "\n",
|
||||
);
|
||||
}
|
||||
for (const check of checks)
|
||||
console.log(`${check.passed ? "ok" : "FAIL"} ${check.name} — ${check.detail}`);
|
||||
for (const warning of warnings) console.warn(`warn ${warning.code} — ${warning.detail}`);
|
||||
|
||||
Reference in New Issue
Block a user