1
0
Fork 1
mirror of https://github.com/0x2E/fusion.git synced 2025-06-09 17:44:56 +09:00
fusion/scripts.sh
2024-03-06 23:18:46 +08:00

35 lines
494 B
Bash
Executable file

#!/bin/sh
build() {
root=$(pwd)
rm -r ./build
echo "building frontend"
cd ./frontend && npm i && npm run build || exit 1
cd $root || exit 1
echo "building backend"
cp .env build/
go build -o ./build/fusion ./cmd/server/* || exit 1
}
gen() {
go generate ./...
}
test_go() {
gen || exit 1
# make some files for embed
mkdir -p ./frontend/build && touch ./frontend/build/index.html || exit 1
go test ./...
}
case $1 in
"test")
test_go
;;
"gen")
gen
;;
"build")
build
;;
esac