v2rayA/build.sh
高渐离 5d1670c4bc optimize: 使用预压缩的前端文件以节省体积 (#390)
* try to use gziped asset

* optimize: use pre-compressed asset files

* fix: add powershell compress
2022-01-25 15:10:37 +08:00

21 lines
779 B
Bash
Executable File

#!/bin/bash
set -ex
CWD="$(pwd)"
SHELL_FOLDER="$(dirname $(realpath $0))"
if [ -d "$SHELL_FOLDER/.git" ]; then
date=$(git -C "$SHELL_FOLDER" log -1 --format="%cd" --date=short | sed s/-//g)
count=$(git -C "$SHELL_FOLDER" rev-list --count HEAD)
commit=$(git -C "$SHELL_FOLDER" rev-parse --short HEAD)
version="unstable-$date.r${count}.$commit"
else
version="unstable"
fi
cd "$SHELL_FOLDER"/gui && yarn && OUTPUT_DIR="$SHELL_FOLDER"/service/server/router/web yarn build
for file in $(find "$SHELL_FOLDER"/service/server/router/web |grep -v png |grep -v index.html|grep -v .gz)
do
if [ ! -d $file ];then
gzip -9 $file
fi
done
cd "$SHELL_FOLDER"/service && CGO_ENABLED=0 go build -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$CWD"/v2raya