chore: harden release checks

This commit is contained in:
Peter Steinberger
2025-12-27 19:35:39 +01:00
parent 69a6538567
commit 7f961237f9
3 changed files with 52 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ Use `pnpm` (Node 22+) from the repo root. Keep the working tree clean before tag
- [ ] `pnpm lint` - [ ] `pnpm lint`
- [ ] `pnpm test` (or `pnpm test:coverage` if you need coverage output) - [ ] `pnpm test` (or `pnpm test:coverage` if you need coverage output)
- [ ] `pnpm run build` (last sanity check after tests) - [ ] `pnpm run build` (last sanity check after tests)
- [ ] `pnpm release:check` (verifies npm pack contents)
- [ ] (Optional) Spot-check the web gateway if your changes affect send/receive paths. - [ ] (Optional) Spot-check the web gateway if your changes affect send/receive paths.
5) **macOS app (Sparkle)** 5) **macOS app (Sparkle)**

View File

@@ -16,7 +16,9 @@
"dist/commands/**", "dist/commands/**",
"dist/config/**", "dist/config/**",
"dist/cron/**", "dist/cron/**",
"dist/discord/**",
"dist/gateway/**", "dist/gateway/**",
"dist/hooks/**",
"dist/infra/**", "dist/infra/**",
"dist/macos/**", "dist/macos/**",
"dist/media/**", "dist/media/**",
@@ -37,6 +39,7 @@
"dev": "tsx src/index.ts", "dev": "tsx src/index.ts",
"docs:list": "tsx scripts/docs-list.ts", "docs:list": "tsx scripts/docs-list.ts",
"build": "tsc -p tsconfig.json && tsx scripts/canvas-a2ui-copy.ts", "build": "tsc -p tsconfig.json && tsx scripts/canvas-a2ui-copy.ts",
"release:check": "tsx scripts/release-check.ts",
"ui:install": "pnpm -C ui install", "ui:install": "pnpm -C ui install",
"ui:dev": "pnpm -C ui dev", "ui:dev": "pnpm -C ui dev",
"ui:build": "pnpm -C ui build", "ui:build": "pnpm -C ui build",

48
scripts/release-check.ts Normal file
View File

@@ -0,0 +1,48 @@
#!/usr/bin/env tsx
import { execSync } from "node:child_process";
type PackFile = { path: string };
type PackResult = { files?: PackFile[] };
const requiredPaths = ["dist/discord/send.js", "dist/hooks/gmail.js"];
const forbiddenPrefixes = ["dist/Clawdis.app/"];
function runPackDry(): PackResult[] {
const raw = execSync("npm pack --dry-run --json", {
encoding: "utf8",
stdio: ["ignore", "pipe", "pipe"],
});
return JSON.parse(raw) as PackResult[];
}
function main() {
const results = runPackDry();
const files = results.flatMap((entry) => entry.files ?? []);
const paths = new Set(files.map((file) => file.path));
const missing = requiredPaths.filter((path) => !paths.has(path));
const forbidden = [...paths].filter((path) =>
forbiddenPrefixes.some((prefix) => path.startsWith(prefix)),
);
if (missing.length > 0 || forbidden.length > 0) {
if (missing.length > 0) {
console.error("release-check: missing files in npm pack:");
for (const path of missing) {
console.error(` - ${path}`);
}
}
if (forbidden.length > 0) {
console.error("release-check: forbidden files in npm pack:");
for (const path of forbidden) {
console.error(` - ${path}`);
}
}
process.exit(1);
}
console.log("release-check: npm pack contents look OK.");
}
main();