release: WRNexusJS 0.6.0

This commit is contained in:
2026-08-01 06:50:37 +05:30
parent 687d345882
commit d5e834bc78
14 changed files with 960 additions and 1107 deletions
+8 -2
View File
@@ -95,6 +95,10 @@ function words(name) {
return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").toLowerCase();
}
function compareText(left, right) {
return left < right ? -1 : left > right ? 1 : 0;
}
const sourceEntries = readdirSync(componentsDir)
.filter((file) => file.endsWith(".wrn"))
.map((file) => {
@@ -150,7 +154,7 @@ const components = [...sourceByName.values()]
source: `components/${file}`,
};
})
.sort((left, right) => left.name.localeCompare(right.name));
.sort((left, right) => compareText(left.name, right.name));
const catalogComponents = components.map((component) => ({
name: component.name,
@@ -180,7 +184,9 @@ const lines = [
`This reference is generated from the ${components.length} packaged \`.wrn\` component sources. Props marked required have no default; all others show their runtime default.`,
"",
];
for (const category of [...new Set(components.map((component) => component.category))].sort()) {
for (const category of [...new Set(components.map((component) => component.category))].sort(
compareText,
)) {
lines.push(`## ${category[0].toUpperCase()}${category.slice(1)}`, "");
for (const component of components.filter((item) => item.category === category)) {
const props = component.props.length
+19 -5
View File
@@ -208,7 +208,11 @@ function prepare(all: PackageInfo[], version: string) {
}
function verifyUiComponentReference(): void {
const generatedFiles = ["packages/ui/component-reference.json", "packages/ui/COMPONENTS.md"];
const generatedFiles = [
"packages/ui/component-catalog.json",
"packages/ui/component-reference.json",
"packages/ui/COMPONENTS.md",
];
const result = run(
process.execPath,
@@ -226,22 +230,32 @@ function verifyUiComponentReference(): void {
throw new Error(`Failed to generate the UI component reference.${detail ? `\n${detail}` : ""}`);
}
const changed = output("git", ["status", "--short", "--", ...generatedFiles], root).trim();
// 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,
}).status;
if (!changed) {
if (changedStatus === 0) {
return;
}
const changed = output("git", ["diff", "--name-status", "--", ...generatedFiles], root);
throw new Error(
[
"UI component reference is stale.",
"",
changed,
changed || generatedFiles.join("\n"),
"",
"Run:",
" bun run scripts/generate-ui-component-reference.mjs",
" bun run format",
" git add packages/ui/component-reference.json packages/ui/COMPONENTS.md",
" 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 push origin main",
].join("\n"),
+28
View File
@@ -395,6 +395,34 @@ if (!compilerTargetTestSource.includes('targets.browser.replace(/^export\\s+/gm,
pass("R11 peer-function executable regression test uses the correct export-stripping regex");
}
const releaseSource = readFileSync(join(root, "scripts/release.ts"), "utf8");
const referenceGeneratorSource = readFileSync(
join(root, "scripts/generate-ui-component-reference.mjs"),
"utf8",
);
for (const [label, condition] of [
[
"canonical generated-reference Git comparison",
releaseSource.includes('["diff", "--quiet", "--", ...generatedFiles]') &&
releaseSource.includes('["diff", "--name-status", "--", ...generatedFiles]'),
],
[
"component catalog included in the release reference gate",
releaseSource.includes('"packages/ui/component-catalog.json"'),
],
[
"platform-independent component reference ordering",
referenceGeneratorSource.includes("function compareText(left, right)") &&
referenceGeneratorSource.includes("compareText(left.name, right.name)") &&
!referenceGeneratorSource.includes("localeCompare"),
],
]) {
if (!condition) fail(`R12 regression: missing ${label}`);
}
if (!failures.some((item) => item.startsWith("R12 regression:"))) {
pass("R12 release reference gate is canonical, complete, and platform independent");
}
const showcaseFiles = walk(join(root, "examples/component-showcase/app"), (path) =>
path.endsWith(".wrn"),
);