-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
64 lines (48 loc) · 1.37 KB
/
build.sh
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
# Execution script for the project
#!/bin/sh
# Installing python dependencies:
pip3 install typer
pip3 install PyInquirer
pip3 install rich
pip3 install cli-box
pip3 install aptos-sdk
update_env() {
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "s/^$1=.*/$1=$2/" .env
else
sed -i "s/^$1=.*/$1=$2/" .env
fi
}
# Installing backend dependencies:
cd transaction-api
DEFAULT_VALUE="0x3b75f8a62a431bbb47f6f8341732b613f0187cbf799b5499c85194365551c0a2"
read -p "Enter the address of the account you want to use for the transaction (or press Enter for default):" module
if [ -z "$module" ]; then
module=$DEFAULT_VALUE
fi
test -e .env || echo > .env
echo "MODULE_ADDRESS=$module" >> .env
read -p "Enter the PriavteKey:" privateKey
echo "PRIVATE_KEY=$privateKey" >> .env
echo "Updated .env file with PRIVATE_KEY=$privateKey"
cd ..
# Installing frontend dependencies:
cd frontend
yarn
# env variables input
read -p "Enter the new value (or press Enter for default): " value
if [ -z "$value" ]; then
value=$DEFAULT_VALUE
fi
update_env "VITE_APP_MODULE_ADDRESS" "$value"
echo "Updated .env file with VITE_APP_MODULE_ADDRESS=$value"
# check if user wants to open the dapp
echo "Do you want to run dapp (yes/no)"?
read varname
if [ $varname == 'yes' ]; then
echo "running dapp"
yarn dev
else
cd ..
echo "To run the dapp: cd frontend && yarn dev"
fi