const fs = require('fs')
const path = require('path')
const sh = require('shelljs')
+
sh.config.fatal = true
-const sed = sh.sed
// Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37
RegExp.quote = (string) => string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&')
replacement = RegExp.quoteReplacement(replacement)
const updateFile = !DRY_RUN ? (filepath) => {
if (allowedExtensions.has(path.parse(filepath).ext)) {
- sed('-i', original, replacement, filepath)
+ sh.sed('-i', original, replacement, filepath)
}
} : (filepath) => {
if (allowedExtensions.has(path.parse(filepath).ext)) {
const path = require('path')
const sriToolbox = require('sri-toolbox')
const sh = require('shelljs')
-const sed = sh.sed
sh.config.fatal = true
-const configFile = path.join(__dirname, '..', '_config.yml')
+const configFile = path.join(__dirname, '../_config.yml')
// Array of objects which holds the files to generate SRI hashes for.
// `file` is the path from the root folder
console.log(`${file.configPropertyName}: ${integrity}`)
- sed('-i', new RegExp(`(\\s${file.configPropertyName}:\\s+"|')(\\S+)("|')`), '$1' + integrity + '$3', configFile)
+ sh.sed('-i', new RegExp(`(\\s${file.configPropertyName}:\\s+"|')(\\S+)("|')`), '$1' + integrity + '$3', configFile)
})
})