forked from anvaka/VivaGraphJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
91 lines (81 loc) · 2.16 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
var gulp = require('gulp');
var concat = require('gulp-concat');
var path = require('path');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var del = require('del');
var run = require('gulp-run');
var files = getFiles();
gulp.task('clean', clean);
gulp.task('build', concatenateFiles);
gulp.task('test', test);
gulp.task('release', ['clean', 'build', 'test']);
gulp.task('default', watch);
function watch() {
gulp.watch('src/**/*.js', ['build']);
}
function clean(cb) {
del(['dist'], cb);
}
function test() {
new run.Command('npm test').exec();
}
function concatenateFiles() {
gulp.src(files)
.pipe(concat('vivagraph.js'))
.pipe(gulp.dest('./dist/'))
.pipe(rename('vivagraph.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./dist/'));
}
function getFiles() {
// todo: this will be changed when we move to commonjs
return [ // core
"vivagraph.js",
"version.js",
"Utils/etc.js",
"Utils/browserInfo.js",
"Utils/indexOf.js",
"Utils/getDimensions.js",
"Utils/events.js",
"Input/dragndrop.js",
"Input/domInputManager.js",
"Input/spatialIndex.js", // TODO: Do I need this for SVG?
"Utils/timer.js",
"Utils/geom.js",
"Core/primitives.js",
"Core/graph.js",
"Core/operations.js",
"Physics/primitives.js",
"Physics/eulerIntegrator.js",
"Physics/Forces/nbodyForce.js",
"Physics/Forces/dragForce.js",
"Physics/Forces/springForce.js",
"Physics/forceSimulator.js",
"Layout/forceDirected.js",
"Layout/constant.js",
"View/renderer.js",
// extra
"Core/serializer.js",
"Algorithms/centrality.js",
"Algorithms/Community/community.js",
"Algorithms/Community/slpa.js",
"Core/generator.js",
"View/cssGraphics.js",
// svg
"Svg/svg.js",
"View/svgGraphics.js",
"View/svgNodeFactory.js",
// webgl
"WebGL/webgl.js",
"WebGL/webglUIModels.js",
"WebGL/webglNodeProgram.js",
"WebGL/webglLinkProgram.js",
"WebGL/webglImageNodeProgram.js",
"View/webglGraphics.js",
"WebGL/webglInputEvents.js",
"Input/webglInputManager.js"].map(toSrcFolder);
}
function toSrcFolder(name) {
return path.join('src', name);
}