release: WRNexusJS 0.4.0
This commit is contained in:
@@ -1,21 +1,19 @@
|
|||||||
# WRNexusJS 0.4.0 lint fix
|
# WRNexusJS 0.4.0 UI reference determinism fix
|
||||||
|
|
||||||
Extract this archive into the WRNexusJS repository root and replace the included files.
|
This fixes the release loop where `generate-ui-component-reference.mjs` writes one layout and Prettier rewrites it differently. The generator now formats both generated files with the repository Prettier configuration before writing them.
|
||||||
|
|
||||||
Fixes:
|
Replace:
|
||||||
|
|
||||||
- Removes the `no-useless-assignment` failure in the CAPTCHA page-grant endpoint.
|
- `scripts/generate-ui-component-reference.mjs`
|
||||||
- Restores the Button showcase's specialized examples so `buttonUses` is used.
|
|
||||||
- Declares browser globals for the package-owned CAPTCHA runtime.
|
|
||||||
- Replaces empty catch blocks with documented best-effort cleanup.
|
|
||||||
- Fixes `prefer-const` in package discovery.
|
|
||||||
- Removes unused plugin, style-audit, and UI-test bindings.
|
|
||||||
- Uses the UI-reference verifier in the release workflow.
|
|
||||||
- Declares Node globals correctly in installer and validation scripts.
|
|
||||||
|
|
||||||
Run:
|
Then run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bun run lint
|
bun run scripts/generate-ui-component-reference.mjs
|
||||||
bun run validate:0.4
|
bun run format
|
||||||
|
bun run format:check
|
||||||
|
git add scripts/generate-ui-component-reference.mjs packages/ui/component-reference.json packages/ui/COMPONENTS.md
|
||||||
|
git commit -m "fix(release): make UI reference generation deterministic"
|
||||||
|
git push origin main
|
||||||
|
bun run release:private
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,11 +1,22 @@
|
|||||||
import { readdirSync, readFileSync, writeFileSync } from "node:fs";
|
import { readdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
|
import { format, resolveConfig } from "prettier";
|
||||||
|
|
||||||
const uiRoot = join(import.meta.dirname, "..", "packages", "ui");
|
const uiRoot = join(import.meta.dirname, "..", "packages", "ui");
|
||||||
const componentsDir = join(uiRoot, "components");
|
const componentsDir = join(uiRoot, "components");
|
||||||
const catalog = JSON.parse(readFileSync(join(uiRoot, "component-catalog.json"), "utf8"));
|
const catalog = JSON.parse(readFileSync(join(uiRoot, "component-catalog.json"), "utf8"));
|
||||||
const metadata = new Map(catalog.components.map((entry) => [entry.name, entry]));
|
const metadata = new Map(catalog.components.map((entry) => [entry.name, entry]));
|
||||||
|
|
||||||
|
async function writeFormatted(path, source, parser) {
|
||||||
|
const config = (await resolveConfig(path)) ?? {};
|
||||||
|
const formatted = await format(source, {
|
||||||
|
...config,
|
||||||
|
filepath: path,
|
||||||
|
parser,
|
||||||
|
});
|
||||||
|
writeFileSync(path, formatted);
|
||||||
|
}
|
||||||
|
|
||||||
function block(source, keyword) {
|
function block(source, keyword) {
|
||||||
const start = source.indexOf(`${keyword} {`);
|
const start = source.indexOf(`${keyword} {`);
|
||||||
if (start < 0) return "";
|
if (start < 0) return "";
|
||||||
@@ -84,13 +95,15 @@ const components = readdirSync(componentsDir)
|
|||||||
})
|
})
|
||||||
.sort((left, right) => left.name.localeCompare(right.name));
|
.sort((left, right) => left.name.localeCompare(right.name));
|
||||||
|
|
||||||
writeFileSync(
|
const referencePath = join(uiRoot, "component-reference.json");
|
||||||
join(uiRoot, "component-reference.json"),
|
await writeFormatted(
|
||||||
|
referencePath,
|
||||||
JSON.stringify(
|
JSON.stringify(
|
||||||
{ generatedFrom: "packages/ui/components/*.wrn", count: components.length, components },
|
{ generatedFrom: "packages/ui/components/*.wrn", count: components.length, components },
|
||||||
null,
|
null,
|
||||||
2,
|
2,
|
||||||
) + "\n",
|
) + "\n",
|
||||||
|
"json",
|
||||||
);
|
);
|
||||||
|
|
||||||
const lines = [
|
const lines = [
|
||||||
@@ -123,4 +136,5 @@ for (const category of [...new Set(components.map((component) => component.categ
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeFileSync(join(uiRoot, "COMPONENTS.md"), `${lines.join("\n").trimEnd()}\n`);
|
const componentsPath = join(uiRoot, "COMPONENTS.md");
|
||||||
|
await writeFormatted(componentsPath, `${lines.join("\n").trimEnd()}\n`, "markdown");
|
||||||
|
|||||||
Reference in New Issue
Block a user