generated from AbstractSDK/templates
-
Notifications
You must be signed in to change notification settings - Fork 3
/
justfile
152 lines (116 loc) · 3.88 KB
/
justfile
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
145
146
147
148
149
150
151
152
# Install the tools that are used in this justfile
install-tools:
cargo install cargo-nextest --locked || true
cargo install taplo-cli --locked || true
cargo install cargo-watch || true
cargo install cargo-limit || true
## Development Helpers ##
# Build everything
build:
cargo build --all-features
# Test everything
test:
cargo nextest run
watch-test:
cargo watch -x "nextest run"
# Format your code and `Cargo.toml` files
fmt:
cargo fmt --all
find . -type f -iname "*.toml" -print0 | xargs -0 taplo format
lint:
cargo clippy --all -- -D warnings
lintfix:
cargo clippy --fix --allow-staged --allow-dirty --all-features
just fmt
watch:
cargo watch -x "lcheck --all-features"
check:
cargo check --all-features
juno-local:
docker kill juno_node_1 || true
docker volume rm -f junod_data || true
docker run --rm -d \
--name juno_node_1 \
-p 1317:1317 \
-p 26656:26656 \
-p 26657:26657 \
-p 9090:9090 \
-e STAKE_TOKEN=ujunox \
-e UNSAFE_CORS=true \
--mount type=volume,source=junod_data,target=/root \
ghcr.io/cosmoscontracts/juno:15.0.0 \
./setup_and_run.sh juno16g2rahf5846rxzp3fwlswy08fz8ccuwk03k57y # You can add used sender addresses here
wasm:
#!/usr/bin/env bash
rm -rf ./artifacts/*.wasm
if [[ $(arch) == "arm64" ]]; then
image="cosmwasm/optimizer-arm64"
else
image="cosmwasm/optimizer"
fi
# Optimized builds
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
${image}:0.16.0
# wasm fast
wasm-f:
#!/usr/bin/env bash
cargo cw-optimizoor
# Remove architecture postfix
for file in ./artifacts/*-*.wasm
do
mv "$file" "${file%-*.wasm}.wasm" 2> /dev/null
done
## Frontend Helpers ##
# Generate the typescript client for the app contract
ts-codegen: schema
(cd packages/typescript && npm install && npm run codegen)
# Generate the schemas for the app contract
schema:
cargo schema
# Generate the schemas for this app and publish them to the schemas repository for access in the Abstract frontend
publish-schemas namespace name version: schema
#!/usr/bin/env bash
set -euxo pipefail
# Pre-run check for 'gh' CLI tool
if ! command -v gh &> /dev/null; then \
echo "'gh' could not be found. Please install GitHub CLI."; exit; \
fi
# check that the metadata exists
if [ ! -e "./metadata.json" ]; then \
echo "Please create metadata.json for module metadata"; exit; \
fi
tmp_dir="$(mktemp -d)"
schema_out_dir="$tmp_dir/{{namespace}}/{{name}}/{{version}}"
metadata_out_dir="$tmp_dir/{{namespace}}/{{name}}"
# Clone the repository to the temporary directory
git clone https://github.com/AbstractSDK/schemas "$tmp_dir"
# Create target directory structure and copy schemas
mkdir -p "$schema_out_dir"
cp -a "./schema/." "$schema_out_dir"
# Copy metadata.json to the target directory
cp "./metadata.json" "$metadata_out_dir"
# Create a new branch with a name based on the inputs
cd "$tmp_dir"
git checkout -b '{{namespace}}/{{name}}/{{version}}'
# Stage all new and changed files for commit
git add .
# Commit the changes with a message
git commit -m 'Add schemas for {{namespace}} {{name}} {{version}}'
# Create a pull request using 'gh' CLI tool
gh pr create --title 'Add schemas for {{namespace}} {{name}} {{version}}' --body ""
## Exection commands ##
run-script script +CHAINS:
cargo run --example {{script}} -- --network-ids {{CHAINS}}
deploy +CHAINS:
just run-script deploy {{CHAINS}}
# Serve docs locally, pass --open to open in browser
docs-serve *FLAGS:
(cd docs && mdbook serve {{FLAGS}})
docs-build:
(cd docs && mdbook build)
docs-install:
cargo install mdbook --vers "0.4.21" --locked
cargo install mdbook-mermaid --vers "0.12.6" --locked
cargo install mdbook-admonish --vers "1.9.0" --locked