| 1 | #!/bin/bashscip-shell filesystem . . `/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=$(nodescip-shell system . . node. -p "require('./package.json').version") |
| 7 | |
| 8 | # Calculate SHAs |
| 9 | MINIFIED_SHA=$(catscip-shell system . . cat. dist/htmx.min.js | opensslscip-shell system . . openssl. dgst -sha384 -binary | opensslscip-shell system . . openssl. base64 -A) |
| 10 | FULL_SHA=$(catscip-shell system . . cat. dist/htmx.js | opensslscip-shell system . . openssl. dgst -sha384 -binary | opensslscip-shell system . . openssl. base64 -A) |
| 11 | ESM_MIN_SHA=$(catscip-shell system . . cat. dist/htmx.esm.min.js | opensslscip-shell system . . openssl. dgst -sha384 -binary | opensslscip-shell system . . openssl. base64 -A) |
| 12 | ESM_SHA=$(catscip-shell system . . cat. dist/htmx.esm.js | opensslscip-shell system . . openssl. dgst -sha384 -binary | opensslscip-shell system . . openssl. base64 -A) |
| 13 | |
| 14 | echoscip-shell system . . echo. "Updating $JSON for htmx@$VERSION..." |
| 15 | echoscip-shell system . . echo. "htmx.min.js: sha384-$MINIFIED_SHA" |
| 16 | echoscip-shell system . . echo. "htmx.js: sha384-$FULL_SHA" |
| 17 | echoscip-shell system . . echo. "htmx.esm.min.js: sha384-$ESM_MIN_SHA" |
| 18 | echoscip-shell system . . echo. "htmx.esm.js: sha384-$ESM_SHA" |
| 19 | |
| 20 | catscip-shell system . . 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 | echoscip-shell system . . echo. "✓ $JSON updated successfully" |