diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-09-15 11:37:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-09-15 11:37:20 +0000 |
commit | 22daa00afb1a5d628e0267fba0f062c4f8fb5613 (patch) | |
tree | c954c1be5487c69839459d79d74f139e3ae28011 /build/generate-sri.mjs | |
parent | Adding upstream version 5.3.1+dfsg. (diff) | |
download | bootstrap-html-22daa00afb1a5d628e0267fba0f062c4f8fb5613.tar.xz bootstrap-html-22daa00afb1a5d628e0267fba0f062c4f8fb5613.zip |
Adding upstream version 5.3.2+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | build/generate-sri.mjs (renamed from build/generate-sri.js) | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/build/generate-sri.js b/build/generate-sri.mjs index 2e22924..e2b1554 100644 --- a/build/generate-sri.js +++ b/build/generate-sri.mjs @@ -9,12 +9,13 @@ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ -'use strict' +import crypto from 'node:crypto' +import fs from 'node:fs' +import path from 'node:path' +import { fileURLToPath } from 'node:url' +import sh from 'shelljs' -const crypto = require('node:crypto') -const fs = require('node:fs') -const path = require('node:path') -const sh = require('shelljs') +const __dirname = path.dirname(fileURLToPath(import.meta.url)) sh.config.fatal = true @@ -52,9 +53,9 @@ for (const { file, configPropertyName } of files) { throw error } - const algo = 'sha384' - const hash = crypto.createHash(algo).update(data, 'utf8').digest('base64') - const integrity = `${algo}-${hash}` + const algorithm = 'sha384' + const hash = crypto.createHash(algorithm).update(data, 'utf8').digest('base64') + const integrity = `${algorithm}-${hash}` console.log(`${configPropertyName}: ${integrity}`) |