-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathmakefile
More file actions
144 lines (101 loc) · 2.49 KB
/
makefile
File metadata and controls
144 lines (101 loc) · 2.49 KB
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
138
139
140
141
142
143
144
.PHONY: help
help: makefile
@tail -n +4 makefile | grep ".PHONY"
.PHONY: all
all: changelog.md readme.md index.js docs output
.PHONY: format
format: | node_modules
bunx pursfmt format-in-place \
"src/**/*.purs" \
"test/**/*.purs"
.PHONY: build
build: | node_modules
bunx spago build
changelog.md: .git | node_modules
# git config changelog.format '- %s (%h)'
# git changelog
bunx conventional-changelog \
--infile $@ \
--same-file \
--output-unreleased
srcFiles := $(shell find src -type f -name "*.purs")
index.js: $(srcFiles) spago.yaml | node_modules
bunx 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
bunx spago build
node_modules: package.json
if test ! -d $@; then bun install; fi
readme.md: | node_modules
bunx markdown-toc -i $@
##### TESTING ######
.PHONY: lint-js
lint-js: | node_modules
bunx eslint \
--max-warnings 0 \
--ignore-pattern .gitignore \
scripts
.PHONY: test-spago
test-spago: | node_modules
bunx spago test
.PHONY: test-cli
test-cli: | node_modules
bunx spago run -- \
balance examples/journal.yaml \
> /dev/null
bunx spago run -- \
balance examples/journal.yaml examples/journal-only-transactions.yaml \
> /dev/null
# Following command should fail
@bunx spago run -- \
balance examples/journal.yaml examples/journal-broken-transaction.yaml \
&& echo "❌ This must fail" && exit 1 \
|| echo "✅ Balance printed an error"
bunx spago run -- \
unused-files examples/receipts examples/journal.yaml \
2> /dev/null
bunx 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 \
'bunx 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