-
Notifications
You must be signed in to change notification settings - Fork 15
/
update_azle.sh
executable file
·39 lines (34 loc) · 1.02 KB
/
update_azle.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
#!/bin/bash
# Instructions: Run this script inside of the examples direcotry
# function to check if azle is a dependency in package.json
check_azle_dependency() {
if grep -q "\"azle\":" "$1"; then
return 0
else
return 1
fi
}
updated=0
updated_folders=()
checked=0
# loop through all folders that are not inside node_modules
while IFS= read -r -d '' dir; do
if [[ "$dir" != *"node_modules"* ]] && [[ -f "$dir/package.json" ]]; then
if check_azle_dependency "$dir/package.json"; then
cd "$dir"
npm uninstall azle && npm install https://github.com/demergent-labs/azle
cd - >/dev/null
((updated++))
updated_folders+=("$dir")
fi
((checked++))
echo "Checked $checked packages..."
fi
done < <(find . -type d -print0)
# generate report
if [[ "$updated" -eq 0 ]]; then
echo "No packages with azle dependency found."
else
echo "Updated azle in $updated package(s):"
printf '%s\n' "${updated_folders[@]}"
fi