The Noosphere TypeScript workspace includes the sources of the following NPM packages:
@subconsciousnetwork/orb
: an implementation of the Noosphere API suitable for web browsers, built around the Noosphere Rust packages (compiled as Web Assembly).@subconsciousnetwork/sphere-viewer
: a simple web app that implements read-only access to Noosphere using@subconsciousnetwork/orb
as a dependency.
Although the packages in this workspace are intended for use in a JavaScript runtime, our Rust crates must be compiled as part of the development workflow. So, before you get started, follow these instructions to set up your environment for compiling Noosphere Rust packages to Web Assembly.
You will need a stable release of Node.js and NPM to be installed and up to date in order to build these packages. The most reliable way to ensure you have this is to install NVM and then run this command:
nvm install --lts
As an extra step, you may wish to make the versions of Node.js and NPM you just installed into the default ones available when you open your shell:
nvm alias default lts/hydrogen
With Node.js and NPM installed, run the following command from this workspace to install all the NPM dependencies needed by all the packages that are maintained here:
npm install
All build-related actions are performed by NPM scripts, and orchestrated under the hood using wireit
. So, from this directory you can run the following command:
npm run build
And, if you followed the instructions above, all the NPM packages will be built, including all of their dependencies (even the Rust packages will be compiled to Web Assembly and linked to the appropriate places in this workspace).
To run TypeScript tests in headless Chrome:
npm run test
And, to start a server to see Sphere Viewer in a browser:
npm run serve
You can add --watch
to any command and it will watch for file changes (including changes to Rust sources) and re-run the necessary steps based on the file changes detected. For example:
npm run serve --watch
If you only care about a single package, most commands will work if you run them from the package root (instead of this workspace).