Skip to content

Commit 4e191ba

Browse files
fix: run full check in prepublishOnly before publish (#122)
npm publish preflight now matches CI validation instead of build-only.
1 parent f5d013c commit 4e191ba

4 files changed

Lines changed: 23 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"codemap": patch
3+
---
4+
5+
Run full `check` (not build-only) in `prepublishOnly` so npm publish cannot skip tests or typecheck.

docs/packaging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ How **@stainless-code/codemap** is built and published. **Doc index:** [README.m
44

55
## Build & publish surface
66

7-
- **`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.
7+
- **`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).
88
- **`package.json`**: **`bin`** and **`exports`****`./dist/index.mjs`**; **`files`**: **`CHANGELOG.md`**, **`dist/`**, **`templates/`** — no `src/` on npm.
99

1010
The `templates/` directory ships two parallel subtrees:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"lint:fix": "oxlint --fix",
6262
"pack": "bun run build && npm pack",
6363
"prepare": "husky || true",
64-
"prepublishOnly": "bun run build",
64+
"prepublishOnly": "bun run check",
6565
"qa:external": "bun scripts/qa-external-repo.ts",
6666
"release": "changeset publish",
6767
"test": "bun test ./src",

src/package-scripts.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { describe, expect, test } from "bun:test";
2+
import { readFileSync } from "node:fs";
3+
import { join } from "node:path";
4+
5+
const pkg = JSON.parse(
6+
readFileSync(join(import.meta.dir, "..", "package.json"), "utf8"),
7+
) as { scripts: Record<string, string> };
8+
9+
describe("package.json publish scripts", () => {
10+
test("prepublishOnly uses the same validation gate as check", () => {
11+
expect(pkg.scripts.prepublishOnly).toBe("bun run check");
12+
expect(pkg.scripts.check).toContain("typecheck");
13+
expect(pkg.scripts.check).toContain("test");
14+
expect(pkg.scripts.check).toContain("test:golden");
15+
});
16+
});

0 commit comments

Comments
 (0)