refactor project structure

This commit is contained in:
Aiden McClelland
2025-12-20 02:55:49 -07:00
parent 7c12b58bb5
commit e859c1adb1
382 changed files with 671 additions and 3952 deletions

31
web/compress-uis.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
cd "$(dirname "${BASH_SOURCE[0]}")"
set -e
STATIC_DIR=dist/static/$1
RAW_DIR=dist/raw/$1
mkdir -p $STATIC_DIR
rm -rf $STATIC_DIR
if ! [[ "$ENVIRONMENT" =~ (^|-)dev($|-) ]]; then
find $RAW_DIR -type f -not -name '*.gz' -and -not -name '*.br' | xargs -n 1 -P 0 gzip -kf
find $RAW_DIR -type f -not -name '*.gz' -and -not -name '*.br' | xargs -n 1 -P 0 brotli -kf
for file in $(find $RAW_DIR -type f -not -name '*.gz' -and -not -name '*.br'); do
raw_size=$(du $file | awk '{print $1 * 512}')
gz_size=$(du $file.gz | awk '{print $1 * 512}')
br_size=$(du $file.br | awk '{print $1 * 512}')
if [ $((gz_size * 100 / raw_size)) -gt 70 ]; then
rm $file.gz
fi
if [ $((br_size * 100 / raw_size)) -gt 70 ]; then
rm $file.br
fi
done
fi
cp -r $RAW_DIR $STATIC_DIR