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,52 @@
import { readdirSync, readFileSync, statSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "@suaveplan/testing/runner";
const PKG = join(__dirname, "..", "package.json");
const SRC = join(__dirname, "..", "src");
describe("@suaveplan/api-manifest package shape", () => {
it("depends on the expected set of workspace + catalog packages", {
timeout: 5000,
}, () => {
const pkg = JSON.parse(readFileSync(PKG, "utf8")) as {
dependencies: Record<string, string>;
};
const deps = Object.keys(pkg.dependencies).sort();
expect(deps).toEqual([
"@suaveplan/api-types",
"@suaveplan/error",
"@suaveplan/types",
"tslib",
"zod",
]);
});
it("every src file uses default-import z (no named import)", {
timeout: 5000,
}, () => {
const offenders: string[] = [];
walk(SRC, (file) => {
if (!file.endsWith(".ts")) return;
const content = readFileSync(file, "utf8");
if (/import\s*\{\s*z\s*\}\s*from\s*["']zod["']/.test(content)) {
offenders.push(file);
}
});
expect(offenders).toEqual([]);
});
it("root barrel has no export-star", { timeout: 5000 }, () => {
const content = readFileSync(join(SRC, "index.ts"), "utf8");
expect(/export\s*\*/.test(content)).toBe(false);
});
});
function walk(dir: string, fn: (file: string) => void): void {
for (const name of readdirSync(dir)) {
const p = join(dir, name);
const st = statSync(p);
if (st.isDirectory()) walk(p, fn);
else fn(p);
}
}