Skip to content

Commit 7fb31b4

Browse files
committed
render in gh-pages
1 parent c2dcacb commit 7fb31b4

File tree

6 files changed

+25
-9
lines changed

6 files changed

+25
-9
lines changed

.github/workflows/deploy.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,24 @@ jobs:
2424
- name: Install wasm-pack
2525
run: |
2626
curl https://drager.github.io/wasm-pack/installer/init.sh -sSf | bash
27-
# cargo install wasm-pack
2827
2928
- name: Build WASM
30-
run: wasm-pack build --target web
29+
run: wasm-pack build --target web --no-pack --no-opt
30+
31+
- uses: actions/setup-node@v6
32+
with:
33+
node-version: 20
34+
35+
- name: Install npm dependencies and build
36+
run: |
37+
cp ../wasm/* .
38+
npm install
39+
npm run build
40+
working-directory: ./pkg
3141

3242
- name: Deploy to gh-pages
3343
uses: peaceiris/actions-gh-pages@v4
3444
with:
3545
github_token: ${{ secrets.GITHUB_TOKEN }}
36-
publish_dir: ./pkg
46+
publish_dir: ./pkg/dist
3747
keep_files: false

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use wasm_bindgen::prelude::*;
1616

1717
/// Entry point for WASM
1818
#[cfg(target_arch = "wasm32")]
19-
#[wasm_bindgen(start)]
19+
#[wasm_bindgen]
2020
pub fn start() {
2121
run_app();
2222
}

wasm/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
5-
<title>Bevy WASM Test</title>
5+
<title>vizmat - Bevy WASM Test</title>
66
<style>body { margin: 0; overflow: hidden; }</style>
77
</head>
88
<body>
99
<canvas id="bevy-canvas"></canvas>
10-
<script type="module" src="./test.js"></script>
10+
<script type="module" src="./index.js"></script>
1111
</body>
1212
</html>

wasm/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import init, { start } from "./vizmat.js";
2+
3+
async function main() {
4+
await init();
5+
start();
6+
}
7+
8+
main();
File renamed without changes.

wasm/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,12 @@
3030
"material",
3131
"molecule"
3232
],
33-
"dependencies": {
34-
"vizmat": "file:vizmat-0.1.0.tgz"
35-
},
3633
"devDependencies": {
3734
"vite": "^5.0.0",
3835
"vite-plugin-wasm": "3.5.0"
3936
},
4037
"scripts": {
38+
"build": "vite build",
4139
"dev": "vite"
4240
}
4341
}

0 commit comments

Comments
 (0)