fix theme navigation and improve project scaffolding
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
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 { scaffoldApp } from "../src/create.ts";
|
||||
|
||||
test("scaffoldApp creates a comprehensive .gitignore", () => {
|
||||
const parent = mkdtempSync(join(tmpdir(), "wrnexus-create-"));
|
||||
const root = join(parent, "demo-app");
|
||||
|
||||
try {
|
||||
scaffoldApp(root, "demo-app");
|
||||
|
||||
const file = join(root, ".gitignore");
|
||||
expect(existsSync(file)).toBe(true);
|
||||
const contents = readFileSync(file, "utf8");
|
||||
for (const entry of [
|
||||
"node_modules/",
|
||||
"dist/",
|
||||
".wrnexus/",
|
||||
".env.*",
|
||||
"!.env.example",
|
||||
"*.log",
|
||||
"*.db",
|
||||
"coverage/",
|
||||
"mobile/android/",
|
||||
".vscode/",
|
||||
"*.tsbuildinfo",
|
||||
]) {
|
||||
expect(contents).toContain(entry);
|
||||
}
|
||||
} finally {
|
||||
rmSync(parent, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("scaffoldApp includes production build and start scripts", () => {
|
||||
const parent = mkdtempSync(join(tmpdir(), "wrnexus-create-"));
|
||||
const root = join(parent, "production-app");
|
||||
|
||||
try {
|
||||
scaffoldApp(root, "production-app");
|
||||
const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
||||
|
||||
expect(pkg.scripts.build).toBe("wrnexus build .");
|
||||
expect(pkg.scripts.start).toBe("bun dist/server.js");
|
||||
expect(pkg.scripts.production).toBe("bun run build && bun run start");
|
||||
} finally {
|
||||
rmSync(parent, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user