-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_release.sh
executable file
·52 lines (37 loc) · 1.27 KB
/
build_release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Set option to exit on any error
set -e
# Get Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Source the cargo env
source $HOME/.cargo/env
# Add wasm target
rustup target add wasm32-unknown-unknown
# Get cargo binstall
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
# Get trunk
cargo binstall trunk -y
# Get wasm-opt
cargo binstall wasm-opt -y
# Install tailwindcss and dependencies
npm install -D tailwindcss
npm install @tailwindcss/typography @tailwindcss/forms @tailwindcss/aspect-ratio
# Clean the project
trunk clean
cargo clean
# Get current directory
ROOT_DIR=$(pwd)
# Build the tailwind css file
npx tailwind -o styles/main.css
# First build the submodules
cd $ROOT_DIR/fractal_rust
trunk build --release --no-sri --public-url "/public/project_code/fractal_rust/"
cp -r $ROOT_DIR/fractal_rust/dist/* $ROOT_DIR/src/public/project_code/fractal_rust/
# Then build the main project
cd $ROOT_DIR
trunk build --release --no-sri
# Find all .wasm files in the current directory and subdirectories
find dist/ -name "*.wasm" | while read wasm_file; do
# Execute wasm-opt command on each file
wasm-opt -Oz -o "$wasm_file" "$wasm_file"
done