-
Notifications
You must be signed in to change notification settings - Fork 2
/
build_all_sm.sh
executable file
·62 lines (48 loc) · 1.59 KB
/
build_all_sm.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
# Capture the start time
start_time=$(date +%s)
# Source the utils script
source ./superstake-ui/scripts/utils.sh
# Function to handle repetitive tasks
function handle_directory() {
dir=$1
build=$2
link_packages=$3
link=$4
print_message_local "build_all_sm.sh" "Installing $dir"
cd $dir && rm -rf node_modules && bun install
for link_package in ${link_packages[@]}
do
print_message_local "build_all_sm.sh" "bun link for ${folder} -> ${link_package}"
bun link ${link_package}
done
if [ "$build" = true ] ; then
yarn build
fi
if [ "$link" = true ] ; then
bun link
fi
cd - &> /dev/null
}
function get_submodules() {
git submodule update --init
}
# Capture the start time
start_time=$(date +%s)
# Get all submodules - will skip if already present
# get_submodules # current directory submodules
# cd drift-common
# get_submodules # Drift SDK submodule
# cd ..
# Call the function with directory name, build and link flags
handle_directory "." false "" false
handle_directory "drift-common" false "" false
handle_directory "drift-common/protocol/sdk" true "" true
handle_directory "drift-common/common-ts" true "@drift-labs/sdk" true
handle_directory "drift-common/icons" true "" true
handle_directory "drift-common/react" true "@drift-labs/sdk @drift/common @drift-labs/icons" true
handle_directory "superstake-ui" true "@drift-labs/sdk @drift/common @drift-labs/icons @drift-labs/react" false
# Capture the end time
end_time=$(date +%s)
# Calculate and print the duration
duration=$((end_time - start_time))
echo "FINISHED .. Total time taken: $duration seconds"