diff options
author | XhmikosR <xhmikosr@gmail.com> | 2017-11-28 11:43:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-28 11:43:09 +0300 |
commit | 6050d72a3a0423fd3383ab978f8c3843f91c1002 (patch) | |
tree | a4c88c4c0574e365fa134e9d868795dc8f3e73a7 /build | |
parent | 05d88ca285100e57220bdb7079a3bcbd13da87d3 (diff) |
Combine path and remove variable used in one place. (#24873)
Diffstat (limited to 'build')
-rwxr-xr-x | build/change-version.js | 4 | ||||
-rw-r--r-- | build/generate-sri.js | 5 |
2 files changed, 4 insertions, 5 deletions
diff --git a/build/change-version.js b/build/change-version.js index f84d4e32c1..ab4579072b 100755 --- a/build/change-version.js +++ b/build/change-version.js @@ -14,8 +14,8 @@ 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, '\\$&') @@ -58,7 +58,7 @@ function replaceRecursively(directory, excludedDirectories, allowedExtensions, o 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)) { diff --git a/build/generate-sri.js b/build/generate-sri.js index b21311b3b1..708e6dfbf8 100644 --- a/build/generate-sri.js +++ b/build/generate-sri.js @@ -16,11 +16,10 @@ const fs = require('fs') 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 @@ -56,6 +55,6 @@ files.forEach((file) => { 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) }) }) |