For local development, clone the repository and install all dev dependencies.
git clone [email protected]:radarlabs/radar-sdk-js.git
cd radar-sdk-js
npm install
To run tests locally, you can run the test command for a single run, or in watch
mode.
npm run test
npm run test:watch
The easiest way to develop the SDK in a browser environment, is to start up the demo app locally.
This is a small web app that will run on a local server, and serve up the Web SDK as a locally built script tag. Any code changes will be recompiled on-the-fly (will require a browser refresh to take effect).
npm run demo
This will start the demo on http://localhost:9001. The demo app uses express to serve files, and handlebars for rendering views.
Note adding new view templates will require the server to be restarted.
If you want to run a local version of the SDK in an ES Module environment, you can use npm link to use the locally built version in your project.
To setup, first link the local version of the Radar SDK
# in /radar-sdk-js
npm run build
npm link
Then in your project that has radar-sdk-js
in its package.json
npm link radar-sdk-js
This will point the package in your project to use the local version of the SDK.
Note: Make sure you're using the node.js & npm installations in both projects, especially if you're using a node manager like nvm
or n
.
To unlink, run the unlink command in the following order:
# First, from the project
npm unlink --no-save radar-sdk-js
# Then in the SDK repo
npm unlink radar-sdk-js
There is a built in utility for managing version increments:
npm run bump-version
This will increment the minor version in the necessary places throughout the codebase. This is required before cutting a new release otherwise tests will fail.
This script will also update the version used in documentation throughout the repository.
This only applies to authorized contributors
New releases are managed via Github Releases.
Creating a new release will start the Github Workflow for managing the release:
- Run tests
- Build artifacts
- Release on npm
- Deploy new script tags
- Build Github pages for demo site
Note: All release version should be prefixed with v
.
To ship a beta release, the version should be suffixed with -beta.<version number>
. This can be done with the bump-version
command.
npm run bump-version 4.0.1-beta.1
Beta versions should also be set as a pre-release
Production releases should not have a -beta
suffix, and be set as the latest
release.