web-sdk

This repo is a mono repo containing all threejs related roomle projects such as planner and configurator.

Installing

Use npm install to install all prerequisites -> go grab a coffee, this takes a while.

Building and serving

You can launch the following commands with yarn or npm run:

  • "clean": cleans all generated files in the dist folder

  • "buildSdkDebug": creates a debug version of the SDK build, includes configurator, planner, glb viewer and material viewer

  • "test": start unit tests for all packages

  • "dev": build the project in watch mode and start the local server at port 4141, shows only dummy pages

  • "plannerUi": build the planner WITH UI in watch mode and start the local server at port 4747

  • "configuratorUi": build the configurator WITH UI in watch mode and start the local server at port 4747

Develop Dummy URLs

  • HSC: http://localhost:4141/configurator-dummy.html

  • HSP: http://localhost:4141/planner-dummy.html

  • GLB Viewer: http://localhost:4141/glb-viewer-dummy.html

  • Material Viewer: http://localhost:4141/material-viewer-dummy.html

Develop URLs with UI

  • HSC: http://localhost:4747

  • HSP: http://localhost:4747

Design decisions/ general info

  • Common files/classes used by all/multiple projects should be saved in 'packages/common-core'

  • Each package has a 'src' directory for classes and a 'public' directory for static files like styles/fonts/etc.

  • Using rollup instead of webpack for smaller files/chunks

  • Trying to use only rollup plugins for the build process

Batch render glTFs

Steps:

You have to prepare a special render list file, that holds information about assets and camera positions (see example below)

  • terminal cd project folder and execute yarn run dev ( alternative npm run dev )

  • open http://localhost:4141/glb-viewer-dummy.html

  • put the prepared renderlist.json into the upper left textfield

  • click "process JSON" and wait for a file named "content.zip" to be created and downloaded

renderlist example file:

CI

Run a GitHub Actions workflow locally

  • Install docker desktop

  • Install act (https://github.com/nektos/act)

  • Create a .secret file (https://github.com/nektos/act/blob/master/README.md#secrets)

Create a new file websdk.secrets inside the .act dir of this project.

Add this content to the new file:

Run:

Notes

Getting static file URLs.

When you want to get the URL of a static asset you need to append the file location with '?no-inline?url' in the same order as shown. Example:

When building the SDK, Vite will turn the file location into a relative URL.

Last updated