-
Notifications
You must be signed in to change notification settings - Fork 22
/
Makefile
140 lines (94 loc) · 4.66 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
138
139
140
.PHONY: all compile deps jar install deploy nodejs browser webworker cljtest \
cljs-browser-test cljs-node-test cljstest test eastwood ci clean \
js-packages sync-package-json publish-nodejs publish-browser \
publish-webworker publish-js pending-tests pt
DOCS_MARKDOWN := $(shell find docs -name '*.md')
DOCS_TARGETS := $(DOCS_MARKDOWN:docs/%.md=docs/%.html)
SOURCES := $(shell find src)
RESOURCES := $(shell find resources)
BROWSER_SOURCES := src/clj/fluree/sdk/browser.cljs
NODEJS_SOURCES := src/clj/fluree/sdk/node.cljs
WEBWORKER_SOURCES := src/clj/fluree/sdk/webworker.cljs
ALL_SOURCES := $(SOURCES) $(BROWSER_SOURCES) $(WEBWORKER_SOURCES) $(NODEJS_SOURCES)
all: jar browser nodejs webworker js-packages docs
target/classes:
clojure -T:build compile
compile: target/classes
target/fluree-db.jar: out node_modules src/clj/deps.cljs $(ALL_SOURCES) $(RESOURCES)
clojure -T:build jar
jar: target/fluree-db.jar
package-lock.json node_modules: package.json
npm install && touch package-lock.json node_modules
out/fluree-node-sdk.js: package.json package-lock.json node_modules deps.edn src/clj/deps.cljs shadow-cljs.edn $(SOURCES) $(NODEJS_SOURCES) $(RESOURCES)
npx shadow-cljs release fluree-node-sdk && cp out/nodejs/fluree-node-sdk.js out/fluree-node-sdk.js
nodejs: out/fluree-node-sdk.js
out/fluree-browser-sdk.js: package.json package-lock.json node_modules deps.edn src/clj/deps.cljs shadow-cljs.edn $(SOURCES) $(BROWSER_SOURCES) $(RESOURCES)
npx shadow-cljs release fluree-browser-sdk && cp out/browser/fluree-browser-sdk.js out/fluree-browser-sdk.js
browser: out/fluree-browser-sdk.js
out/fluree-webworker.js: package.json package-lock.json node_modules deps.edn src/clj/deps.cljs shadow-cljs.edn $(SOURCES) $(WEBWORKER_SOURCES) $(RESOURCES)
npx shadow-cljs release fluree-webworker && cp out/webworker/fluree-webworker.js out/fluree-webworker.js
webworker: out/fluree-webworker.js
deps:
clojure -A:cljtest:cljstest:eastwood:docs -P
src/clj/deps.cljs: package.json
clojure -M:js-deps
install: target/fluree-db.jar
clojure -T:build install
deploy: target/fluree-db.jar
clojure -T:build deploy
js-packages/nodejs/package.json: package.json build.clj
clojure -T:build sync-package-json :target $(@D)/package.json :node? true
js-packages/browser/package.json: package.json build.clj
clojure -T:build sync-package-json :target $(@D)/package.json
js-packages/webworker/package.json: package.json build.clj
clojure -T:build sync-package-json :target $(@D)/package.json
js-packages/nodejs/fluree-node-sdk.js: out/fluree-node-sdk.js
cp $< $@
js-packages/browser/fluree-browser-sdk.js: out/fluree-browser-sdk.js
cp $< $@
js-packages/webworker/fluree-webworker.js: out/fluree-webworker.js
cp $< $@
js-packages: sync-package-json js-packages/nodejs/fluree-node-sdk.js js-packages/browser/fluree-browser-sdk.js js-packages/webworker/fluree-webworker.js
sync-package-json: js-packages/nodejs/package.json js-packages/browser/package.json js-packages/webworker/package.json
NPM_TAG ?= latest
publish-nodejs: js-packages/nodejs/fluree-node-sdk.js js-packages/nodejs/package.json
cd $(<D) && npm publish --tag $(NPM_TAG)
publish-browser: js-packages/browser/fluree-browser-sdk.js js-packages/browser/package.json
cd $(<D) && npm publish --tag $(NPM_TAG)
publish-webworker: js-packages/webworker/fluree-webworker.js js-packages/webworker/package.json
cd $(<D) && npm publish --tag $(NPM_TAG)
publish-js: publish-nodejs publish-browser publish-webworker
docs/fluree.db.json-ld.api.html docs/index.html: src/clj/fluree/db/json_ld/api.cljc
clojure -T:build docs :output-path "\"$(@D)\""
docs/%.html: docs/%.md
clojure -T:build docs :output-path "\"$(@D)\""
docs: docs/fluree.db.json-ld.api.html docs/index.html $(DOCS_TARGETS)
cljs-browser-test: node_modules package-lock.json
npx shadow-cljs release browser-test
./node_modules/karma/bin/karma start --single-run
cljs-node-test: node_modules package-lock.json
npx shadow-cljs release node-test
nodejs-test: out/fluree-node-sdk.js
cd test/nodejs && npm install && node --experimental-vm-modules node_modules/jest/bin/jest.js
browser-test: out/fluree-browser-sdk.js
cd test/browser && npm install && CI=true npm test
cljstest: cljs-browser-test cljs-node-test
cljtest: target/classes
clojure -X:dev:cljtest
pending-tests:
clojure -X:dev:pending-tests
pt: pending-tests
test: cljtest cljstest nodejs-test browser-test
eastwood:
clojure -M:dev:cljtest:eastwood
ci: test eastwood
clean:
clojure -T:build clean
rm -rf out/*
rm -rf docs/*.html
rm -rf node_modules
rm -rf test/nodejs/store
rm -rf .shadow-cljs
rm -rf js-packages/browser/fluree-browser-sdk.js
rm -rf js-packages/nodejs/fluree-node-sdk.js
rm -rf js-packages/webworker/fluree-webworker.js