-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
makefile
137 lines (96 loc) · 2.39 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
.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
bun x spago build
changelog.md: .git | node_modules
# git config changelog.format '- %s (%h)'
# git changelog
bun x conventional-changelog \
--infile $@ \
--same-file \
--output-unreleased
srcFiles := $(shell find src -type f -name "*.purs")
index.js: $(srcFiles) spago.yaml | node_modules
bun x spago bundle \
--platform node \
--minify
.PHONY: bundle
bundle: index.js
# The specified target is configured in package.json
docs/docs: | node_modules
bunx spago run --main Build
# The specified target is configured in package.json
docs: output docs/docs | node_modules
bunx parcel build \
--no-source-maps \
webapp/index.html \
--target $@
.PHONY: docs-watch
docs-watch: output | node_modules
bunx parcel watch \
--no-source-maps \
webapp/index.html \
--target docs
output: src spago.yaml | node_modules
bun x spago build
node_modules: package.json
if test ! -d $@; then bun install; fi
readme.md: | node_modules
bun x markdown-toc -i $@
##### TESTING ######
.PHONY: lint-js
lint-js: | node_modules
bun x eslint \
--max-warnings 0 \
--ignore-pattern .gitignore \
scripts
.PHONY: test-spago
test-spago: | node_modules
bun x spago test
.PHONY: test-cli
test-cli: | node_modules
bun x spago run -- \
balance examples/journal.yaml \
> /dev/null
bun x spago run -- \
balance examples/journal.yaml examples/journal-only-transactions.yaml \
> /dev/null
# Following command should fail
@bun x spago run -- \
balance examples/journal.yaml examples/journal-broken-transaction.yaml \
&& echo "❌ This must fail" && exit 1 \
|| echo "✅ Balance printed an error"
bun x spago run -- \
unused-files examples/receipts examples/journal.yaml \
2> /dev/null
bun x 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 \
'bun x spago test'
.PHONY: install
install: bundle
.PHONY: clean
clean:
-rm -f bun.lockb
-rm -f index.js
-rm -f package-lock.json
-rm -rf .parcel-cache
-rm -rf .spago
-rm -rf docs
-rm -rf docs-dev
-rm -rf generated-docs
-rm -rf node_modules
-rm -rf output