feat: restore gateway HMR and add WRN formatting

This commit is contained in:
2026-07-13 14:54:03 +05:30
parent 3b46c69601
commit cff420a29e
71 changed files with 727 additions and 119 deletions
+41
View File
@@ -2,6 +2,7 @@ import { expect, test } from "bun:test";
import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { format } from "prettier";
import { scaffoldApp } from "../src/create.ts";
import { currentCliVersion } from "../src/update-notifier.ts";
@@ -69,6 +70,15 @@ test("scaffoldApp pins the current framework and exposes llms.txt publicly", ()
expect(existsSync(join(root, "public", "llms.txt"))).toBe(true);
expect(existsSync(join(root, "llms.txt"))).toBe(false);
expect(readFileSync(join(root, ".prettierignore"), "utf8")).toContain("CLAUDE.md");
expect(readFileSync(join(root, ".vscode", "settings.json"), "utf8")).toContain(
'"editor.formatOnSave": true',
);
expect(readFileSync(join(root, ".vscode", "settings.json"), "utf8")).toContain(
'"editor.defaultFormatter": "wrnexus.wrnexus"',
);
expect(readFileSync(join(root, ".vscode", "extensions.json"), "utf8")).toContain(
"wrnexus.wrnexus",
);
expect(readFileSync(join(root, "app", "pages", "index.wrn"), "utf8")).toContain(
'href="/api/hello"',
);
@@ -77,3 +87,34 @@ test("scaffoldApp pins the current framework and exposes llms.txt publicly", ()
rmSync(parent, { recursive: true, force: true });
}
});
test("scaffoldApp emits Prettier-compliant editor and framework files", async () => {
const parent = mkdtempSync(join(tmpdir(), "wrnexus-create-"));
const root = join(parent, "formatted-app");
try {
scaffoldApp(root, "formatted-app");
for (const relative of [
"app/styles/global.css",
"eslint.config.js",
".vscode/settings.json",
".vscode/extensions.json",
]) {
const file = join(root, relative);
const source = readFileSync(file, "utf8");
const formatted = await format(source, {
filepath: file,
printWidth: 100,
tabWidth: 2,
useTabs: false,
semi: true,
singleQuote: false,
trailingComma: "all",
endOfLine: "lf",
});
expect(formatted).toBe(source);
}
} finally {
rmSync(parent, { recursive: true, force: true });
}
});