Refocus Lens Developer Kit
The Refocus Lens Developer Kit (LDK) is a toolkit for developing, testing and packaging Refocus lenses for deployment.
Refocus is a platform for visualizing the status of some set of subjects under monitoring. The platform does not attempt to provide visualizations to satisfy every type of user. Instead, it allows users to install add-on modules, which we call lenses, to provide new visualizations. Each lens provides a new visualization to help users understand their data in a new way.
The LDK lets you build and test a lens quickly and iteratively, without having to install it into a running Refocus application. The LDK also provides some dummy datasets and simulates realtime events so you can test how your lens handles hierarchy data and realtime events.
The LDK comes with an "Example" lens pre-installed in the
./Lenses directory--you can use this to get familiar with how a lens works or as a jumping-off point for developing your own lens.
git clone https://github.com/salesforce/refocus-ldk.git cd refocus-ldk npm install
Since you can work on multiple lenses in the LDK, in this step you specify the name of the lens you want to work on (or create) right now.
Note: All the other
npm run ...scripts depend on this config setting!
npm config set refocus-ldk:lens SuperDuperLens
If you are working on multiple lenses and you aren't sure which lens you are currently using, you can run
npm config list | grep refocus-ldk:lens.
Create a basic directory structure with some starter files so you can get right into developing, testing and packaging your new lens.
npm run create
See the Lens Developer Guide for help, guidelines and reference materials.
In one terminal, from your
refocus-ldk directory, start the LDK-Prototyper, a local app server which renders your lens in a browser for rapid prototyping.
npm run prototype
In another terminal, also from your
refocus-ldk directory, automatically compile your code as you make changes so you can see the results in the browser immediately (just refresh http://localhost:3000).
npm run compile-watch
Run all the tests under your lens's
npm run test
Before you build your lens, you should update your lens metadata in
Package up all your lens resources into
./dist/SuperDuperLens.zip for deployment using the build script:
npm run build
./SuperDuperLens/lens.js, then that gets zipped up into
./dist/SuperDuperLens.zip along with
When you are ready to install your new lens into Refocus, upload
./dist/SuperDuperLens.zip as your lens
library file use the Refocus API (
/v1/lenses) or Refocus UI.