Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
6050d72a
Unverified
Commit
6050d72a
authored
7 years ago
by
XhmikosR
Committed by
GitHub
7 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Combine path and remove variable used in one place. (#24873)
parent
05d88ca2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
build/change-version.js
+2
-2
build/change-version.js
build/generate-sri.js
+2
-3
build/generate-sri.js
with
4 additions
and
5 deletions
+4
-5
build/change-version.js
+
2
-
2
View file @
6050d72a
...
@@ -14,8 +14,8 @@
...
@@ -14,8 +14,8 @@
const
fs
=
require
(
'
fs
'
)
const
fs
=
require
(
'
fs
'
)
const
path
=
require
(
'
path
'
)
const
path
=
require
(
'
path
'
)
const
sh
=
require
(
'
shelljs
'
)
const
sh
=
require
(
'
shelljs
'
)
sh
.
config
.
fatal
=
true
sh
.
config
.
fatal
=
true
const
sed
=
sh
.
sed
// Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37
// Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37
RegExp
.
quote
=
(
string
)
=>
string
.
replace
(
/
[
-
\\
^$*+?.()|[
\]
{}
]
/g
,
'
\\
$&
'
)
RegExp
.
quote
=
(
string
)
=>
string
.
replace
(
/
[
-
\\
^$*+?.()|[
\]
{}
]
/g
,
'
\\
$&
'
)
...
@@ -58,7 +58,7 @@ function replaceRecursively(directory, excludedDirectories, allowedExtensions, o
...
@@ -58,7 +58,7 @@ function replaceRecursively(directory, excludedDirectories, allowedExtensions, o
replacement
=
RegExp
.
quoteReplacement
(
replacement
)
replacement
=
RegExp
.
quoteReplacement
(
replacement
)
const
updateFile
=
!
DRY_RUN
?
(
filepath
)
=>
{
const
updateFile
=
!
DRY_RUN
?
(
filepath
)
=>
{
if
(
allowedExtensions
.
has
(
path
.
parse
(
filepath
).
ext
))
{
if
(
allowedExtensions
.
has
(
path
.
parse
(
filepath
).
ext
))
{
sed
(
'
-i
'
,
original
,
replacement
,
filepath
)
sh
.
sed
(
'
-i
'
,
original
,
replacement
,
filepath
)
}
}
}
:
(
filepath
)
=>
{
}
:
(
filepath
)
=>
{
if
(
allowedExtensions
.
has
(
path
.
parse
(
filepath
).
ext
))
{
if
(
allowedExtensions
.
has
(
path
.
parse
(
filepath
).
ext
))
{
...
...
This diff is collapsed.
Click to expand it.
build/generate-sri.js
+
2
-
3
View file @
6050d72a
...
@@ -16,11 +16,10 @@ const fs = require('fs')
...
@@ -16,11 +16,10 @@ const fs = require('fs')
const
path
=
require
(
'
path
'
)
const
path
=
require
(
'
path
'
)
const
sriToolbox
=
require
(
'
sri-toolbox
'
)
const
sriToolbox
=
require
(
'
sri-toolbox
'
)
const
sh
=
require
(
'
shelljs
'
)
const
sh
=
require
(
'
shelljs
'
)
const
sed
=
sh
.
sed
sh
.
config
.
fatal
=
true
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.
// Array of objects which holds the files to generate SRI hashes for.
// `file` is the path from the root folder
// `file` is the path from the root folder
...
@@ -56,6 +55,6 @@ files.forEach((file) => {
...
@@ -56,6 +55,6 @@ files.forEach((file) => {
console
.
log
(
`
${
file
.
configPropertyName
}
:
${
integrity
}
`
)
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
)
})
})
})
})
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment