From 33a9e729604365f3d812a4364733d594a5bd9320 Mon Sep 17 00:00:00 2001 From: Vanessa Freudenberg Date: Sun, 17 Mar 2024 21:24:04 -0700 Subject: [PATCH] [examples/physics] add demo for using jsdelivr instead of a bundler --- examples/physics/jsdelivr.html | 27 +++++++++++++++++++++++++++ examples/physics/package.json | 3 ++- examples/physics/src/Views.js | 2 +- scripts/build-pages.sh | 1 + 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 examples/physics/jsdelivr.html diff --git a/examples/physics/jsdelivr.html b/examples/physics/jsdelivr.html new file mode 100644 index 00000000..e32add9d --- /dev/null +++ b/examples/physics/jsdelivr.html @@ -0,0 +1,27 @@ + + + Worldcore Physics + + + + + + + + + + diff --git a/examples/physics/package.json b/examples/physics/package.json index 4702c180..d269d479 100644 --- a/examples/physics/package.json +++ b/examples/physics/package.json @@ -5,7 +5,8 @@ "private": true, "scripts": { "start": "webpack serve --no-live-reload --no-hot --mode development --devtool source-map", - "build": "webpack --mode production" + "build": "webpack --mode production", + "post-build": "cp -v jsdelivr.html dist/" }, "author": "Croquet Corporation", "license": "Apache-2.0", diff --git a/examples/physics/src/Views.js b/examples/physics/src/Views.js index 6eadd9b6..6dd85277 100644 --- a/examples/physics/src/Views.js +++ b/examples/physics/src/Views.js @@ -1,7 +1,7 @@ // Views import { ViewRoot, Pawn, mix, InputManager, PM_ThreeVisible, ThreeRenderManager, PM_Spatial, THREE, PM_Smoothed, toRad, m4_rotation, m4_multiply, - WidgetManager2, Widget2, ButtonWidget2, TAU, m4_translation, v3_transform, ThreeInstanceManager, + Widget2, ButtonWidget2, TAU, m4_translation, v3_transform, ThreeInstanceManager, PM_ThreeInstanced, ViewService } from "@croquet/worldcore"; diff --git a/scripts/build-pages.sh b/scripts/build-pages.sh index 1e5fee28..18367a0a 100755 --- a/scripts/build-pages.sh +++ b/scripts/build-pages.sh @@ -27,6 +27,7 @@ for DIR in tutorials examples ; do echo "Commit: $COMMIT" > build.log npm run build >> build.log 2>&1 BUILD_ERROR=$? + npm run post-build --if-present >> build.log 2>&1 cat build.log DATE=$(git ls-tree -r --name-only HEAD -- . | grep -v 'package.*json' | xargs -n 1 git log -1 --format='%ad' --date=format:'%Y-%m-%d' | sort | tail -1) if [ $BUILD_ERROR -eq 0 ] ; then