Skip to content

Commit

Permalink
Made web builds work again!
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeicor committed Aug 12, 2023
1 parent f3abd39 commit 38596de
Show file tree
Hide file tree
Showing 12 changed files with 538 additions and 660 deletions.
9 changes: 6 additions & 3 deletions .github/scripts/release-wasm-post.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@

#!/usr/bin/env bash

set -ex

# This script takes the generated .wasm and preparse it for the release.
wasm_file="$1"
dirname="$(dirname "$wasm_file")"
mkdir -p "$dirname"
cd "$dirname"
wasm_file="$(basename "$wasm_file")"

cat >index.html <<EOF
<!DOCTYPE html>
<html lang="en">
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
Expand All @@ -29,11 +32,11 @@ cat >index.html <<EOF
SDFViewer.default().then( // Async initialization
() => SDFViewer.run_app("sdf-viewer")); // Run the actual App
// Start a toggleable web console for mobile devices only (to help with debugging)
// Start a toggleable web console for mobile devices only (to help with debugging)
if (/Mobi|Android/i.test(navigator.userAgent)) {
var src = '//cdn.jsdelivr.net/npm/eruda';
document.write('<scr' + 'ipt src="' + src + '"></scr' + 'ipt>');
document.write('<scr' + 'ipt>eruda.init();</scr' + 'ipt>');
document.write('<scr' + 'ipt src="' + src + '"></scr' + 'ipt>');
document.write('<scr' + 'ipt>eruda.init();</scr' + 'ipt>');
}
</script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
target: wasm32-unknown-unknown
ext: tar.gz # After post-processing
pre: rustup target add wasm32-unknown-unknown && curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
build: wasm-pack build --target web --out-dir ./target/pkg -- --no-default-features --features "app meshers web"
build: wasm-pack build --target web --out-dir ./target/pkg -- --no-default-features --features default-wasm
post: ".github/scripts/release-wasm-post.sh ./target/pkg/${GITHUB_REPOSITORY#*/}.wasm"
# TODO: Android
# - os: ubuntu-latest
Expand Down
Loading

0 comments on commit 38596de

Please sign in to comment.