-
Notifications
You must be signed in to change notification settings - Fork 35
/
Makefile
37 lines (31 loc) · 1.19 KB
/
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
32
33
34
35
36
37
IS_PYTHON_INSTALLED = $(shell which python >> /dev/null 2>&1; echo $$?)
ALL_DOCS := $(shell find . -type f -name '*.md' -not -path './.github/*' -not -path './node_modules/*' | sort)
parse: _check_python
@python ./tools/specification_parser/specification_parser.py
lint: node_modules
@python ./tools/specification_parser/lint_json_output.py specification.json
./node_modules/.bin/markdownlint --ignore node_modules/ --ignore tools/ **/*.md
./node_modules/.bin/markdown-link-check -c .markdown-link-check-config.json README.md specification/*.md specification/**/*.md
fix: node_modules
prettier -w **/*.md
node_modules:
npm ci
_check_python:
@if [ $(IS_PYTHON_INSTALLED) -eq 1 ]; \
then echo "" \
&& echo "ERROR: python must be available on PATH." \
&& echo "" \
&& exit 1; \
fi;
.PHONY: markdown-toc
markdown-toc: node_modules
@if ! npm ls markdown-toc; then npm ci; fi
@for f in $(ALL_DOCS); do \
if grep -q '<!-- tocstop -->' $$f; then \
echo markdown-toc: processing $$f; \
npx --no -- markdown-toc --bullets="-" --no-first-h1 --no-stripHeadingTags -i $$f || exit 1; \
npx --no -- prettier -w $$f; \
else \
echo markdown-toc: no TOC markers, skipping $$f; \
fi; \
done