/
makefile
121 lines (85 loc) 路 2.09 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
112
113
114
115
116
117
118
119
120
121
.PHONY: help
help: makefile
@tail -n +4 makefile | grep ".PHONY"
.PHONY: all
all: changelog.md readme.md index.js docs output
.PHONY: build
build: | node_modules
npx spago build
changelog.md: .git | node_modules
# git config changelog.format '- %s (%h)'
# git changelog
npx conventional-changelog \
--infile $@ \
--same-file \
--output-unreleased
srcFiles := $(shell find src -type f -name "*.purs")
index.js: $(srcFiles) spago.yaml | node_modules
npx spago bundle \
--platform node \
--minify
.PHONY: bundle
bundle: index.js
# The specified target is configured in package.json
docs: output | node_modules
npx parcel build webapp/index.html \
--public-url /Transity \
--no-source-maps \
--target $@
# Correct paths for assets during local development
# Use e.g. Vercel's "serve" like this: `serve docs-dev`.
# The specified target is configured in package.json.
docs-dev: output index.js | node_modules
npx parcel build webapp/index.html \
--no-source-maps \
--target $@
output: src spago.yaml | node_modules
npx spago build
node_modules: package.json package-lock.json
if test ! -d $@; then npm install; fi
readme.md: | node_modules
npx markdown-toc -i $@
##### TESTING ######
.PHONY: lint-js
lint-js: | node_modules
npx eslint \
--max-warnings 0 \
--ignore-path .gitignore \
scripts
.PHONY: test-spago
test-spago: | node_modules
npx spago test
.PHONY: test-cli
test-cli: | node_modules
npx spago run -- \
balance examples/journal.yaml \
> /dev/null
npx spago run -- \
balance examples/journal.yaml examples/journal-only-transactions.yaml \
> /dev/null
npx spago run -- \
unused-files examples/receipts examples/journal.yaml \
2> /dev/null
npx spago run -- \
unused-files \
examples/receipts \
examples/journal.yaml \
examples/journal-only-transactions.yaml \
2> /dev/null
.PHONY: test
test: test-spago test-cli lint-js
.PHONY: test-watch
test-watch: | node_modules
watchexec \
--exts purs \
'npx spago test'
.PHONY: clean
clean:
-rm -rf \
.parcel-cache \
.spago \
docs \
docs-dev \
index.js \
node_modules \
output