-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
31 lines (24 loc) · 877 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Linter and formatter configuration
# ----------------------------------
PRETTIER_FILES_PATTERN = './*.md' './*/*.md'
SHFMT_FILES_PATTERN = ./**/*.sh
# Introspection targets
# ---------------------
.PHONY: help
help: targets
.PHONY: targets
targets:
@echo "\033[34mTargets\033[0m"
@echo "\033[34m---------------------------------------------------------------\033[0m"
@perl -nle'print $& if m{^[a-zA-Z_-\d]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-22s\033[0m %s\n", $$1, $$2}'
# Check, lint and format targets
# ------------------------------
.PHONY: lint
lint: ## Lint files
npx prettier --check $(PRETTIER_FILES_PATTERN)
shfmt -d $(SHFMT_FILES_PATTERN)
shellcheck $(SHFMT_FILES_PATTERN)
.PHONY: format
format: ## Format source files
npx prettier --write $(PRETTIER_FILES_PATTERN)
shfmt -w $(SHFMT_FILES_PATTERN)