release: WRNexusJS 0.7.0

This commit is contained in:
2026-08-01 10:04:42 +05:30
parent c54144f2e4
commit 87507edf59
207 changed files with 12607 additions and 679 deletions
+44 -5
View File
@@ -13,6 +13,7 @@ import { dirname, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { spawnSync } from "node:child_process";
import { updateMigrationVersions } from "../packages/cli/src/update.ts";
import { validateAndHashStage } from "./lib/package-integrity.ts";
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const docsRoot = resolve(process.env.WRNEXUS_DOCS_ROOT ?? "D:\\Company\\wrnexusjs");
@@ -106,6 +107,18 @@ function requireMigration(version: string) {
}
function validateStaging(all: PackageInfo[], version: string) {
const integrityPath = join(root, ".publish", "PACKAGE-INTEGRITY.json");
if (!existsSync(integrityPath)) {
throw new Error("Missing .publish/PACKAGE-INTEGRITY.json; stage verification did not run.");
}
const integrity = JSON.parse(readFileSync(integrityPath, "utf8"));
const recorded = new Map(
(Array.isArray(integrity.packages) ? integrity.packages : []).map((entry: any) => [
entry.name,
entry,
]),
);
for (const pkg of all) {
const stage = join(root, ".publish", pkg.dir);
const manifestPath = join(stage, "package.json");
@@ -117,6 +130,18 @@ function validateStaging(all: PackageInfo[], version: string) {
if (manifest.version !== version || manifest.publishConfig?.access !== "restricted") {
throw new Error(`${pkg.name} staging is not restricted ${version}.`);
}
const actual = validateAndHashStage(stage, manifest);
const expected = recorded.get(pkg.name);
if (!expected || JSON.stringify(expected) !== JSON.stringify(actual)) {
throw new Error(`${pkg.name} staging integrity does not match PACKAGE-INTEGRITY.json.`);
}
}
if (recorded.size !== all.length) {
throw new Error(
`Staging integrity lists ${recorded.size} packages but the workspace contains ${all.length}.`,
);
}
}
@@ -199,6 +224,11 @@ function prepare(all: PackageInfo[], version: string) {
run(process.execPath, ["run", "scripts/generate-ui-component-reference.mjs"], root);
run(process.execPath, ["run", "format"]);
run(process.execPath, ["run", "check:workspace"]);
run(process.execPath, ["run", "validate:0.7"]);
run(process.execPath, ["run", "security:framework"]);
run(process.execPath, ["run", "sbom"]);
run(process.execPath, ["run", "benchmark:framework"]);
run(process.execPath, ["run", "check"]);
run(process.execPath, ["run", "scripts/publish-packages.ts"]);
validateStaging(all, version);
@@ -230,11 +260,17 @@ function verifyUiComponentReference(): void {
throw new Error(`Failed to generate the UI component reference.${detail ? `\n${detail}` : ""}`);
}
// Format generated files before comparing them with Git.
// The generator expands JSON arrays, while Prettier may place short arrays
// on one line. Comparing before formatting creates a permanent false diff.
// The generator intentionally produces stable semantic JSON, while Prettier
// controls repository formatting. Format only the generated files before the
// Git comparison so short arrays and Windows line endings cannot create a
// permanent generate/format release loop.
run(process.execPath, ["x", "prettier", "--write", ...generatedFiles], root);
// Do not use `git status --short` here. On Windows, the generator writes LF
// while an autocrlf checkout may contain CRLF. `git status` can report those
// files as modified even when their canonical Git content is identical.
// `git diff --quiet` applies Git's normal text conversion and only fails for
// a real generated-content difference.
const changedStatus = run("git", ["diff", "--quiet", "--", ...generatedFiles], root, {
capture: true,
allowFailure: true,
@@ -254,9 +290,9 @@ function verifyUiComponentReference(): void {
"",
"Run:",
" bun run scripts/generate-ui-component-reference.mjs",
" bunx prettier --write packages/ui/component-catalog.json packages/ui/component-reference.json packages/ui/COMPONENTS.md",
" bun run format",
" git add packages/ui/component-catalog.json packages/ui/component-reference.json packages/ui/COMPONENTS.md",
' git commit -m \\"docs(ui): refresh component reference\\"',
' git commit -m "docs(ui): refresh component reference"',
" git push origin main",
].join("\n"),
);
@@ -265,6 +301,9 @@ function verifyUiComponentReference(): void {
function publish(all: PackageInfo[], version: string) {
if (!existsSync(docsRoot)) throw new Error(`Docs repository not found: ${docsRoot}`);
requireMigration(version);
run(process.execPath, ["run", "check:workspace"]);
run(process.execPath, ["run", "validate:0.7"]);
run(process.execPath, ["run", "security:framework"]);
requireCleanAndPushed(root, "Framework");
requireCleanAndPushed(docsRoot, "Docs");