initial commit
This commit is contained in:
46
build.sh
Executable file
46
build.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user