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>
This commit is contained in:
parent
455c2c2e3a
commit
aa5c45d78d
@ -30,11 +30,10 @@ collect_files() {
|
||||
}
|
||||
|
||||
compute_hash() {
|
||||
# Use Node.js for cross-platform hash computation (works on Windows, macOS, Linux)
|
||||
collect_files \
|
||||
| LC_ALL=C sort -z \
|
||||
| xargs -0 shasum -a 256 \
|
||||
| shasum -a 256 \
|
||||
| awk '{print $1}'
|
||||
| xargs -0 node "$ROOT_DIR/scripts/compute-file-hash.mjs"
|
||||
}
|
||||
|
||||
current_hash="$(compute_hash)"
|
||||
|
||||
19
scripts/compute-file-hash.mjs
Executable file
19
scripts/compute-file-hash.mjs
Executable file
@ -0,0 +1,19 @@
|
||||
#!/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"));
|
||||
Loading…
Reference in New Issue
Block a user