summaryrefslogtreecommitdiffstats
path: root/build/generate-sri.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-15 11:37:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-15 11:37:20 +0000
commit22daa00afb1a5d628e0267fba0f062c4f8fb5613 (patch)
treec954c1be5487c69839459d79d74f139e3ae28011 /build/generate-sri.js
parentAdding upstream version 5.3.1+dfsg. (diff)
downloadbootstrap-html-upstream.tar.xz
bootstrap-html-upstream.zip
Adding upstream version 5.3.2+dfsg.upstream/5.3.2+dfsgupstream
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}`)