Browse Source

Created bundles for individual visualizations: `vis-graph3d.min.js`,

`vis-network.min.js`, and `vis-timeline-graph2d.min.js`
codeClimate
jos 8 years ago
parent
commit
ef9ec3f61d
13 changed files with 4955 additions and 4702 deletions
  1. +5
    -0
      HISTORY.md
  2. +33
    -0
      dist/vis-graph3d.min.js
  3. +41
    -0
      dist/vis-network.min.js
  4. +39
    -0
      dist/vis-timeline-graph2d.min.js
  5. +4639
    -4583
      dist/vis.js
  6. +1
    -1
      dist/vis.map
  7. +21
    -21
      dist/vis.min.js
  8. +75
    -33
      gulpfile.js
  9. +24
    -0
      index-graph3d.js
  10. +24
    -0
      index-network.js
  11. +47
    -0
      index-timeline-graph2d.js
  12. +5
    -64
      index.js
  13. +1
    -0
      package.json

+ 5
- 0
HISTORY.md View File

@ -10,6 +10,11 @@ http://visjs.org
- Fixed #1697: Timeline not drawn when used within the Angular.js directive. - Fixed #1697: Timeline not drawn when used within the Angular.js directive.
- Fixed #1774: Wrong initial scale when Timeline contains a single item. - Fixed #1774: Wrong initial scale when Timeline contains a single item.
### General
- Created bundles for individual visualizations: `vis-graph3d.min.js`,
`vis-network.min.js`, and `vis-timeline-graph2d.min.js`.
## 2016-03-08, version 4.15.1 ## 2016-03-08, version 4.15.1

+ 33
- 0
dist/vis-graph3d.min.js
File diff suppressed because it is too large
View File


+ 41
- 0
dist/vis-network.min.js
File diff suppressed because it is too large
View File


+ 39
- 0
dist/vis-timeline-graph2d.min.js
File diff suppressed because it is too large
View File


+ 4639
- 4583
dist/vis.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/vis.map
File diff suppressed because it is too large
View File


+ 21
- 21
dist/vis.min.js
File diff suppressed because it is too large
View File


+ 75
- 33
gulpfile.js View File

@ -1,4 +1,5 @@
var fs = require('fs'); var fs = require('fs');
var async = require('async');
var gulp = require('gulp'); var gulp = require('gulp');
var gutil = require('gulp-util'); var gutil = require('gulp-util');
var concat = require('gulp-concat'); var concat = require('gulp-concat');
@ -18,6 +19,11 @@ var VIS_MAP = 'vis.map';
var VIS_MIN_JS = 'vis.min.js'; var VIS_MIN_JS = 'vis.min.js';
var VIS_CSS = 'vis.css'; var VIS_CSS = 'vis.css';
var VIS_MIN_CSS = 'vis.min.css'; var VIS_MIN_CSS = 'vis.min.css';
var INDIVIDUAL_BUNDLES = [
{entry: './index-timeline-graph2d.js', filename: 'vis-timeline-graph2d.min.js'},
{entry: './index-network.js', filename: 'vis-network.min.js'},
{entry: './index-graph3d.js', filename: 'vis-graph3d.min.js'}
];
// generate banner with today's date and correct version // generate banner with today's date and correct version
function createBanner() { function createBanner() {
@ -34,6 +40,23 @@ var bannerPlugin = new webpack.BannerPlugin(createBanner(), {
raw: true raw: true
}); });
var webpackModule = {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
cacheDirectory: true,
presets: ['es2015']
}
}
],
// exclude requires of moment.js language files
wrappedContextRegExp: /$^/
};
var webpackConfig = { var webpackConfig = {
entry: ENTRY, entry: ENTRY,
output: { output: {
@ -43,22 +66,7 @@ var webpackConfig = {
filename: VIS_JS, filename: VIS_JS,
sourcePrefix: ' ' sourcePrefix: ' '
}, },
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
cacheDirectory: true,
presets: ['es2015']
}
}
],
// exclude requires of moment.js language files
wrappedContextRegExp: /$^/
},
module: webpackModule,
plugins: [ bannerPlugin ], plugins: [ bannerPlugin ],
cache: true cache: true
//debug: true, //debug: true,
@ -75,36 +83,70 @@ var uglifyConfig = {
// create a single instance of the compiler to allow caching // create a single instance of the compiler to allow caching
var compiler = webpack(webpackConfig); var compiler = webpack(webpackConfig);
function handleCompilerCallback (err, stats) {
if (err) {
gutil.log(err.toString());
}
if (stats && stats.compilation && stats.compilation.errors) {
// output soft errors
stats.compilation.errors.forEach(function (err) {
gutil.log(err.toString());
});
if (err || stats.compilation.errors.length > 0) {
gutil.beep(); // TODO: this does not work on my system
}
}
}
// clean the dist/img directory // clean the dist/img directory
gulp.task('clean', function (cb) { gulp.task('clean', function (cb) {
rimraf(DIST + '/img', cb); rimraf(DIST + '/img', cb);
}); });
gulp.task('bundle-js', ['clean'], function (cb) {
gulp.task('bundle-js', function (cb) {
// update the banner contents (has a date in it which should stay up to date) // update the banner contents (has a date in it which should stay up to date)
bannerPlugin.banner = createBanner(); bannerPlugin.banner = createBanner();
compiler.run(function (err, stats) { compiler.run(function (err, stats) {
if (err) {
gutil.log(err.toString());
}
if (stats && stats.compilation && stats.compilation.errors) {
// output soft errors
stats.compilation.errors.forEach(function (err) {
gutil.log(err.toString());
});
if (err || stats.compilation.errors.length > 0) {
gutil.beep(); // TODO: this does not work on my system
}
}
handleCompilerCallback(err, stats);
cb(); cb();
}); });
}); });
// create individual bundles for timeline+graph2d, network, graph3d
gulp.task('bundle-js-individual', function (cb) {
// update the banner contents (has a date in it which should stay up to date)
bannerPlugin.banner = createBanner();
async.each(INDIVIDUAL_BUNDLES, function (item, callback) {
var webpackTimelineConfig = {
entry: item.entry,
output: {
library: 'vis',
libraryTarget: 'umd',
path: DIST,
filename: item.filename,
sourcePrefix: ' '
},
module: webpackModule,
plugins: [ bannerPlugin, new webpack.optimize.UglifyJsPlugin() ],
cache: true
};
var compiler = webpack(webpackTimelineConfig);
compiler.run(function (err, stats) {
handleCompilerCallback(err, stats);
callback();
});
}, cb);
});
// bundle and minify css // bundle and minify css
gulp.task('bundle-css', ['clean'], function () {
gulp.task('bundle-css', function () {
var files = [ var files = [
'./lib/shared/activator.css', './lib/shared/activator.css',
'./lib/shared/bootstrap.css', './lib/shared/bootstrap.css',
@ -161,7 +203,7 @@ gulp.task('minify', ['bundle-js'], function (cb) {
cb(); cb();
}); });
gulp.task('bundle', ['bundle-js', 'bundle-css', 'copy']);
gulp.task('bundle', ['bundle-js', 'bundle-js-individual', 'bundle-css', 'copy']);
// read command line arguments --bundle and --minify // read command line arguments --bundle and --minify
var bundle = 'bundle' in argv; var bundle = 'bundle' in argv;

+ 24
- 0
index-graph3d.js View File

@ -0,0 +1,24 @@
// utils
exports.util = require('./lib/util');
exports.DOMutil = require('./lib/DOMutil');
// data
exports.DataSet = require('./lib/DataSet');
exports.DataView = require('./lib/DataView');
exports.Queue = require('./lib/Queue');
// Graph3d
exports.Graph3d = require('./lib/graph3d/Graph3d');
exports.graph3d = {
Camera: require('./lib/graph3d/Camera'),
Filter: require('./lib/graph3d/Filter'),
Point2d: require('./lib/graph3d/Point2d'),
Point3d: require('./lib/graph3d/Point3d'),
Slider: require('./lib/graph3d/Slider'),
StepNumber: require('./lib/graph3d/StepNumber')
};
// bundled external libraries
exports.moment = require('./lib/module/moment');
exports.Hammer = require('./lib/module/hammer');
exports.keycharm = require('keycharm');

+ 24
- 0
index-network.js View File

@ -0,0 +1,24 @@
// utils
exports.util = require('./lib/util');
exports.DOMutil = require('./lib/DOMutil');
// data
exports.DataSet = require('./lib/DataSet');
exports.DataView = require('./lib/DataView');
exports.Queue = require('./lib/Queue');
// Network
exports.Network = require('./lib/network/Network');
exports.network = {
Images: require('./lib/network/Images'),
dotparser: require('./lib/network/dotparser'),
gephiParser: require('./lib/network/gephiParser'),
allOptions: require('./lib/network/options')
};
exports.network.convertDot = function (input) {return exports.network.dotparser.DOTToGraph(input)};
exports.network.convertGephi = function (input,options) {return exports.network.gephiParser.parseGephi(input,options)};
// bundled external libraries
exports.moment = require('./lib/module/moment');
exports.Hammer = require('./lib/module/hammer');
exports.keycharm = require('keycharm');

+ 47
- 0
index-timeline-graph2d.js View File

@ -0,0 +1,47 @@
// utils
exports.util = require('./lib/util');
exports.DOMutil = require('./lib/DOMutil');
// data
exports.DataSet = require('./lib/DataSet');
exports.DataView = require('./lib/DataView');
exports.Queue = require('./lib/Queue');
// Timeline
exports.Timeline = require('./lib/timeline/Timeline');
exports.Graph2d = require('./lib/timeline/Graph2d');
exports.timeline = {
Core: require('./lib/timeline/Core'),
DateUtil: require('./lib/timeline/DateUtil'),
Range: require('./lib/timeline/Range'),
stack: require('./lib/timeline/Stack'),
TimeStep: require('./lib/timeline/TimeStep'),
components: {
items: {
Item: require('./lib/timeline/component/item/Item'),
BackgroundItem: require('./lib/timeline/component/item/BackgroundItem'),
BoxItem: require('./lib/timeline/component/item/BoxItem'),
PointItem: require('./lib/timeline/component/item/PointItem'),
RangeItem: require('./lib/timeline/component/item/RangeItem')
},
BackgroundGroup: require('./lib/timeline/component/BackgroundGroup'),
Component: require('./lib/timeline/component/Component'),
CurrentTime: require('./lib/timeline/component/CurrentTime'),
CustomTime: require('./lib/timeline/component/CustomTime'),
DataAxis: require('./lib/timeline/component/DataAxis'),
DataScale: require('./lib/timeline/component/DataScale'),
GraphGroup: require('./lib/timeline/component/GraphGroup'),
Group: require('./lib/timeline/component/Group'),
ItemSet: require('./lib/timeline/component/ItemSet'),
Legend: require('./lib/timeline/component/Legend'),
LineGraph: require('./lib/timeline/component/LineGraph'),
TimeAxis: require('./lib/timeline/component/TimeAxis')
}
};
// bundled external libraries
exports.moment = require('./lib/module/moment');
exports.Hammer = require('./lib/module/hammer');
exports.keycharm = require('keycharm');

+ 5
- 64
index.js View File

@ -1,69 +1,10 @@
// utils
exports.util = require('./lib/util');
exports.DOMutil = require('./lib/DOMutil');
// data
exports.DataSet = require('./lib/DataSet');
exports.DataView = require('./lib/DataView');
exports.Queue = require('./lib/Queue');
var util = require('./lib/util');
// Graph3d // Graph3d
exports.Graph3d = require('./lib/graph3d/Graph3d');
exports.graph3d = {
Camera: require('./lib/graph3d/Camera'),
Filter: require('./lib/graph3d/Filter'),
Point2d: require('./lib/graph3d/Point2d'),
Point3d: require('./lib/graph3d/Point3d'),
Slider: require('./lib/graph3d/Slider'),
StepNumber: require('./lib/graph3d/StepNumber')
};
// Timeline
exports.Timeline = require('./lib/timeline/Timeline');
exports.Graph2d = require('./lib/timeline/Graph2d');
exports.timeline = {
Core: require('./lib/timeline/Core'),
DateUtil: require('./lib/timeline/DateUtil'),
Range: require('./lib/timeline/Range'),
stack: require('./lib/timeline/Stack'),
TimeStep: require('./lib/timeline/TimeStep'),
util.extend(exports, require('./index-graph3d'));
components: {
items: {
Item: require('./lib/timeline/component/item/Item'),
BackgroundItem: require('./lib/timeline/component/item/BackgroundItem'),
BoxItem: require('./lib/timeline/component/item/BoxItem'),
PointItem: require('./lib/timeline/component/item/PointItem'),
RangeItem: require('./lib/timeline/component/item/RangeItem')
},
BackgroundGroup: require('./lib/timeline/component/BackgroundGroup'),
Component: require('./lib/timeline/component/Component'),
CurrentTime: require('./lib/timeline/component/CurrentTime'),
CustomTime: require('./lib/timeline/component/CustomTime'),
DataAxis: require('./lib/timeline/component/DataAxis'),
DataScale: require('./lib/timeline/component/DataScale'),
GraphGroup: require('./lib/timeline/component/GraphGroup'),
Group: require('./lib/timeline/component/Group'),
ItemSet: require('./lib/timeline/component/ItemSet'),
Legend: require('./lib/timeline/component/Legend'),
LineGraph: require('./lib/timeline/component/LineGraph'),
TimeAxis: require('./lib/timeline/component/TimeAxis')
}
};
// Timeline & Graph2d
util.extend(exports, require('./index-timeline-graph2d'));
// Network // Network
exports.Network = require('./lib/network/Network');
exports.network = {
Images: require('./lib/network/Images'),
dotparser: require('./lib/network/dotparser'),
gephiParser: require('./lib/network/gephiParser'),
allOptions: require('./lib/network/options')
};
exports.network.convertDot = function (input) {return exports.network.dotparser.DOTToGraph(input)};
exports.network.convertGephi = function (input,options) {return exports.network.gephiParser.parseGephi(input,options)};
// bundled external libraries
exports.moment = require('./lib/module/moment');
exports.Hammer = require('./lib/module/hammer');
exports.keycharm = require('keycharm');
util.extend(exports, require('./index-network'));

+ 1
- 0
package.json View File

@ -30,6 +30,7 @@
}, },
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"async": "^2.0.0-rc.2",
"babel-core": "^6.6.5", "babel-core": "^6.6.5",
"babel-loader": "^6.2.4", "babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.6.0", "babel-preset-es2015": "^6.6.0",

Loading…
Cancel
Save