forked from italia/api-oas-checker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
54 lines (44 loc) · 1.51 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
#
# Tasks set to build ruleset, bundle js, test and deploy
#
#
RULE_FILES := spectral.yml spectral-full.yml spectral-security.yml spectral-generic.yml
RULE_DOCS := $(RULE_FILES:.yml=.doc.html)
all: clean install rules build test-ui
# Clean artifacts from the previous build
clean:
rm -f $(RULE_DOCS)
rm -f $(RULE_FILES)
# Install node dependencies
install: yarn.lock
rm -rf node_modules
yarn install --frozen-lockfile
# Generate spectral ruleset with documentation
rules: clean $(RULE_FILES)
spectral.yml: ./rules/
cat ./rules/rules-template.yml.template > $@
./rules/merge-yaml rules/*.yml >> $@
node ruleset_doc_generator.mjs --file $@ --title 'Italian API Guidelines'
spectral-generic.yml: ./rules/ spectral.yml
./rules/merge-yaml spectral.yml rules/skip-italian.yml.template > $@
node ruleset_doc_generator.mjs --file $@ --title 'Best Practices Only'
spectral-security.yml: ./rules/ ./security/
cat ./rules/rules-template.yml.template > $@
./rules/merge-yaml security/*.yml >> $@
node ruleset_doc_generator.mjs --file $@ --title 'Extra Security Checks'
spectral-full.yml: spectral.yml spectral-security.yml
./rules/merge-yaml spectral.yml spectral-security.yml > $@
node ruleset_doc_generator.mjs --file $@ --title 'Italian API Guidelines + Extra Security Checks'
# Build js bundle
build: install rules
yarn build-js
# Run test suite
test-ui: install
yarn eslint
yarn test
# TODO: this doesn't work on MacOS!
test: install
bash test-ruleset.sh rules/ all
bash test-ruleset.sh security/ all
deploy: all
yarn deploy