mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 07:17:18 +00:00
fix sanity-checks
This commit is contained in:
parent
d5a14031c6
commit
96c76177af
@ -38,6 +38,7 @@ DEV_FILES_REGEX=^\(tests\|scripts\)/
|
||||
# need to do a non-greedy match, which is why we're not using (.*)
|
||||
REQUIRE_REGEX=require\\\(\'\([-_/\.a-z0-9]+\)\'\\\)
|
||||
JS_OR_JSON_REGEX=\.js\(on\)?$
|
||||
HTML_REGEX=\.html$
|
||||
|
||||
# Check all js files stored in the repo can require() the packages they need
|
||||
git ls-tree -r HEAD | while IFS='' read line; do
|
||||
@ -48,7 +49,7 @@ git ls-tree -r HEAD | while IFS='' read line; do
|
||||
extension=${filename##*.}
|
||||
if [[ "$extension" == "js" ]]; then
|
||||
# 'grep -v' to filter out any comment-blocks
|
||||
grep 'require(' "$fullpath" | grep -v "^ \* " | while IFS='' read line; do
|
||||
grep 'require(' "$fullpath" | grep -v -E "^ +\* " | while IFS='' read line; do
|
||||
if [[ "$line" =~ $REQUIRE_REGEX ]]; then
|
||||
required=${BASH_REMATCH[1]}
|
||||
fi
|
||||
@ -62,6 +63,9 @@ git ls-tree -r HEAD | while IFS='' read line; do
|
||||
requirement_found=1
|
||||
elif [[ -f "$localpath.js" ]] || [[ -f "$localpath/index.js" ]]; then
|
||||
requirement_found=1
|
||||
# Webpack HTML loader
|
||||
elif [[ "$localpath" =~ $HTML_REGEX ]] && [[ -f "$localpath" ]]; then
|
||||
requirement_found=1
|
||||
fi
|
||||
else
|
||||
required=${required%%/*}
|
||||
|
Loading…
x
Reference in New Issue
Block a user