@@ -25,12 +25,13 @@ OUTPUT_FORMAT ?= $(shell if [ "${GITHUB_ACTIONS}" == "true" ]; then echo "github
2525REPO_ROOT = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST ) ) ) )
2626REPO_NAME = $(shell basename "$(REPO_ROOT ) ")
2727
28- AQUA_VERSION ?= 2.51.2
28+ # renovate: datasource=github-releases depName=aquaproj/aqua versioning=loose
29+ AQUA_VERSION ?= v2.51.2
2930AQUA_REPO ?= github.com/aquaproj/aqua
3031AQUA_CHECKSUM.Linux.x86_64 = 17db2da427bde293b1942e3220675ef796a67f1207daf89e6e80fea8d2bb8c22
3132AQUA_CHECKSUM.Linux.aarch64 = b3f0d573e762ce9d104c671b8224506c4c4a32eedd1e6d7ae1e1e39983cdb6a8
3233AQUA_CHECKSUM ?= $(AQUA_CHECKSUM.$(uname_s ) .$(uname_m ) )
33- AQUA_URL = https://$(AQUA_REPO ) /releases/download/v $(AQUA_VERSION ) /aqua_$(kernel ) _$(arch ) .tar.gz
34+ AQUA_URL = https://$(AQUA_REPO ) /releases/download/$(AQUA_VERSION ) /aqua_$(kernel ) _$(arch ) .tar.gz
3435AQUA_ROOT_DIR = $(REPO_ROOT ) /.aqua
3536
3637# The help command prints targets in groups. Help documentation in the Makefile
@@ -90,7 +91,7 @@ node_modules/.installed: package-lock.json
9091.bin/aqua-$(AQUA_VERSION ) /aqua :
9192 @set -euo pipefail; \
9293 mkdir -p .bin/aqua-$(AQUA_VERSION ) ; \
93- tempfile=$$(mktemp --suffix=".aqua-v $(AQUA_VERSION ) .tar.gz" ) ; \
94+ tempfile=$$(mktemp --suffix=".aqua-$(AQUA_VERSION ) .tar.gz" ) ; \
9495 curl -sSLo " $$ {tempfile}" " $( AQUA_URL) " ; \
9596 echo " $( AQUA_CHECKSUM) $$ {tempfile}" | sha256sum -c; \
9697 tar -x -C .bin/aqua-$(AQUA_VERSION ) -f " $$ {tempfile}"
@@ -112,6 +113,15 @@ package: compile ## Builds the distribution package.
112113 @rm -rf dist
113114 @npx rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript
114115
116+ # # Testing
117+ # ####################################################################
118+
119+ .PHONY : unit-test
120+ unit-test : compile # # Runs all unit tests.
121+ # NOTE: Make sure the package builds.
122+ @NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 \
123+ ./node_modules/.bin/jest
124+
115125# # Tools
116126# ####################################################################
117127
@@ -120,11 +130,23 @@ license-headers: ## Update license headers.
120130 @set -euo pipefail; \
121131 files=$$( \
122132 git ls-files --deduplicate \
123- ' :(glob)*.ts' ' src/*.ts' ' __tests__/*.ts' ' __fixtures__/*.ts' \
124- ' :(glob)*.mts' ' src/*.mts' ' __tests__/*.mts' ' __fixtures__/*.mts' \
125- ' :(glob)*.js' ' src/*.js' ' __tests__/*.js' ' __fixtures__/*.js' \
126- ' :(glob)*.mjs' ' src/*.mjs' ' __tests__/*.mjs' ' __fixtures__/*.mjs' \
133+ ' *.c' \
134+ ' *.cpp' \
135+ ' *.go' \
136+ ' *.h' \
137+ ' *.hpp' \
138+ ' *.ts' \
139+ ' *.js' \
140+ ' *.lua' \
141+ ' *.py' \
142+ ' *.rb' \
143+ ' *.rs' \
144+ ' *.toml' \
145+ ' *.yaml' \
146+ ' *.yml' \
127147 ' Makefile' \
148+ ' :!:dist/' \
149+ | while IFS=' ' read -r f; do [ -f " $$ {f}" ] && echo " $$ {f}" || true ; done \
128150 ); \
129151 name=$$(git config user.name ) ; \
130152 if [ " $$ {name}" == " " ]; then \
@@ -159,9 +181,11 @@ json-format: node_modules/.installed ## Format JSON files.
159181 ' *.json5' \
160182 | while IFS=' ' read -r f; do [ -f " $$ {f}" ] && echo " $$ {f}" || true ; done \
161183 ); \
184+ if [ " $$ {files}" == " " ]; then \
185+ exit 0; \
186+ fi ; \
162187 ./node_modules/.bin/prettier \
163188 --write \
164- --no-error-on-unmatched-pattern \
165189 $$ {files}
166190
167191.PHONY : md-format
@@ -173,10 +197,12 @@ md-format: node_modules/.installed ## Format Markdown files.
173197 ' *.md' \
174198 | while IFS=' ' read -r f; do [ -f " $$ {f}" ] && echo " $$ {f}" || true ; done \
175199 ); \
200+ if [ " $$ {files}" == " " ]; then \
201+ exit 0; \
202+ fi ; \
176203 # NOTE: prettier uses .editorconfig for tab-width. \
177204 ./node_modules/.bin/prettier \
178205 --write \
179- --no-error-on-unmatched-pattern \
180206 $$ {files}
181207
182208.PHONY : yaml-format
@@ -187,45 +213,51 @@ yaml-format: node_modules/.installed ## Format YAML files.
187213 ' *.yml' \
188214 ' *.yaml' \
189215 ); \
216+ if [ " $$ {files}" == " " ]; then \
217+ exit 0; \
218+ fi ; \
190219 ./node_modules/.bin/prettier \
191220 --write \
192- --no-error-on-unmatched-pattern \
193221 $$ {files}
194222
195223.PHONY : js-format
196224js-format : node_modules/.installed # # Format YAML files.
197225 @set -euo pipefail; \
198226 files=$$( \
199227 git ls-files --deduplicate \
200- ' :(glob)*.js' ' src/*.js' ' __tests__/*.js' ' __fixtures__/*.js' \
201- ' :(glob)*.mjs' ' src/*.mjs' ' __tests__/*.mjs' ' __fixtures__/*.mjs' \
228+ ' *.js' \
229+ ' *.cjs' \
230+ ' *.mjs' \
231+ ' *.jsx' \
232+ ' *.mjsx' \
233+ ' :!:dist/' \
202234 ); \
235+ if [ " $$ {files}" == " " ]; then \
236+ exit 0; \
237+ fi ; \
203238 ./node_modules/.bin/prettier \
204239 --write \
205- --no-error-on-unmatched-pattern \
206240 $$ {files}
207241
208242.PHONY : ts-format
209243ts-format : node_modules/.installed # # Format YAML files.
210244 @set -euo pipefail; \
211245 files=$$( \
212246 git ls-files --deduplicate \
213- ' :(glob)*.ts' ' src/*.ts' ' __tests__/*.ts' ' __fixtures__/*.ts' \
214- ' :(glob)*.mts' ' src/*.mts' ' __tests__/*.mts' ' __fixtures__/*.mts' \
215- ); \
247+ ' *.ts' \
248+ ' *.cts' \
249+ ' *.mts' \
250+ ' *.tsx' \
251+ ' *.mtsx' \
252+ ' :!:dist/' \
253+ ); \
254+ if [ " $$ {files}" == " " ]; then \
255+ exit 0; \
256+ fi ; \
216257 ./node_modules/.bin/prettier \
217258 --write \
218- --no-error-on-unmatched-pattern \
219259 $$ {files}
220260
221- # # Testing
222- # ####################################################################
223-
224- .PHONY : unit-test
225- unit-test : compile # # Runs all unit tests.
226- # NOTE: Make sure the package builds.
227- @NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 npx jest
228-
229261# # Linting
230262# ####################################################################
231263
@@ -242,6 +274,9 @@ actionlint: $(AQUA_ROOT_DIR)/.installed ## Runs the actionlint linter.
242274 ' .github/workflows/*.yaml' \
243275 | while IFS=' ' read -r f; do [ -f " $$ {f}" ] && echo " $$ {f}" || true ; done \
244276 ); \
277+ if [ " $$ {files}" == " " ]; then \
278+ exit 0; \
279+ fi ; \
245280 PATH=" $( REPO_ROOT) /.bin/aqua-$( AQUA_VERSION) :$( AQUA_ROOT_DIR) /bin:$$ {PATH}" ; \
246281 AQUA_ROOT_DIR=" $( AQUA_ROOT_DIR) " ; \
247282 if [ " $( OUTPUT_FORMAT) " == " github" ]; then \
@@ -264,6 +299,9 @@ zizmor: .venv/.installed ## Runs the zizmor linter.
264299 ' .github/workflows/*.yaml' \
265300 | while IFS=' ' read -r f; do [ -f " $$ {f}" ] && echo " $$ {f}" || true ; done \
266301 ); \
302+ if [ " $$ {files}" == " " ]; then \
303+ exit 0; \
304+ fi ; \
267305 if [ " $( OUTPUT_FORMAT) " == " github" ]; then \
268306 .venv/bin/zizmor \
269307 --quiet \
@@ -290,6 +328,9 @@ markdownlint: node_modules/.installed $(AQUA_ROOT_DIR)/.installed ## Runs the ma
290328 ' :!:.github/ISSUE_TEMPLATE/*.md' \
291329 | while IFS=' ' read -r f; do [ -f " $$ {f}" ] && echo " $$ {f}" || true ; done \
292330 ); \
331+ if [ " $$ {files}" == " " ]; then \
332+ exit 0; \
333+ fi ; \
293334 PATH=" $( REPO_ROOT) /.bin/aqua-$( AQUA_VERSION) :$( AQUA_ROOT_DIR) /bin:$$ {PATH}" ; \
294335 AQUA_ROOT_DIR=" $( AQUA_ROOT_DIR) " ; \
295336 if [ " $( OUTPUT_FORMAT) " == " github" ]; then \
@@ -317,6 +358,9 @@ markdownlint: node_modules/.installed $(AQUA_ROOT_DIR)/.installed ## Runs the ma
317358 ' .github/ISSUE_TEMPLATE/*.md' \
318359 | while IFS=' ' read -r f; do [ -f " $$ {f}" ] && echo " $$ {f}" || true ; done \
319360 ); \
361+ if [ " $$ {files}" == " " ]; then \
362+ exit 0; \
363+ fi ; \
320364 if [ " $( OUTPUT_FORMAT) " == " github" ]; then \
321365 exit_code=0; \
322366 while IFS=" " read -r p && [ -n " $$ p" ]; do \
@@ -351,6 +395,9 @@ textlint: node_modules/.installed $(AQUA_ROOT_DIR)/.installed ## Runs the textli
351395 ' :!:requirements.txt' \
352396 | while IFS=' ' read -r f; do [ -f " $$ {f}" ] && echo " $$ {f}" || true ; done \
353397 ); \
398+ if [ " $$ {files}" == " " ]; then \
399+ exit 0; \
400+ fi ; \
354401 if [ " $( OUTPUT_FORMAT) " == " github" ]; then \
355402 exit_code=0; \
356403 while IFS=" " read -r p && [ -n " $$ p" ]; do \
@@ -378,6 +425,9 @@ todos: $(AQUA_ROOT_DIR)/.installed ## Check for outstanding TODOs.
378425 git ls-files --deduplicate \
379426 | while IFS=' ' read -r f; do [ -f " $$ {f}" ] && echo " $$ {f}" || true ; done \
380427 ); \
428+ if [ " $$ {files}" == " " ]; then \
429+ exit 0; \
430+ fi ; \
381431 PATH=" $( REPO_ROOT) /.bin/aqua-$( AQUA_VERSION) :$( AQUA_ROOT_DIR) /bin:$$ {PATH}" ; \
382432 AQUA_ROOT_DIR=" $( AQUA_ROOT_DIR) " ; \
383433 output=" default" ; \
@@ -405,6 +455,9 @@ yamllint: .venv/.installed ## Runs the yamllint linter.
405455 ' *.yaml' \
406456 | while IFS=' ' read -r f; do [ -f " $$ {f}" ] && echo " $$ {f}" || true ; done \
407457 ); \
458+ if [ " $$ {files}" == " " ]; then \
459+ exit 0; \
460+ fi ; \
408461 format=" standard" ; \
409462 if [ " $( OUTPUT_FORMAT) " == " github" ]; then \
410463 format=" github" ; \
@@ -420,19 +473,21 @@ eslint: node_modules/.installed ## Runs eslint.
420473 @set -euo pipefail; \
421474 files=$$( \
422475 git ls-files --deduplicate \
423- ' src/*.ts' \
424- ' src/*.mts' \
425- ' src/*.js' \
426- ' src/*.mjs' \
427- ' __tests__/*.ts' \
428- ' __tests__/*.mts' \
429- ' __tests__/*.js' \
430- ' __tests__/*.mjs' \
431- ' __fixtures__/*.ts' \
432- ' __fixtures__/*.mts' \
433- ' __fixtures__/*.js' \
434- ' __fixtures__/*.mjs' \
476+ ' *.js' \
477+ ' *.cjs' \
478+ ' *.mjs' \
479+ ' *.jsx' \
480+ ' *.mjsx' \
481+ ' *.ts' \
482+ ' *.cts' \
483+ ' *.mts' \
484+ ' *.tsx' \
485+ ' *.mtsx' \
486+ ' :!:dist/' \
435487 ); \
488+ if [ " $$ {files}" == " " ]; then \
489+ exit 0; \
490+ fi ; \
436491 if [ " $( OUTPUT_FORMAT) " == " github" ]; then \
437492 set -euo pipefail; \
438493 exit_code=0; \
@@ -455,10 +510,15 @@ eslint: node_modules/.installed ## Runs eslint.
455510 ;; \
456511 esac ; \
457512 done <<< $$ (echo " $$ {p}" | jq -c ' .messages[]' ); \
458- done <<< $$ (npx eslint --max-warnings 0 -f json $$ {files} | jq -c ' .[]' ); \
513+ done <<< $$ (./node_modules/.bin/eslint \
514+ --max-warnings 0 \
515+ --format json \
516+ $$ {files} | jq -c ' .[]' ); \
459517 exit " $$ {exit_code}" ; \
460518 else \
461- npx eslint --max-warnings 0 $$ {files}; \
519+ ./node_modules/.bin/eslint \
520+ --max-warnings 0 \
521+ $$ {files}; \
462522 fi
463523
464524# # Maintenance
@@ -471,6 +531,6 @@ clean: ## Delete temporary files.
471531 $(AQUA_ROOT_DIR ) \
472532 .venv \
473533 node_modules \
474- * .sarif.json\
534+ * .sarif.json \
475535 lib \
476536 coverage
0 commit comments