Initial Commit

This commit is contained in:
2026-05-27 23:29:53 +01:00
commit fbc70f96e6
10000 changed files with 1102152 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import { readFileSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "@suaveplan/testing/runner";
describe("dep-graph", () => {
it("runtime deps are exactly the expected sorted set", {
timeout: 5000,
}, () => {
const pkg = JSON.parse(
readFileSync(join(__dirname, "..", "package.json"), "utf8")
) as { dependencies?: Record<string, string> };
const runtime = Object.keys(pkg.dependencies ?? {}).sort();
expect(runtime).toEqual([
"@suaveplan/api-types",
"@suaveplan/error",
"tslib",
"zod",
]);
});
it("no peer-deps (leaf-like contract)", { timeout: 5000 }, () => {
const pkg = JSON.parse(
readFileSync(join(__dirname, "..", "package.json"), "utf8")
) as { peerDependencies?: Record<string, string> };
expect(pkg.peerDependencies ?? {}).toEqual({});
});
});

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,36 @@
import { readdirSync, readFileSync, statSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "@suaveplan/testing/runner";
function walk(dir: string, out: string[] = []): string[] {
for (const name of readdirSync(dir)) {
const full = join(dir, name);
const s = statSync(full);
if (s.isDirectory()) {
walk(full, out);
} else if (
s.isFile() &&
(full.endsWith(".ts") || full.endsWith(".tsx"))
) {
out.push(full);
}
}
return out;
}
describe("zod import form", () => {
it("every src file uses default-import z", { timeout: 5000 }, () => {
const root = join(__dirname, "..", "src");
const offenders: string[] = [];
for (const file of walk(root)) {
const text = readFileSync(file, "utf8");
// Forbid `import { z } from "zod"` and `import { z, ... } from "zod"`.
if (
/import\s*\{[^}]*\bz\b[^}]*\}\s*from\s*["']zod["']/.test(text)
) {
offenders.push(file);
}
}
expect(offenders).toEqual([]);
});
});