-
Notifications
You must be signed in to change notification settings - Fork 28
/
Makefile
55 lines (42 loc) · 1.48 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
.PHONY: init candid build local cap-local start-replica stop-replica test format lint clean dfx-clean
LOCAL_CUSTODIAN_PRINCIPAL = $(shell dfx identity get-principal)
TEST_CUSTODIAN_PRINCIPAL = $(shell cat test/custodian-test-principal)
CAP_ID ?= $(shell dfx canister id cap-router)
cap-local:
# Verifying cap... $(shell [ -z "$(CAP_ID)" ] && dfx deploy cap-router)
@echo "cap local canister id: $(CAP_ID)"
init:
git submodule update --init --recursive
npm --prefix test i
cargo check
candid:
cargo run > nft.did
didc bind -t ts nft.did > test/factory/idl.d.ts
echo "// @ts-nocheck" > test/factory/idl.ts
didc bind -t js nft.did >> test/factory/idl.ts
build: candid start-replica
dfx canister create nft
dfx build nft
local: build cap-local
dfx deploy nft --argument '(opt record{custodians=opt vec{principal"$(LOCAL_CUSTODIAN_PRINCIPAL)"}; cap=opt principal"$(CAP_ID)"})'
start-replica:
dfx ping local || dfx start --clean --background
stop-replica:
dfx stop
test: clean-dfx build cap-local
dfx canister install nft --argument '(opt record{custodians=opt vec{principal"$(TEST_CUSTODIAN_PRINCIPAL)"}; cap=opt principal"$(CAP_ID)"})'
npm --prefix test t
dfx stop
format:
npm --prefix test run prettier
npm --prefix test run lint
cargo fmt --all
lint:
npm --prefix test run prebuild
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings -D clippy::all
clean: clean-dfx
cargo clean
npm --prefix test run clean
clean-dfx: stop-replica
rm -rf .dfx cap/.dfx