singularity-forge/scripts/prepublish-check.mjs

22 lines
452 B
JavaScript
Raw Normal View History

#!/usr/bin/env node
2026-05-05 14:31:16 +02:00
import { spawnSync } from "node:child_process";
2026-05-05 14:31:16 +02:00
if (process.env.CI === "true" || process.env.CI === "1") {
process.exit(0);
}
2026-05-05 14:31:16 +02:00
const result = spawnSync("git", ["diff", "--exit-code"], {
stdio: "inherit",
shell: process.platform === "win32",
});
if (result.status === 0) {
2026-05-05 14:31:16 +02:00
process.exit(0);
}
2026-05-05 14:31:16 +02:00
process.stderr.write(
"ERROR: version sync changed files — commit them before publishing\n",
);
process.exit(result.status ?? 1);