diff --git a/scripts/ci/ensure-all-node-requirements-available.sh b/scripts/ci/ensure-all-node-requirements-available.sh index 0c3efeb7..73ab49c4 100755 --- a/scripts/ci/ensure-all-node-requirements-available.sh +++ b/scripts/ci/ensure-all-node-requirements-available.sh @@ -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%%/*}