46 lines
1.1 KiB
Bash
Executable File
46 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
echo "This script will remove / overwrite the content of some \"dist/\" directories."
|
|
read -p "Do you want to continue ? [y/N]: " -n 1 -r
|
|
echo
|
|
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
|
then
|
|
echo "Aborted"
|
|
exit 1
|
|
fi
|
|
|
|
function clean {
|
|
rm -rf ./frontend/dist && rm -rf ./backend/dist && rm -rf ./dist
|
|
}
|
|
|
|
function build_frontend {
|
|
dir=$(pwd)
|
|
cd frontend
|
|
npm run build
|
|
cd "$dir"
|
|
}
|
|
|
|
function build_backend {
|
|
deno run --allow-read=./frontend/dist,./dist --allow-write=./dist ./bundle.ts ./frontend/dist ./dist/bundled-view-files.json
|
|
cp ./dist/bundled-view-files.json ./backend/src/modules/view/bundled-view-files.json
|
|
}
|
|
|
|
function compile_for {
|
|
target=$1
|
|
mkdir -p "./dist/bin"
|
|
deno compile --target "$target" --output "./dist/bin/$target" --allow-net --allow-read --allow-write --allow-sys ./backend/src/main.ts
|
|
}
|
|
|
|
function compile_all {
|
|
compile_for x86_64-unknown-linux-gnu
|
|
compile_for aarch64-unknown-linux-gnu
|
|
compile_for x86_64-pc-windows-msvc
|
|
compile_for x86_64-apple-darwin
|
|
compile_for aarch64-apple-darwin
|
|
}
|
|
|
|
|
|
clean
|
|
build_frontend
|
|
build_backend
|
|
compile_all |