Skip to content

Commit 3ab0ec2

Browse files
committed
build: install native addons and update description
1 parent 0856277 commit 3ab0ec2

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

.github/workflows/scripts/lint_javascript_files

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818

19-
# Script to update years for stdlib copyright notices to the current year.
19+
# Script to lint and automatically fix JavaScript files.
2020
#
21-
# Usage: update_copyright_years file1 [file2 file3 ...]
21+
# Usage: lint_javascript_files file1 [file2 file3 ...]
2222
#
2323
# Arguments:
2424
#
@@ -37,7 +37,7 @@ root=$(git rev-parse --show-toplevel)
3737
fix="${FIX:-0}"
3838

3939
# Files to lint:
40-
files_to_lint=${@}
40+
files_to_lint="$*"
4141

4242
# Define the path to ESLint configuration file for linting examples:
4343
eslint_examples_conf="${root}/etc/eslint/.eslintrc.examples.js"
@@ -50,12 +50,21 @@ eslint_benchmarks_conf="${root}/etc/eslint/.eslintrc.benchmarks.js"
5050

5151
# Lint JavaScript source files:
5252
files=$(echo "${files_to_lint}" | tr ' ' '\n' | grep '\.js$' | grep -v -e '/examples' -e '/test' -e '/benchmark' -e '^dist/' | tr '\n' ' ' | sed 's/ $//')
53+
54+
# Build native addons if present:
55+
packages=$(echo "${files}" | tr ' ' '\n' | sed 's/^lib\/node_modules\///g' | sed 's/\/lib\/.*//g' | sort | uniq)
56+
for pkg in ${packages}; do
57+
if [ -f "lib/node_modules/${pkg}/binding.gyp" ]; then
58+
NODE_ADDONS_PATTERN="${pkg}" make install-node-addons
59+
fi
60+
done
61+
5362
if [[ -n "${files}" ]]; then
5463
make lint-javascript-files FIX="${fix}" FILES="${files}"
5564
fi
5665

5766
# Lint JavaScript command-line interfaces...
58-
file=$(echo ${files_to_lint} | tr ' ' '\n' | grep '\.js$' | grep -E '/bin/cli$' | tr '\n' ' ' | sed 's/ $//')
67+
file=$(echo "${files_to_lint}" | tr ' ' '\n' | grep '\.js$' | grep -E '/bin/cli$' | tr '\n' ' ' | sed 's/ $//')
5968
if [[ -n "${file}" ]]; then
6069
make lint-javascript-files FIX="${fix}" FILES="${file}"
6170
fi

0 commit comments

Comments
 (0)