From d504a5ec78a2995c38c2f8bc7e58b1796f91c851 Mon Sep 17 00:00:00 2001 From: Noeri Huisman <8823461+mrxz@users.noreply.github.com> Date: Wed, 20 May 2026 14:07:04 +0200 Subject: [PATCH 1/2] Add build:wasm command to README instructions and check spark(-worker)-rs presence --- README.md | 4 +++- package.json | 1 - vite.config.ts | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ff339943..77c7d596 100644 --- a/README.md +++ b/README.md @@ -113,9 +113,10 @@ Install [Rust](https://www.rust-lang.org/tools/install) if it's not already inst Next, build Spark by running: ``` npm install +npm run build:wasm npm run build ``` -This will first build the Rust Wasm component (can be invoked via `npm run build:wasm`), then Spark itself (`npm run build`). +This will first build the Rust Wasm component (`npm run build:wasm`), then Spark itself (`npm run build`). The examples fetch assets from a remote URL. This step is optional, but offline development and faster loading times are possible if you download and cache the assets files locally with the following command: ``` @@ -136,6 +137,7 @@ First try cleaning all the build files and re-building everything: ``` npm run clean npm install +npm run build:wasm npm run build ``` diff --git a/package.json b/package.json index 814beb5a..7c461bf6 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,6 @@ "lint": "biome check .", "lint:fix": "biome check . --fix", "lint:summary": "biome check --reporter=summary", - "prepare": "npm run build:wasm", "site:build:relativeurls": "npm run build && npm run site:clean && node scripts/copy-site-files.js && mkdocs build && node scripts/rename-assets-to-static.js && node scripts/replace-urls.js", "site:build": "npm run build && npm run site:clean && node scripts/copy-site-files.js && mkdocs build && node scripts/rename-assets-to-static.js", "site:clean": "node scripts/clean-site-files.js && node scripts/clean-site.js", diff --git a/vite.config.ts b/vite.config.ts index 55ff9fd6..062763ff 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -49,6 +49,26 @@ function fixWasmDataUrl(): Plugin { }; } +const sparkRsDirectory = "rust/spark-rs/pkg"; +const sparkWorkerRsDirectory = "rust/spark-worker-rs/pkg"; +if ( + ![sparkRsDirectory, sparkWorkerRsDirectory].every((dir) => fs.existsSync(dir)) +) { + console.error( + "\x1b[31m************************************************************************\x1b[0m", + ); + console.error( + "\x1b[31m Rust Wasm components not found, make sure to build them first.\x1b[0m", + ); + console.error( + "\x1b[31m Install Rust and run:\x1b[1m npm run build:wasm\x1b[0m", + ); + console.error( + "\x1b[31m************************************************************************\x1b[0m", + ); + process.exit(1); +} + const assetsDirectory = "examples/assets"; const localAssetsDirectoryExist = fs.existsSync(assetsDirectory); if (!localAssetsDirectoryExist) { From 5ee936226b0f9a4248353cdbc79e1a0d24b0ef56 Mon Sep 17 00:00:00 2001 From: Noeri Huisman <8823461+mrxz@users.noreply.github.com> Date: Wed, 20 May 2026 14:07:26 +0200 Subject: [PATCH 2/2] Exclude entire rust directory from biome --- biome.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/biome.json b/biome.json index 5cf84944..28c30a89 100644 --- a/biome.json +++ b/biome.json @@ -12,11 +12,7 @@ "examples/assets/", "examples/showcase/hello-gsplat", "examples/js", - "rust/target", - "rust/javascript", - "rust/spark-worker-rs/pkg", - "rust/spark-rs/pkg", - "src/vrButton.ts", + "rust", "site", "site-repo", "docs",