Last active
January 12, 2022 09:13
-
-
Save iinfin/e26b453623620698415dc7b248cb8f35 to your computer and use it in GitHub Desktop.
netlify rust installation for web projects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # curl https://gist_raw_url -sSLf | bash | |
| set -e | |
| cweb_version=0.6.26 | |
| cweb=https://github.com/koute/cargo-web/releases/download/$cweb_version/cargo-web-x86_64-unknown-linux-gnu.gz | |
| curl -Lo cargo-web.gz $cweb | |
| gunzip cargo-web.gz | |
| chmod u+x cargo-web | |
| binaryen_version=version_104 | |
| binaryen=https://github.com/WebAssembly/binaryen/releases/download/$binaryen_version/binaryen-$binaryen_version-x86_64-linux.tar.gz | |
| curl -Lo binaryen.tar.gz $binaryen | |
| tar -xzf binaryen.tar.gz | |
| curl https://sh.rustup.rs -sSf | sh -s - --default-toolchain nightly -y | |
| source ~/.cargo/env | |
| rustup target add wasm32-unknown-unknown | |
| ./cargo-web deploy --target=wasm32-unknown-unknown --release | |
| shopt -s nullglob | |
| for filename in ./target/deploy/*.wasm | |
| do | |
| ./binaryen-$binaryen_version/wasm-opt -Oz -d -o $filename $filename 2> /dev/null | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment