Skip to content

Commit f26ebeb

Browse files
Update build_map.sh
1 parent 7c7a2e8 commit f26ebeb

File tree

1 file changed

+49
-11
lines changed

1 file changed

+49
-11
lines changed

src/build_map.sh

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,36 +31,74 @@ echo "$(cat $GITHUB_ACTION_PATH/src/buildManifest_start.js)" > deploy/_just/stat
3131
echo -e "\n----------------\n\nBuild Map:\n"
3232
FILE_ID=1
3333
TOTAL_FILES=$(find deploy -mindepth 1 -print | wc -l)
34+
TOTAL_SIZE=0
3435
find deploy -mindepth 1 -print | while read -r path; do
3536
relative_path=${path#deploy/}
36-
37-
if [ "$FILE_ID" -eq 1 ]; then
38-
echo "$relative_path"
39-
elif [ "$FILE_ID" -eq "$TOTAL_FILES" ]; then
40-
echo -e "$relative_path\n"
41-
else
42-
echo "$relative_path"
43-
fi
4437

4538
if [ -f "$path" ]; then
4639
case "${path##*.}" in
4740
html) type="HTML" ;;
41+
php) type="PHP" ;;
4842
css) type="CSS" ;;
4943
js) type="JavaScript" ;;
44+
json) type="JSON" ;;
5045
txt) type="Text" ;;
46+
xml) type="XML" ;;
47+
webmanifest) type="Webmanifest" ;;
48+
5149
png) type="Image/Png" ;;
52-
svg) type="Image/Svg" ;;
50+
svg) type="Image/SVG" ;;
5351
jpeg|jpg) type="Image/Jpeg" ;;
52+
webp) type="Image/Webp" ;;
53+
bmp) type="Image/Bmp" ;;
54+
gif) type="Image/GIF" ;;
55+
heic) type="Image/HEIC" ;;
56+
ico) type="Favicon" ;;
57+
58+
mp4) type="Video/MP4" ;;
59+
mov) type="Video/Mov" ;;
60+
webm) type="Video/Webm" ;;
61+
62+
otf) type="Font/OTF" ;;
63+
woff) type="Font/WOFF" ;;
64+
woff2) type="Font/WOFF2" ;;
65+
66+
m4a) type="Audio/M4A" ;;
67+
mp2) type="Audio/MP2" ;;
68+
mp3) type="Audio/MP3" ;;
69+
ogg) type="Audio/OGG" ;;
70+
wav) type="Audio/WAV" ;;
71+
wma) type="Audio/WMA" ;;
72+
73+
7z) type="Archive/7z" ;;
74+
tar) type="Archive/TAR" ;;
75+
rar) type="Archive/RAR" ;;
76+
zip) type="Archive/ZIP" ;;
77+
5478
*) type="Other" ;;
5579
esac
56-
echo " _just_buildManifest.push({\"type\": \"$type\", \"path\": \"$relative_path\"});" >> deploy/_just/static/$BUILD_ID/buildManifest.js
80+
file_size=$(stat -c%s "$path")
81+
TOTAL_SIZE=$((TOTAL_SIZE + $file_size))
82+
if [ "$FILE_ID" -eq 1 ]; then
83+
printf "┌ %3d B | %s\n" "$file_size" "$relative_path"
84+
elif [ "$FILE_ID" -eq "$TOTAL_FILES" ]; then
85+
printf "└ %3d B | %s\n" "$file_size" "$relative_path"
86+
else
87+
printf "├ %3d B | %s\n" "$file_size" "$relative_path"
88+
fi
89+
echo " _just_buildManifest.push({\"type\": \"$type\", \"path\": \"$relative_path\", \"size\": $file_size});" >> deploy/_just/static/$BUILD_ID/buildManifest.js
5790
fi
5891

5992
FILE_ID=$((FILE_ID + 1))
6093
done
61-
echo -e "End Build Map\n"
94+
95+
manifest_size=$(stat -c%s "deploy/_just/static/$BUILD_ID/buildManifest.js")
96+
echo -e "End Build Map\n\n"
97+
echo -e "_just/static/$BUILD_ID/buildManifest.js size: $manifest_size bytes\n"
98+
echo -e " Total build size: $TOTAL_SIZE bytes\n\n"
6299
echo -e "----------------\n"
63100
echo "$(cat $GITHUB_ACTION_PATH/src/buildManifest_end.js)" >> deploy/_just/static/$BUILD_ID/buildManifest.js
101+
64102
# Override Deployment
65103
for html_file in deploy/*.html; do
66104
echo "<script src=\"_just/static/$BUILD_ID/buildManifest.js\"></script>" >> "$html_file"

0 commit comments

Comments
 (0)