File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343 - name : Build WASM app
4444 run : |
4545 rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
46- export RUSTUP_TOOLCHAIN=nightly
47- wasm-pack build --out-dir www/pkg --target web --release --no-default-features --features "wasm-draw"
48- wasm-opt -O3 --enable-bulk-memory --enable-nontrapping-float-to-int -o www/pkg/kalc_plot_bg.wasm www/pkg/kalc_plot_bg.wasm
46+ cd www
47+ bash start.sh
4948
5049 - name : Copy site files to output
5150 run : |
Original file line number Diff line number Diff line change 11/target
22/www /pkg /
33/bin
4- /www /node_modules
5- /www /dist
4+ /www /index.html
Original file line number Diff line number Diff line change 11const canvas = document . getElementById ( 'canvas' ) ;
22const ctx = canvas . getContext ( "2d" , { desynchronized : true , alpha : false } ) ;
3+ ctx . font = "18px monospace" ;
34export function draw ( slice , width ) {
45 const clamped = new Uint8ClampedArray ( slice ) ;
56 const height = clamped . length / ( width * 4 ) ;
Original file line number Diff line number Diff line change 11<!DOCTYPE html>
22<html>
33 <head>
4+ <link rel="modulepreload" href="pkg/kalc_plot.js">
5+ <link rel="modulepreload" href="pkg/snippets/@@KALC@@/window.js">
6+ <link rel="modulepreload" href="pkg/snippets/@@RUPL@@/painter.js">
7+ <link rel="preload" href="favicon.ico" as="image">
8+ <link rel="preload" href="pkg/kalc_plot_bg.wasm" as="fetch" type="application/wasm" crossorigin>
49 <meta charset="utf-8">
510 <title>kalc plot</title>
611 <style>
Original file line number Diff line number Diff line change 1+ set -e
2+ set -x
3+ export RUSTUP_TOOLCHAIN=nightly
4+ wasm-pack build --out-dir www/pkg --target web --release --no-default-features --features " wasm-draw"
5+ wasm-opt -O3 --enable-bulk-memory --enable-nontrapping-float-to-int -o pkg/kalc_plot_bg.wasm pkg/kalc_plot_bg.wasm
6+ cp index index.html
7+ sed -i " s/@@KALC@@/$( ls --color=never -d ./pkg/snippets/kalc-plot-* | sed ' s@.*/@@' ) /" index.html
8+ sed -i " s/@@RUPL@@/$( ls --color=never -d ./pkg/snippets/rupl-* | sed ' s@.*/@@' ) /" index.html
9+ if [ $# -ne 0 ]; then
10+ python3 -m http.server 8080
11+ fi
You can’t perform that action at this time.
0 commit comments