- Node.js 6.X.X/7.X.X
- Git
- Node Canvas Prerequisites ( https://github.com/Automattic/node-canvas )
- Install node canvas dependencies as appropriate for your platform. We use it to generate visualizations in test.
cd
into this foldernpm install
to get our dependencies - both build time and run time- (optional)
npm install -g gulp-cli
to installgulp
on your path. If you don't, you will not be able to use anygulp
commands. Usegulp help
for a list of the available commands for this project.
If using vscode
you should install the tslint
extension to get nice lint warnings as you edit.
gulp build
gulp test
ornpm test
This implicitly runsbuild
. Baseline test results are visible online here.
gulp build-release
Builds a minified copy of the repository into the dist folder.
gulp typedoc
will regenerate the documentation
- During the development most of the problems with the build happen with the native dependencies. Specifically node canvas and AlaSQL. So make sure that all of the native dependencies are working.
- Sometimes deleting the node_modules folder and
npm install
ing those dependencies sometimes fixes the build.
The project is easiest to debug while running tests within vscode
. Just add a vscode
launch.json
(inside the .vscode
folder) similar to this one, and choose 'Launch'
on the debugging pane.
In the general case, this library should be usable like the following:
import {createModel, createSvgExporter, createSqlDataSource} from "glacier";
const model = createModel();
const exporter = createSvgExporter(model);
const source = createSqlDataSource(model, "../path/to/db");
model.subscribe(state => console.log(exporter.export()));
The library is designed as a store which you can dispatch actions to, and hook up adapters (which can dispatch actions) and exporters (which can listen on state changes) on.
src/actions
- actions creators - this is where functions which produce actions which can be dispatched to the store residesrc/reducers
- state management - this is where actions become new parts of the state; specific reducers are responsible for specific actions which update specific portions of the statesrc/model
- contains interfaces that describe the shape of statesrc/mapper
- logic which maps our internal state into a Vega-Lite specification objectsrc/adapters
- contains objects and interfaces specifying how to import data into the state (CSV, JSON, SQL, etc)src/exporters
- contains objects and interfaces specify how to export a state into something useful (SVG, ZIP, etc)