-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_release.sh
More file actions
executable file
·59 lines (44 loc) · 1.7 KB
/
Copy pathbuild_release.sh
File metadata and controls
executable file
·59 lines (44 loc) · 1.7 KB
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
52
53
54
55
56
57
58
#!/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-pack # not up to date
# Get latest wasm-opt (Binaryen) locally, since crates.io version is outdated
WASM_OPT_VERSION=version_124
curl -L -o binaryen.tar.gz "https://github.com/WebAssembly/binaryen/releases/download/${WASM_OPT_VERSION}/binaryen-${WASM_OPT_VERSION}-x86_64-linux.tar.gz"
tar -xzf binaryen.tar.gz
mv binaryen-${WASM_OPT_VERSION}/bin/wasm-opt ./wasm-opt
chmod +x ./wasm-opt
export PATH="$(pwd):$PATH"
# Install tailwindcss and dependencies
npm install -D tailwindcss @tailwindcss/cli
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 @tailwindcss/cli -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