Skip to content

Commit 6050d72

Browse files
authored
Combine path and remove variable used in one place. (#24873)
1 parent 05d88ca commit 6050d72

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

build/change-version.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
const fs = require('fs')
1515
const path = require('path')
1616
const sh = require('shelljs')
17+
1718
sh.config.fatal = true
18-
const sed = sh.sed
1919

2020
// Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37
2121
RegExp.quote = (string) => string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&')
@@ -58,7 +58,7 @@ function replaceRecursively(directory, excludedDirectories, allowedExtensions, o
5858
replacement = RegExp.quoteReplacement(replacement)
5959
const updateFile = !DRY_RUN ? (filepath) => {
6060
if (allowedExtensions.has(path.parse(filepath).ext)) {
61-
sed('-i', original, replacement, filepath)
61+
sh.sed('-i', original, replacement, filepath)
6262
}
6363
} : (filepath) => {
6464
if (allowedExtensions.has(path.parse(filepath).ext)) {

build/generate-sri.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ const fs = require('fs')
1616
const path = require('path')
1717
const sriToolbox = require('sri-toolbox')
1818
const sh = require('shelljs')
19-
const sed = sh.sed
2019

2120
sh.config.fatal = true
2221

23-
const configFile = path.join(__dirname, '..', '_config.yml')
22+
const configFile = path.join(__dirname, '../_config.yml')
2423

2524
// Array of objects which holds the files to generate SRI hashes for.
2625
// `file` is the path from the root folder
@@ -56,6 +55,6 @@ files.forEach((file) => {
5655

5756
console.log(`${file.configPropertyName}: ${integrity}`)
5857

59-
sed('-i', new RegExp(`(\\s${file.configPropertyName}:\\s+"|')(\\S+)("|')`), '$1' + integrity + '$3', configFile)
58+
sh.sed('-i', new RegExp(`(\\s${file.configPropertyName}:\\s+"|')(\\S+)("|')`), '$1' + integrity + '$3', configFile)
6059
})
6160
})

0 commit comments

Comments
 (0)