This module is a JS library that communicates with Spine Web server. It’s a facade for sending domain commands, querying data, and subscribing to entity states. The latest published version can be found on NPM.
The NPM artifact provides the following:
-
spine-web
files along with used Protobuf definitions. -
Types from google-protobuf NPM package. These types should be used since they are additionally processed by Spine's Protobuf plugin for JS.
-
Sources transpiled into ES5 along with their source maps.
It does not provide a bundled version assuming that library users perform bundling themselves.
First, make sure that Node.js v12.19.0
is installed and the NPM version is v6.14.7
or higher.
See the Downloading and installing Node.js and npm
section for detailed installation instructions.
To use the library, execute the command:
npm i spine-web --save
Also, the library has peer dependencies that you need to install:
npm i rxjs --save
For a full list of peer dependencies, see package.json.
Run the tests using the following command:
npm run test
You can also run tests from IntelliJ IDEA. To do so:
-
Install NodeJs Plugin. The plugin adds
Mocha
configuration. -
Use
webpack-test.config.js
as IDEA Webpack configuration.
This allows IDEA resolve aliases the very same way Babel does for us in tests.
- Update
Mocha
configuration template:
-
Add
--require @babel/register
toExtra Mocha options
.It is required to support all ES6 features in Node.js environment.
-
Specify the path to
Mocha
package:~\IdeaProjects\Spine\web\client-js\node_modules\mocha
.
To publish a new version to NPM:
-
Log in to NPM and generate a new access token.
-
Set the generated token to your
NPM_TOKEN
environment variable. -
Execute Gradle
publishJs
task from a project root:./gradlew publishJs