Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

1.1 KB
Raw Blame
// The export map is the published contract, and subpaths consumed only from
// outside this repo would fail nowhere in here if a packaging change broke them.
import { existsSync } from "node:fs";
import { dirname, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";

import { describe, expect, it } from "vitest";

import manifest from "../package.json" with { type: "json" };

const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const exportMap = manifest.exports as Record<string, string>;

describe("published export map", () => {
  it("points every subpath at a file that exists", () => {
    const missing = Object.entries(exportMap).filter(
      ([, target]) => !existsSync(join(packageRoot, target)),
    );
    expect(missing).toEqual([]);
  });

  it("publishes the shared cache module", () => {
    expect(exportMap["./cache"]).toBe("./src/cache.ts");
  });

  it("is published under the scope the workflow authenticates against", () => {
    expect(manifest.name).toBe("@repowise-dev/api-client");
    expect(manifest.publishConfig?.registry).toBe("https://npm.pkg.github.com");
  });
});