Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-prepublish-check-validation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"codemap": patch
---

Run full `check` (not build-only) in `prepublishOnly` so npm publish cannot skip tests or typecheck.
2 changes: 1 addition & 1 deletion docs/packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ How **@stainless-code/codemap** is built and published. **Doc index:** [README.m

## Build & publish surface

- **`bun run build`** → **tsdown** (`tsdown.config.ts`) → **`dist/`** (main **`index.mjs`**, lazy CLI chunks from **`src/cli/main.ts`**, workers, shared chunks) + types. **`prepublishOnly`** runs build.
- **`bun run build`** → **tsdown** (`tsdown.config.ts`) → **`dist/`** (main **`index.mjs`**, lazy CLI chunks from **`src/cli/main.ts`**, workers, shared chunks) + types. **`prepublishOnly`** runs **`check`** (build, format, lint, tests, typecheck, golden).
- **`package.json`**: **`bin`** and **`exports`** → **`./dist/index.mjs`**; **`files`**: **`CHANGELOG.md`**, **`dist/`**, **`templates/`** — no `src/` on npm.

The `templates/` directory ships two parallel subtrees:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"lint:fix": "oxlint --fix",
"pack": "bun run build && npm pack",
"prepare": "husky || true",
"prepublishOnly": "bun run build",
"prepublishOnly": "bun run check",
"qa:external": "bun scripts/qa-external-repo.ts",
"release": "changeset publish",
"test": "bun test ./src",
Expand Down
16 changes: 16 additions & 0 deletions src/package-scripts.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { describe, expect, test } from "bun:test";
import { readFileSync } from "node:fs";
import { join } from "node:path";

const pkg = JSON.parse(
readFileSync(join(import.meta.dir, "..", "package.json"), "utf8"),
) as { scripts: Record<string, string> };

describe("package.json publish scripts", () => {
test("prepublishOnly uses the same validation gate as check", () => {
expect(pkg.scripts.prepublishOnly).toBe("bun run check");
expect(pkg.scripts.check).toContain("typecheck");
expect(pkg.scripts.check).toContain("test");
expect(pkg.scripts.check).toContain("test:golden");
});
});
Loading