mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-29 11:24:18 +01:00
generate-sri.js: use destructuring (#38413)
This commit is contained in:
parent
d0cc42c009
commit
3d84e60d69
@ -46,8 +46,8 @@ const files = [
|
||||
}
|
||||
]
|
||||
|
||||
for (const file of files) {
|
||||
fs.readFile(file.file, 'utf8', (error, data) => {
|
||||
for (const { file, configPropertyName } of files) {
|
||||
fs.readFile(file, 'utf8', (error, data) => {
|
||||
if (error) {
|
||||
throw error
|
||||
}
|
||||
@ -56,8 +56,8 @@ for (const file of files) {
|
||||
const hash = crypto.createHash(algo).update(data, 'utf8').digest('base64')
|
||||
const integrity = `${algo}-${hash}`
|
||||
|
||||
console.log(`${file.configPropertyName}: ${integrity}`)
|
||||
console.log(`${configPropertyName}: ${integrity}`)
|
||||
|
||||
sh.sed('-i', new RegExp(`^(\\s+${file.configPropertyName}:\\s+["'])\\S*(["'])`), `$1${integrity}$2`, configFile)
|
||||
sh.sed('-i', new RegExp(`^(\\s+${configPropertyName}:\\s+["'])\\S*(["'])`), `$1${integrity}$2`, configFile)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user