Options
All
  • Public
  • Public/Protected
  • All
Menu

Glacier

glacier

Build Status

Prerequisites

Dev Setup

  1. Install node canvas dependencies as appropriate for your platform. We use it to generate visualizations in test.
  2. cd into this folder
  3. npm install to get our dependencies - both build time and run time
  4. (optional) npm install -g gulp-cli to install gulp on your path. If you don't, you will not be able to use any gulp commands. Use gulp 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.

Build

  1. gulp build

Test

  1. gulp test or npm test This implicitly runs build. Baseline test results are visible online here.

Release

  1. gulp build-release Builds a minified copy of the repository into the dist folder.

Documentation

  1. gulp typedoc will regenerate the documentation

Common Build Problems

  • 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 installing those dependencies sometimes fixes the build.

Debugging

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.

Example

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()));

Design

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 reside
  • src/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 state
  • src/model - contains interfaces that describe the shape of state
  • src/mapper - logic which maps our internal state into a Vega-Lite specification object
  • src/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)

Generated using TypeDoc