From 7bf8db0ff232f9bcdbcadbb87d25155bf6da57d1 Mon Sep 17 00:00:00 2001 From: Nezar Abdennur Date: Thu, 16 May 2024 01:36:37 -0400 Subject: [PATCH] Fix demo site (#11) * Update gitignore * Move demo notebook to example dir * Add html and build script for site --- .github/workflows/gh-pages.yml | 5 ++++- .gitignore | 1 + {data => example/data}/eigs.arrow | Bin demo.ipynb => example/demo.ipynb | 0 example/index.html | 15 +++++++++++++++ js/index.ts | 4 +++- package.json | 1 + 7 files changed, 24 insertions(+), 2 deletions(-) rename {data => example/data}/eigs.arrow (100%) rename demo.ipynb => example/demo.ipynb (100%) create mode 100644 example/index.html diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 650bf9f..f0e37d9 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -31,7 +31,10 @@ jobs: run_install: true - name: Build 🔧 - run: pnpm build --base '/eigen-tour/' + run: | + pnpm build-site + cp example/index.html dist + cp example/data/* dist - name: Upload artifact uses: actions/upload-pages-artifact@v1 diff --git a/.gitignore b/.gitignore index 577d7b0..94d75e5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store node_modules/ dist/ __pycache__ diff --git a/data/eigs.arrow b/example/data/eigs.arrow similarity index 100% rename from data/eigs.arrow rename to example/data/eigs.arrow diff --git a/demo.ipynb b/example/demo.ipynb similarity index 100% rename from demo.ipynb rename to example/demo.ipynb diff --git a/example/index.html b/example/index.html new file mode 100644 index 0000000..00c2666 --- /dev/null +++ b/example/index.html @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/js/index.ts b/js/index.ts index 23f8ef1..d2975b5 100644 --- a/js/index.ts +++ b/js/index.ts @@ -3,6 +3,8 @@ import * as utils from "./utils"; import fs from "./shaders/teaser_fragment.glsl"; import vs from "./shaders/teaser_vertex.glsl"; +import "./widget.css"; + async function main() { let canvas = document.querySelector("canvas")!; let { gl, program } = utils.initGL(canvas, fs, vs); @@ -15,7 +17,7 @@ async function main() { { let clearBanner = utils.createLoadingBanner(renderer.overlay.figure); - let res = await fetch(new URL("../data/eigs.arrow", import.meta.url)) + let res = await fetch(new URL("./eigs.arrow", import.meta.url)) await renderer.initData( await res.arrayBuffer(), ["E1", "E2", "E3", "E4", "E5", "E6"], diff --git a/package.json b/package.json index 5d6a4d7..ee30279 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "scripts": { "dev": "npm run build -- --sourcemap=inline --watch", "build": "esbuild js/widget.ts --minify --format=esm --bundle --outdir=src/eigen_tour/static", + "build-site": "esbuild js/index.ts --format=esm --bundle --outdir=dist/", "fmt": "deno fmt --ignore=dist,node_modules --options-use-tabs" }, "author": "Trevor Manz",