Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
```
Expand All @@ -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
```

Expand Down
6 changes: 1 addition & 5 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
20 changes: 20 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading