-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·53 lines (41 loc) · 1.27 KB
/
build.sh
File metadata and controls
executable file
·53 lines (41 loc) · 1.27 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
#!/bin/bash
set -e
echo "=== Starting Rust/WASM build process ==="
# Install Rust if not present
if ! command -v rustc &> /dev/null; then
echo "Installing Rust..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
source $HOME/.cargo/env
fi
# Ensure we're using the environment
source $HOME/.cargo/env
export PATH="$HOME/.cargo/bin:$PATH"
# Install wasm-pack if not present
if ! command -v wasm-pack &> /dev/null; then
echo "Installing wasm-pack..."
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
fi
# Add wasm32 target
echo "Adding wasm32-unknown-unknown target..."
rustup target add wasm32-unknown-unknown
# Set nightly as default
echo "Setting nightly toolchain..."
rustup default nightly
# Display versions
echo "Rust version:"
rustc --version
echo "wasm-pack version:"
wasm-pack --version
# Build WASM package
echo "Building WASM package..."
wasm-pack build --target web --out-dir pkg --release
echo "Build completed successfully"
ls -la pkg/
# Prepare deployment files
echo "Preparing deployment files..."
mkdir -p deploy
cp www/* deploy/ 2>/dev/null || echo "No www directory found"
cp -r pkg deploy/
echo "Files prepared for deployment:"
ls -la deploy/
echo "=== Build process complete ==="