Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1 from almende/develop
Browse files Browse the repository at this point in the history
Sync with upstream
  • Loading branch information
Gillingham committed Jan 23, 2014
2 parents aa58fe8 + 93e2bd4 commit 5c04f40
Show file tree
Hide file tree
Showing 100 changed files with 28,975 additions and 28,247 deletions.
9 changes: 6 additions & 3 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
vis.js history
http://visjs.org

## <not yet released>, version 0.3.0

- Implemented option `showCurrentTime`, displaying a red, vertical bar at
current time. Thanks fi0dor.
## 2014-01-14, version 0.3.0

- Moved the generated library to folder `./dist`
- Css stylesheet must be loaded explicitly now.
- Implemented options `showCurrentTime` and `showCustomTime`. Thanks fi0dor.
- Implemented touch support for Timeline.
- Fixed broken Timeline options `min` and `max`.
- Fixed not being able to load vis.js in node.js.

Expand Down
251 changes: 125 additions & 126 deletions Jakefile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,163 +9,162 @@ var jake = require('jake'),
require('jake-utils');

// constants
var VIS = './vis.js';
var VIS_TMP = './vis.js.tmp';
var VIS_MIN = './vis.min.js';
var DIST = './dist';
var VIS = DIST + '/vis.js';
var VIS_CSS = DIST + '/vis.css';
var VIS_TMP = DIST + '/vis.js.tmp';
var VIS_MIN = DIST + '/vis.min.js';

/**
* default task
*/
desc('Execute all tasks: build all libraries');
task('default', ['build', 'minify', 'test'], function () {
console.log('done');
desc('Default task: build all libraries');
task('default', ['build', 'minify'], function () {
console.log('done');
});

/**
* build the visualization library vis.js
*/
desc('Build the visualization library vis.js');
task('build', {async: true}, function () {
// concatenate and stringify the css files
var result = concat({
src: [
'./src/timeline/component/css/timeline.css',
'./src/timeline/component/css/panel.css',
'./src/timeline/component/css/groupset.css',
'./src/timeline/component/css/itemset.css',
'./src/timeline/component/css/item.css',
'./src/timeline/component/css/timeaxis.css',
'./src/timeline/component/css/currenttime.css',
'./src/timeline/component/css/customtime.css'
],
header: '/* vis.js stylesheet */',
separator: '\n'
});
var cssText = JSON.stringify(result.code);

// concatenate the script files
concat({
dest: VIS_TMP,
src: [
'./src/module/imports.js',

'./src/shim.js',
'./src/util.js',
'./src/events.js',
'./src/EventBus.js',
'./src/DataSet.js',
'./src/DataView.js',

'./src/timeline/TimeStep.js',
'./src/timeline/Stack.js',
'./src/timeline/Range.js',
'./src/timeline/Controller.js',
'./src/timeline/component/Component.js',
'./src/timeline/component/Panel.js',
'./src/timeline/component/RootPanel.js',
'./src/timeline/component/TimeAxis.js',
'./src/timeline/component/CurrentTime.js',
'./src/timeline/component/CustomTime.js',
'./src/timeline/component/ItemSet.js',
'./src/timeline/component/item/*.js',
'./src/timeline/component/Group.js',
'./src/timeline/component/GroupSet.js',
'./src/timeline/Timeline.js',

'./src/graph/dotparser.js',
'./src/graph/shapes.js',
'./src/graph/Node.js',
'./src/graph/Edge.js',
'./src/graph/Popup.js',
'./src/graph/Groups.js',
'./src/graph/Images.js',
'./src/graph/Graph.js',

'./src/module/exports.js'
],

separator: '\n',

// Note: we insert the css as a string in the javascript code here
// the css will be injected on load of the javascript library
footer: '// inject css\n' +
'util.loadCss(' + cssText + ');\n'
});

// bundle the concatenated script and dependencies into one file
var b = browserify();
b.add(VIS_TMP);
b.bundle({
standalone: 'vis'
}, function (err, code) {
if(err) {
throw err;
}

// add header and footer
var lib = read('./src/module/header.js') + code;

// write bundled file
write(VIS, lib);
console.log('created ' + VIS);

// remove temporary file
fs.unlinkSync(VIS_TMP);

// update version number and stuff in the javascript files
replacePlaceholders(VIS);

complete();
});
jake.mkdirP(DIST);

// concatenate and stringify the css files
concat({
src: [
'./src/timeline/component/css/timeline.css',
'./src/timeline/component/css/panel.css',
'./src/timeline/component/css/groupset.css',
'./src/timeline/component/css/itemset.css',
'./src/timeline/component/css/item.css',
'./src/timeline/component/css/timeaxis.css',
'./src/timeline/component/css/currenttime.css',
'./src/timeline/component/css/customtime.css'
],
dest: VIS_CSS,
separator: '\n'
});
console.log('created ' + VIS_CSS);

// concatenate the script files
concat({
dest: VIS_TMP,
src: [
'./src/module/imports.js',

'./src/shim.js',
'./src/util.js',
'./src/events.js',
'./src/EventBus.js',
'./src/DataSet.js',
'./src/DataView.js',

'./src/timeline/TimeStep.js',
'./src/timeline/Stack.js',
'./src/timeline/Range.js',
'./src/timeline/Controller.js',
'./src/timeline/component/Component.js',
'./src/timeline/component/Panel.js',
'./src/timeline/component/RootPanel.js',
'./src/timeline/component/TimeAxis.js',
'./src/timeline/component/CurrentTime.js',
'./src/timeline/component/CustomTime.js',
'./src/timeline/component/ItemSet.js',
'./src/timeline/component/item/*.js',
'./src/timeline/component/Group.js',
'./src/timeline/component/GroupSet.js',
'./src/timeline/Timeline.js',

'./src/graph/dotparser.js',
'./src/graph/shapes.js',
'./src/graph/Node.js',
'./src/graph/Edge.js',
'./src/graph/Popup.js',
'./src/graph/Groups.js',
'./src/graph/Images.js',
'./src/graph/Graph.js',

'./src/module/exports.js'
],

separator: '\n'
});

// bundle the concatenated script and dependencies into one file
var b = browserify();
b.add(VIS_TMP);
b.bundle({
standalone: 'vis'
}, function (err, code) {
if(err) {
throw err;
}

// add header and footer
var lib = read('./src/module/header.js') + code;

// write bundled file
write(VIS, lib);
console.log('created ' + VIS);

// remove temporary file
fs.unlinkSync(VIS_TMP);

// update version number and stuff in the javascript files
replacePlaceholders(VIS);

complete();
});
});

/**
* minify the visualization library vis.js
*/
desc('Minify the visualization library vis.js');
task('minify', function () {
// minify javascript
minify({
src: VIS,
dest: VIS_MIN,
header: read('./src/module/header.js')
});
// minify javascript
minify({
src: VIS,
dest: VIS_MIN,
header: read('./src/module/header.js')
});

// update version number and stuff in the javascript files
replacePlaceholders(VIS_MIN);
// update version number and stuff in the javascript files
replacePlaceholders(VIS_MIN);

console.log('created ' + VIS_MIN);
console.log('created ' + VIS_MIN);
});

/**
* test task
*/
desc('Test the library');
task('test', ['build'], function () {
// TODO: use a testing suite for testing: nodeunit, mocha, tap, ...
var filelist = new jake.FileList();
filelist.include([
'./test/**/*.js'
]);

var files = filelist.toArray();
files.forEach(function (file) {
require('./' + file);
});

console.log('Executed ' + files.length + ' test files successfully');
task('test', function () {
// TODO: use a testing suite for testing: nodeunit, mocha, tap, ...
var filelist = new jake.FileList();
filelist.include([
'./test/**/*.js'
]);

var files = filelist.toArray();
files.forEach(function (file) {
require('./' + file);
});

console.log('Executed ' + files.length + ' test files successfully');
});

/**
* replace version, date, and name placeholders in the provided file
* @param {String} filename
*/
var replacePlaceholders = function (filename) {
replace({
replacements: [
{pattern: '@@date', replacement: today()},
{pattern: '@@version', replacement: version()}
],
src: filename
});
replace({
replacements: [
{pattern: '@@date', replacement: today()},
{pattern: '@@version', replacement: version()}
],
src: filename
});
};
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Vis.js
Copyright 2010-2013 Almende B.V.
Copyright 2010-2014 Almende B.V.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit 5c04f40

Please sign in to comment.