-
Notifications
You must be signed in to change notification settings - Fork 128
/
Makefile
111 lines (93 loc) · 3.28 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
103
104
105
106
107
108
109
110
111
SETTINGS_FILE := settings/chrome-dev.json
ROLLUP := node_modules/.bin/rollup
ESLINT := node_modules/.bin/eslint
MUSTACHE := node_modules/.bin/mustache
PRETTIER := node node_modules/.bin/prettier
.PHONY: default
default: help
.PHONY: help
help:
@echo "make help Show this help message"
@echo "make dev Watch for changes and build the browser-extension"
@echo "make build Create a build of the browser-extension"
@echo "make lint Run the code linter(s) and print any warnings"
@echo "make checkformatting Check code formatting"
@echo "make format Automatically format code"
@echo "make test Run the unit tests once"
@echo "make sure Make sure that the formatter, linter, tests, etc all pass"
@echo "make clean Delete development artefacts (cached files, "
@echo " dependencies, etc)"
.PHONY: build
build: node_modules/.uptodate extension
.PHONY: dev
dev: node_modules/.uptodate
yarn gulp watch
.PHONY: clean
clean:
rm -f node_modules/.uptodate
rm -rf build/*
rm -rf dist/*
################################################################################
# The `build/settings.json` target is always rebuilt in case the value of
# `SETTINGS_FILE` changed, but the output file is only updated if needed.
.PHONY: force
build/settings.json: force
tools/settings.js $(SETTINGS_FILE) > [email protected]
rsync --checksum [email protected] $@
EXTENSION_SRC := pdfjs help images options
.PHONY: extension
extension: build/extension.bundle.js
extension: build/manifest.json
extension: build/client/build
extension: build/client/app.html
extension: build/client/notebook.html
extension: build/client/profile.html
extension: build/unload-client.js
extension: build/pdfjs-init.js
extension: $(addprefix build/,$(EXTENSION_SRC))
build/extension.bundle.js: src/background/*.ts rollup.config.js build/settings.json
$(ROLLUP) -c rollup.config.js
build/manifest.json: src/manifest.json.mustache build/settings.json
$(MUSTACHE) build/settings.json $< > $@
build/client/build: node_modules/hypothesis/build/manifest.json
@mkdir -p $@
cp -R node_modules/hypothesis/build/* $@
@# We can't leave the client manifest in the build or the Chrome Web Store
@# will complain.
rm $@/manifest.json
build/client/app.html: src/sidebar-app.html.mustache build/client build/settings.json
tools/template-context-app.js build/settings.json | $(MUSTACHE) - $< >$@
build/client/notebook.html: build/client/app.html
cp $< $@
build/client/profile.html: build/client/app.html
cp $< $@
build/unload-client.js: src/unload-client.js
cp $< $@
build/pdfjs-%.js: src/pdfjs-%.js
cp $< $@
build/pdfjs: src/vendor/pdfjs
cp -R $< $@
build/%: src/%
@mkdir -p $@
cp -R $</* $@
dist/%.zip dist/%.xpi: extension
cd build && find . -not -path '*/\.*' -type f | zip -q -@ $(abspath $@)
.PHONY: lint
lint: node_modules/.uptodate build/settings.json
$(ESLINT) .
yarn typecheck
.PHONY: checkformatting
checkformatting: node_modules/.uptodate
$(PRETTIER) --check '**/*.{ts,js,cjs}'
.PHONY: format
format: node_modules/.uptodate
$(PRETTIER) --list-different --write '**/*.{ts,js,cjs}'
.PHONY: test
test: node_modules/.uptodate
yarn test
.PHONY: sure
sure: checkformatting lint test
node_modules/.uptodate: package.json yarn.lock
yarn install
@touch $@