Skip to content

Commit 2b4874c

Browse files
jspanchujourdain
authored andcommitted
feat: Create vtk-wasm JavaScript project
- Updated package.json to define project metadata and dependencies. - Added remote.js for managing remote sessions and state handling. - Introduced standalone.js for creating VTK objects and handling properties. - Created viewer.js for loading and displaying VTK data. - Added wasmLoader.js for loading and managing the VTK WASM library. - Configured Vite build setups for different output formats (ESM and UMD).
1 parent ea1e523 commit 2b4874c

17 files changed

+4271
-710
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Publish @kitware/vtk-wasm to npmjs
2+
on:
3+
push:
4+
branches: [master]
5+
jobs:
6+
build:
7+
permissions:
8+
id-token: write
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
# Setup .npmrc file to publish to npm
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: "24.x"
16+
registry-url: "https://registry.npmjs.org"
17+
- name: Install dependencies
18+
run: npm ci
19+
- name: Build library
20+
run: npm run build
21+
- name: Publish library
22+
run: npm publish --provenance --access public
23+
env:
24+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/website.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ jobs:
6060
steps:
6161
- name: Deploy to GitHub Pages
6262
id: deployment
63-
uses: actions/deploy-pages@v4
63+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ docs/.vitepress/dist
33
docs/.vitepress/cache
44
examples/cpp/vtk
55
examples/cpp/*/build
6+
dist

.prettierrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
11
# vtk-wasm
22

3-
Guides and documentation for VTK.wasm
3+
## Project Structure and Build Scripts
4+
5+
This repository provides the infrastructure to bundle the pure JavaScript library for loading VTK.wasm.
6+
7+
### File Structure
8+
9+
- `src/` — Source code for the library.
10+
- `dist/` — Bundled output files.
11+
- `wasm/` — WebAssembly binaries and related assets.
12+
- `scripts/` — Utility scripts for building and packaging.
13+
- `README.md` — Project documentation.
14+
- `package.json` — Project metadata and build scripts.
15+
16+
### Build Scripts
17+
18+
The following scripts are available in `package.json`:
19+
20+
- **`npm run docs:build`** - Builds the guide pages for VTK.wasm
21+
- **`npm run build`** — Builds the ESM and UMD bundles for both RemoteSession and StandaloneSession.
22+
- **`npm run build:esm`** — Builds only the ESM bundles.
23+
- **`npm run build:vtk`** — Builds only the UMD bundle for StandaloneSession.
24+
- **`npm run build:viewer`** - Builds the vtkWASMViewer JavaScript library.
25+
- **`npm run clean`** — Cleans the `dist/` directory.
26+
- **`npm run lint`** — Runs code linting on the source files.
27+
28+
### Bundles
29+
30+
- **ESM Bundles:** For both RemoteSession and StandaloneSession.
31+
- **UMD Bundle:** For StandaloneSession, exposed as the `VTK` namespace for use in browser environments.
32+
33+
Refer to the `package.json` for the full list of scripts and configuration details.

eslint.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { defineConfig, globalIgnores } from "eslint/config";
2+
import globals from "globals";
3+
import js from "@eslint/js";
4+
5+
export default defineConfig([
6+
{
7+
name: "app/files-to-lint",
8+
files: ["**/*.{js,mjs,jsx}"],
9+
},
10+
11+
globalIgnores(["**/dist/**", "**/dist-ssr/**", "**/coverage/**"]),
12+
13+
{
14+
languageOptions: {
15+
globals: {
16+
...globals.browser,
17+
},
18+
},
19+
},
20+
21+
js.configs.recommended,
22+
]);

jsconfig.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"paths": {
4+
"@/*": ["./src/*"]
5+
}
6+
},
7+
"exclude": ["node_modules", "dist"]
8+
}

0 commit comments

Comments
 (0)