-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
102 lines (86 loc) · 2.62 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
BCD_REPO=https://github.com/mdn/browser-compat-data.git
# BCD_BRANCH=main
BCD_BRANCH=sideshowbarker/spec-url-updates
MDN_REPO=https://github.com/mdn/content.git
GRIP=grip
GIT=git
NODE=node
YARN=yarn
EGREP=egrep
NETSTAT=netstat
SHELL:=/bin/bash
.PHONY: report-only report report-BCD
all: report
yarn.lock:
$(YARN)
browser-compat-data:
$(GIT) clone -b $(BCD_BRANCH) --single-branch $(BCD_REPO)
content:
$(GIT) clone $(MDN_REPO)
$(YARN) --cwd content
yari.PID: content
@if ! ($(NETSTAT) -an | $(EGREP) -i "[.:]5042.+LISTEN" > /dev/null); \
then \
$(YARN) --cwd content start & echo $$! > yari.PID; \
sleep 20; \
echo "yari PID: $$(cat yari.PID)"; \
fi
BCD-LOG: yarn.lock browser-compat-data
$(NODE) .spec-urls-check.js 2>&1 \
| tee $@
report-BCD: BCD-LOG
@! $(EGREP) "bad fragment" BCD-LOG
@! $(EGREP) "needs spec URL" BCD-LOG
LOG: report-BCD yari.PID
$(NODE) .browser-compat-data-process.js 2>&1 \
| tee $@
report: LOG
@# BCD-LOG errors
@! $(EGREP) "bad fragment" BCD-LOG
@! $(EGREP) "needs spec URL" BCD-LOG
@# LOG errors
@! $(EGREP) "error for" LOG
@! $(EGREP) "broken spec URL" LOG
@! $(EGREP) "has bad spec URL" LOG
@! $(EGREP) "unexpected status code" LOG
@# LOG warnings
@! $(EGREP) "odd MDN URL" LOG || true
@! $(EGREP) "bad caniuse spec URL" LOG || true
report-only:
@! $(EGREP) "bad fragment" BCD-LOG 2>/dev/null || true
@! $(EGREP) "needs spec URL" BCD-LOG 2>/dev/null || true
@! $(EGREP) "error for" LOG 2>/dev/null || true
@! $(EGREP) "broken spec URL" LOG 2>/dev/null || true
@! $(EGREP) "has bad spec URL" LOG 2>/dev/null || true
@! $(EGREP) "unexpected status code" LOG 2>/dev/null || true
@! $(EGREP) "odd MDN URL" LOG 2>/dev/null || true
@! $(EGREP) "bad caniuse spec URL" LOG 2>/dev/null || true
URLS-LOG: yarn.lock
$(NODE) --max-old-space-size=13312 .spec-urls-make.js 2>&1 \
| tee URLS-LOG
index.html: README.md
cp $< $<.tmp
echo >> $<.tmp
echo >> $<.tmp
for file in *.json; do \
if [[ "$$file" != "SPECMAP.json" \
&& "$$file" != "SPECURLS.json" && "$$file" != "w3c.json" && "$$file" != "package.json" ]]; then \
echo "* [$${file%.*}]($$file) [[status](less-than-2.html?spec=$${file%.*})]" >> $<.tmp; \
fi; \
done
pip install grip \
&& $(GRIP) --title=$< --export $<.tmp - > $@ \
&& $(RM) $<.tmp
.mdn-spec-links.schema.json: .mdn-spec-links.ts
ts-json-schema-generator --path $< --unstable --type MDNSpecLink --out $@
clean:
$(RM) LOG
$(RM) BCD-LOG
$(RM) URLS-LOG
if [ -a yari.PID ]; then kill -- -$$(ps -o pgid= $$(cat yari.PID)) \
|| true; fi;
$(RM) yari.PID
unsafe-dangerously-and-destructively-clean: clean
$(RM) yarn.lock
$(RM) -r browser-compat-data
$(RM) -r content