openclaw/scripts/compute-file-hash.mjs
Karun Agarwal aa5c45d78d fix(build): use Node.js for cross-platform file hashing in bundle script
The bundle-a2ui.sh script was using shasum which is not available on
Windows (Git Bash), causing CI failures. Replace with a Node.js-based
hash computation script that works on all platforms.

Fixes Windows CI build failures with "shasum: command not found".

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-01-27 13:45:17 +05:30

20 lines
527 B
JavaScript
Executable File

#!/usr/bin/env node
import { createHash } from "node:crypto";
import { readFileSync } from "node:fs";
// Compute SHA-256 hash of all input files (cross-platform)
const files = process.argv.slice(2);
const hash = createHash("sha256");
for (const file of files) {
try {
const content = readFileSync(file);
hash.update(content);
} catch (err) {
// Skip files that don't exist or can't be read
process.stderr.write(`Warning: Could not read ${file}: ${err.message}\n`);
}
}
console.log(hash.digest("hex"));