forked from smartcontractkit/external-adapters-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
83 lines (64 loc) · 3.3 KB
/
Copy pathMakefile
File metadata and controls
83 lines (64 loc) · 3.3 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
check?=schedule
docker:
docker build --build-arg adapter=$(adapter) -f Dockerfile . -t $(if $(name),$(name),$(adapter))-adapter $(if $(tag), -t $(tag), )
zip: deps build
(cd $(adapter)/dist && zip $(if $(name),$(name),$(adapter))-adapter.zip index.js)
new:
mkdir $(adapter)
cp -R example/* $(adapter)
cp example/.eslintrc.js $(adapter)
sed -i 's/example/$(adapter)/' $(adapter)/package.json
sed -i 's/Example/$(adapter)/' $(adapter)/README.md
sed -i 's/"workspaces": \[/"workspaces": \[\n "$(adapter)",/' package.json
clean:
rm -rf $(adapter)/dist
deps: clean
# Call the build script for the adapter if defined (TypeScript adapters have this extra build/compile step)
# We use `wsrun` to build workspace dependencies in topological order (TODO: use native `yarn workspaces foreach -pt run build` with Yarn 2)
# TODO: does not work in Docker context
# TODO: --build-arg name=$(name) is not passed to Docker context
# TODO: workspace contained dependencies not passed to Docker context (in case of composite adapters)
# yarn && yarn wsrun -mre -p @chainlink/$(if $(name),$(name),$(adapter)) -t build
yarn --frozen-lockfile --production
build:
# Call the build script for the adapter if defined (TypeScript adapters have this extra build/compile step)
# TODO: calling build directly does not compile workspace contained dependencies (in case of composite adapters)
if [ $$(cat $(adapter)/package.json | grep "^ \"build\":" | wc -l) -ge 1 ]; then yarn --cwd $(adapter) build; fi
yarn ncc build $(adapter) -o $(adapter)/dist
clean-market-closure:
rm -rf market-closure/$(check)/dist
build-market-closure:
cp $(adapter)/adapter.js market-closure/$(check)/priceAdapter.js
cp market-closure/adapter.js market-closure/$(check)
cp -r helpers market-closure/helpers
yarn ncc build market-closure/$(check) -o market-closure/$(check)/dist
rm market-closure/$(check)/priceAdapter.js
rm market-closure/$(check)/adapter.js
docker-market-closure:
docker build --no-cache --build-arg adapter=$(adapter) --build-arg check=$(check) -f Dockerfile-MarketClosure . -t $(adapter)-$(check)-adapter
zip-market-closure: deps clean-market-closure build-market-closure
(cd market-closure/$(check)/dist && zip $(adapter)-$(check)-adapter.zip index.js)
clean-synth-index:
rm -rf synth-index/$(adapter)/dist
build-synth-index:
cp synth-index/adapter.js synth-index/$(adapter)
yarn ncc build synth-index/$(adapter) -o synth-index/$(adapter)/dist
rm synth-index/$(adapter)/adapter.js
docker-synth-index:
docker build --no-cache --build-arg adapter=$(adapter) -f Dockerfile-SynthIndex . -t synth-index-$(adapter)-adapter
zip-synth-index: deps clean-synth-index build-synth-index
(cd synth-index/$(adapter)/dist && zip -r synth-index-$(adapter)-adapter.zip index.js)
clean-2-step:
rm -rf 2-step/$(adapter)
build-2-step:
cp -r $(adapter) 2-step/
mv 2-step/$(adapter)/adapter.js 2-step/$(adapter)/priceAdapter.js
cp 2-step/adapter.js 2-step/$(adapter)
cp -r helpers 2-step/helpers
yarn ncc build 2-step/$(adapter) -o 2-step/$(adapter)/dist
rm 2-step/$(adapter)/priceAdapter.js
rm 2-step/$(adapter)/adapter.js
docker-2-step:
docker build --no-cache --build-arg adapter=$(adapter) -f Dockerfile-2Step . -t $(adapter)-2-step-adapter
zip-2-step: deps clean-2-step build-2-step
(cd 2-step/$(adapter)/dist && zip $(adapter)-2-step-adapter.zip index.js)