-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
79 lines (57 loc) · 2.3 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
.PHONY: clean distclean format test update-node
css-files:=$(wildcard src/*.css)
html-files:=$(wildcard src/*.html)
js-files:=$(wildcard src/*.js src/*.mjs)
asset-files:=$(wildcard assets/*)
all-files:=$(css-files) $(html-files) $(js-files) $(asset-files) manifest.json
ignore-files:=Makefile manifest-version.py package.json yarn.lock
version:=$(shell ./manifest-version.py)
# building
build: dist/stash-snapshot.zip
dist/stash-snapshot.zip: $(all-files) node_modules/.updated
yarn --silent run web-ext build --filename stash-snapshot.zip --overwrite-dest --ignore-files $(ignore-files) --artifacts-dir dist
release: format test dist/stash-$(version).zip
dist/stash-$(version).zip: $(all-files) node_modules/.updated
$(info Building stash-$(version).zip)
yarn --silent run web-ext build --filename stash-$(version).zip --overwrite-dest --ignore-files $(ignore-files) --artifacts-dir dist
clean:
rm -f .git/css-format .git/html-format .git/js-format dist/stash-snapshot.zip dist/stash-$(version).zip
distclean: clean
rm -rf venv node_modules
# formatting
format: .git/css-format .git/html-format .git/js-format
.git/css-format: node_modules/.updated $(css-files)
@if [ -n "$(css-files)" ]; then \
echo yarn --silent run stylelint --fix $(css-files); \
yarn --silent run stylelint --fix $(css-files); \
fi
@touch $@
.git/html-format: node_modules/.updated $(html-files)
@if [ -n "$(html-files)" ]; then \
echo yarn --silent run prettier --write $(html-files); \
yarn --silent run prettier --write $(html-files); \
fi
@touch $@
.git/js-format: node_modules/.updated $(js-files)
@if [ -n "$(js-files)" ]; then \
echo yarn --silent run prettier --write $(js-files); \
yarn --silent run prettier --write $(js-files); \
fi
@touch $@
# testing
test: test-css test-html test-js test-web-ext
test-css: node_modules/.updated
yarn --silent run stylelint $(css-files)
test-html: node_modules/.updated
yarn --silent run prettier --check $(html-files)
test-js: node_modules/.updated
yarn --silent run eslint $(js-files)
yarn --silent run prettier --check $(js-files)
test-web-ext: node_modules/.updated
yarn --silent run web-ext lint --warnings-as-errors
# build infra
upgrade-node: node_modules/.updated
yarn upgrade --ignore-optional
node_modules/.updated: package.json
yarn install --ignore-optional
@touch $@