Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine path and remove variable used in one place. #24873

Merged
merged 2 commits into from
Nov 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/change-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, '\\$&')
Expand Down Expand Up @@ -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)) {
Expand Down
5 changes: 2 additions & 3 deletions build/generate-sri.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
})
})