Debian Codegraph @

scripts/update-sha.sh

raw symbols SCIP
1 #!/bin/bash
2
3 JSON=www/src/data/integrity.json
4
5 # Version is the single source of truth in package.json; the site reads it from here.
6 VERSION=$(node -p "require('./package.json').version")
7
8 # Calculate SHAs
9 MINIFIED_SHA=$(cat dist/htmx.min.js | openssl dgst -sha384 -binary | openssl base64 -A)
10 FULL_SHA=$(cat dist/htmx.js | openssl dgst -sha384 -binary | openssl base64 -A)
11 ESM_MIN_SHA=$(cat dist/htmx.esm.min.js | openssl dgst -sha384 -binary | openssl base64 -A)
12 ESM_SHA=$(cat dist/htmx.esm.js | openssl dgst -sha384 -binary | openssl base64 -A)
13
14 echo "Updating $JSON for htmx@$VERSION..."
15 echo "htmx.min.js: sha384-$MINIFIED_SHA"
16 echo "htmx.js: sha384-$FULL_SHA"
17 echo "htmx.esm.min.js: sha384-$ESM_MIN_SHA"
18 echo "htmx.esm.js: sha384-$ESM_SHA"
19
20 cat > "$JSON" <<EOF
21 {
22 "version": "$VERSION",
23 "min": "sha384-$MINIFIED_SHA",
24 "full": "sha384-$FULL_SHA",
25 "esmMin": "sha384-$ESM_MIN_SHA",
26 "esm": "sha384-$ESM_SHA"
27 }
28 EOF
29
30 echo "✓ $JSON updated successfully"