-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (42 loc) · 1.25 KB
/
Makefile
File metadata and controls
52 lines (42 loc) · 1.25 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
VALE := vale
VALE_FLAGS := --config=testdata/.vale.ini --no-wrap
FIXTURES := $(wildcard testdata/pass/*.md testdata/fail/*.md)
.PHONY: test test-snapshots test-self update-snapshots lint prettier bump-version precommit
test: test-snapshots test-self
test-snapshots:
@fail=0; \
for file in $(FIXTURES); do \
snap="$${file%.md}.expected.txt"; \
if [ ! -f "$$snap" ]; then \
echo "FAIL: missing snapshot $$snap"; \
fail=1; \
continue; \
fi; \
actual=$$($(VALE) $(VALE_FLAGS) "$$file" 2>&1 | sed 's/\x1b\[[0-9;]*m//g'); \
expected=$$(cat "$$snap"); \
if [ "$$actual" != "$$expected" ]; then \
echo "FAIL: $$file output differs from snapshot"; \
echo "Expected:"; \
cat "$$snap"; \
echo "Actual:"; \
echo "$$actual"; \
echo ""; \
fail=1; \
fi; \
done; \
if [ "$$fail" -eq 1 ]; then exit 1; fi
@echo "PASS: all snapshots match"
update-snapshots:
@for file in $(FIXTURES); do \
snap="$${file%.md}.expected.txt"; \
$(VALE) $(VALE_FLAGS) "$$file" 2>&1 | sed 's/\x1b\[[0-9;]*m//g' > "$$snap"; \
echo "Updated $$snap"; \
done
test-self:
@$(VALE) --config=.vale.ini README.md CHANGELOG.md
bump-version:
@bash scripts/bump-version.sh
prettier:
@npx -y prettier --write .
lint: bump-version prettier
precommit: lint test